lint con ruff

This commit is contained in:
2025-09-22 22:30:54 +02:00
parent 35527c89cd
commit fb2b2724ed
54 changed files with 585 additions and 432 deletions

View File

@@ -4,14 +4,14 @@ Orchestratore dei worker che caricano i dati su dataraw
"""
# Import necessary libraries
import logging
import importlib
import asyncio
import importlib
import logging
# Import custom modules for configuration and database connection
from utils.config import loader_load_data as setting
from utils.database import WorkflowFlags
from utils.csv.loaders import get_next_csv_atomic
from utils.database import WorkflowFlags
from utils.orchestrator_utils import run_orchestrator, worker_context
# Initialize the logger for this module
@@ -58,7 +58,7 @@ async def worker(worker_id: int, cfg: dict, pool: object) -> None:
logger.info("Nessun record disponibile")
await asyncio.sleep(NO_RECORD_SLEEP)
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logger.error("Errore durante l'esecuzione: %s", e, exc_info=1)
await asyncio.sleep(1)
@@ -79,9 +79,7 @@ async def load_csv(record: tuple, cfg: object, pool: object) -> bool:
debug_mode = logging.getLogger().getEffectiveLevel() == logging.DEBUG
logger.debug("Inizio ricerca nuovo CSV da elaborare")
rec_id, unit_type, tool_type, unit_name, tool_name = [
x.lower().replace(" ", "_") if isinstance(x, str) else x for x in record
]
rec_id, unit_type, tool_type, unit_name, tool_name = [x.lower().replace(" ", "_") if isinstance(x, str) else x for x in record]
logger.info(
"Trovato CSV da elaborare: ID=%s, Tipo=%s_%s, Nome=%s_%s",
rec_id,
@@ -118,7 +116,7 @@ async def load_csv(record: tuple, cfg: object, pool: object) -> bool:
return False
# Ottiene la funzione 'main_loader' dal modulo
funzione = getattr(modulo, "main_loader")
funzione = modulo.main_loader
# Esegui la funzione
logger.info("Elaborazione con modulo %s per ID=%s", modulo, rec_id)