Skip to content

Commit a5c007c

Browse files
committed
Update danger.py
1 parent b7e955e commit a5c007c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/plf/danger.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
from .experiment import get_ppls, PipeLine
33

44
def corrupt_ppl(pplid: str):
5+
"""
6+
Deletes a record from the 'ppls' table in the SQLite database if the provided
7+
`pplid` exists and the user confirms the deletion.
8+
9+
Args:
10+
pplid (str): The ID of the person or record to be deleted.
11+
12+
Raises:
13+
FileNotFoundError: If the database directory doesn't exist.
14+
sqlite3.Error: If there is an issue executing the SQL query.
15+
16+
This function will:
17+
- Check if the provided `pplid` exists in the database.
18+
- Ask the user to confirm the deletion by entering the same `pplid`.
19+
- If the `pplid` matches, the record is deleted from the database.
20+
- If the `pplid` does not match, the deletion is aborted.
21+
- If the `pplid` is not found in the list, a message is displayed.
22+
"""
523
P = PipeLine()
624
db_path = f"{P.settings['data_path']}/ppls.db"
725
# Use the Db class context manager for automatic connection management

0 commit comments

Comments
 (0)