add funcs docs

This commit is contained in:
2025-08-19 12:01:15 +02:00
parent 2b976d06b3
commit b79f07b407
17 changed files with 285 additions and 41 deletions

View File

@@ -10,11 +10,16 @@ from utils.csv.parser import extract_value
logger = logging.getLogger(__name__)
def on_file_received(self: object, file: str) -> None:
"""Handles the event when a file is successfully received.
"""
Processes a received file, extracts relevant information, and inserts it into the database.
If the file is empty, it is removed. Otherwise, it extracts unit and tool
information from the filename and the first few lines of the CSV, handles
aliases, and then inserts the data into the configured database table.
Args:
file: The path to the received file.
"""
file (str): The path to the received file."""
if not os.stat(file).st_size:
os.remove(file)
logger.info(f'File {file} is empty: removed.')