add funcs docs
This commit is contained in:
@@ -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.')
|
||||
|
||||
Reference in New Issue
Block a user