add func parm type

This commit is contained in:
2025-07-12 17:33:38 +02:00
parent b1ce9061b1
commit 7edaef3563
32 changed files with 301 additions and 75 deletions

View File

@@ -16,16 +16,16 @@ from utils.csv.loaders import get_next_csv_atomic
# Crea una context variable per identificare il worker # Crea una context variable per identificare il worker
worker_context = contextvars.ContextVar('worker_id', default='00') worker_context = contextvars.ContextVar('worker_id', default='^-^')
# Formatter personalizzato che include il worker_id # Formatter personalizzato che include il worker_id
class WorkerFormatter(logging.Formatter): class WorkerFormatter(logging.Formatter):
"""Formatter personalizzato che include l'ID del worker nei log.""" """Formatter personalizzato che include l'ID del worker nei log."""
def format(self, record): def format(self, record: str) -> str:
"""Formatta il record di log includendo l'ID del worker. """Formatta il record di log includendo l'ID del worker.
Args: Args:
record: Il record di log da formattare. record (str): Il record di log da formattare.
Returns: Returns:
La stringa formattata del record di log. La stringa formattata del record di log.
@@ -41,7 +41,7 @@ ELAB_PROCESSING_DELAY = 0.2
# Tempo di attesa se non ci sono record da elaborare # Tempo di attesa se non ci sono record da elaborare
NO_RECORD_SLEEP = 60 NO_RECORD_SLEEP = 60
async def worker(worker_id: int, cfg: object, pool) -> None: async def worker(worker_id: int, cfg: object, pool: object) -> None:
"""Esegue il ciclo di lavoro per l'elaborazione dei dati caricati. """Esegue il ciclo di lavoro per l'elaborazione dei dati caricati.
Il worker preleva un record dal database che indica dati pronti per Il worker preleva un record dal database che indica dati pronti per
@@ -51,10 +51,10 @@ async def worker(worker_id: int, cfg: object, pool) -> None:
Args: Args:
worker_id (int): L'ID univoco del worker. worker_id (int): L'ID univoco del worker.
cfg (object): L'oggetto di configurazione. cfg (object): L'oggetto di configurazione.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
""" """
# Imposta il context per questo worker # Imposta il context per questo worker
worker_context.set(f"W{worker_id}") worker_context.set(f"W{worker_id:02d}")
debug_mode = (logging.getLogger().getEffectiveLevel() == logging.DEBUG) debug_mode = (logging.getLogger().getEffectiveLevel() == logging.DEBUG)
logger.info("Avviato") logger.info("Avviato")

View File

@@ -61,13 +61,13 @@ class DummySha256Authorizer(DummyAuthorizer):
class ASEHandler(FTPHandler): class ASEHandler(FTPHandler):
"""Custom FTP handler that extends FTPHandler with custom commands and file handling.""" """Custom FTP handler that extends FTPHandler with custom commands and file handling."""
def __init__(self: object, conn: object, server: object, ioloop=None) -> None: def __init__(self: object, conn: object, server: object, ioloop:object=None) -> None:
"""Initializes the handler, adds custom commands, and sets up command permissions. """Initializes the handler, adds custom commands, and sets up command permissions.
Args: Args:
conn: The connection object. conn (object): The connection object.
server: The FTP server object. server (object): The FTP server object.
ioloop: The I/O loop object. ioloop (object): The I/O loop object.
""" """
super().__init__(conn, server, ioloop) super().__init__(conn, server, ioloop)
self.proto_cmds = FTPHandler.proto_cmds.copy() self.proto_cmds = FTPHandler.proto_cmds.copy()

View File

@@ -15,18 +15,18 @@ from utils.database import CSV_RECEIVED
from utils.csv.loaders import get_next_csv_atomic from utils.csv.loaders import get_next_csv_atomic
# Crea una context variable per identificare il worker # Crea una context variable per identificare il worker
worker_context = contextvars.ContextVar("worker_id", default="00") worker_context = contextvars.ContextVar("worker_id", default="^-^")
# Formatter personalizzato che include il worker_id # Formatter personalizzato che include il worker_id
class WorkerFormatter(logging.Formatter): class WorkerFormatter(logging.Formatter):
"""Formatter personalizzato per i log che include l'ID del worker.""" """Formatter personalizzato per i log che include l'ID del worker."""
def format(self, record): def format(self, record: str) -> str:
"""Formatta il record di log includendo l'ID del worker. """Formatta il record di log includendo l'ID del worker.
Args: Args:
record: Il record di log da formattare. record (str): Il record di log da formattare.
Returns: Returns:
La stringa formattata del record di log. La stringa formattata del record di log.
@@ -44,7 +44,7 @@ CSV_PROCESSING_DELAY = 0.2
NO_RECORD_SLEEP = 60 NO_RECORD_SLEEP = 60
async def worker(worker_id: int, cfg: object, pool) -> None: async def worker(worker_id: int, cfg: object, pool: object) -> None:
"""Esegue il ciclo di lavoro per l'elaborazione dei file CSV. """Esegue il ciclo di lavoro per l'elaborazione dei file CSV.
Il worker preleva un record CSV dal database, ne elabora il contenuto Il worker preleva un record CSV dal database, ne elabora il contenuto
@@ -53,10 +53,10 @@ async def worker(worker_id: int, cfg: object, pool) -> None:
Args: Args:
worker_id (int): L'ID univoco del worker. worker_id (int): L'ID univoco del worker.
cfg (object): L'oggetto di configurazione. cfg (object): L'oggetto di configurazione.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
""" """
# Imposta il context per questo worker # Imposta il context per questo worker
worker_context.set(f"W{worker_id}") worker_context.set(f"W{worker_id:02d}")
debug_mode = logging.getLogger().getEffectiveLevel() == logging.DEBUG debug_mode = logging.getLogger().getEffectiveLevel() == logging.DEBUG
logger.info("Avviato") logger.info("Avviato")
@@ -81,13 +81,13 @@ async def worker(worker_id: int, cfg: object, pool) -> None:
await asyncio.sleep(1) await asyncio.sleep(1)
async def load_csv(record: tuple, cfg: object, pool) -> bool: async def load_csv(record: tuple, cfg: object, pool: object) -> bool:
"""Carica ed elabora un record CSV utilizzando il modulo di parsing appropriato. """Carica ed elabora un record CSV utilizzando il modulo di parsing appropriato.
Args: Args:
record: Una tupla contenente i dettagli del record CSV da elaborare (id, unit_type, tool_type, unit_name, tool_name). record: Una tupla contenente i dettagli del record CSV da elaborare (id, unit_type, tool_type, unit_name, tool_name).
cfg: L'oggetto di configurazione contenente i parametri del sistema. cfg: L'oggetto di configurazione contenente i parametri del sistema.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
Returns: Returns:
True se l'elaborazione del CSV è avvenuta con successo, False altrimenti. True se l'elaborazione del CSV è avvenuta con successo, False altrimenti.

View File

@@ -8,14 +8,14 @@ from itertools import islice
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def get_data(cfg: object, id: int, pool) -> tuple: async def get_data(cfg: object, id: int, pool: object) -> tuple:
""" """
Retrieves unit name, tool name, and tool data for a given record ID from the database. Retrieves unit name, tool name, and tool data for a given record ID from the database.
Args: Args:
cfg (object): Configuration object containing database table name. cfg (object): Configuration object containing database table name.
id (int): The ID of the record to retrieve. id (int): The ID of the record to retrieve.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
tuple: A tuple containing unit_name, tool_name, and tool_data. tuple: A tuple containing unit_name, tool_name, and tool_data.
""" """
@@ -26,14 +26,14 @@ async def get_data(cfg: object, id: int, pool) -> tuple:
return unit_name, tool_name, tool_data return unit_name, tool_name, tool_data
async def make_pipe_sep_matrix(cfg: object, id: int, pool) -> list: async def make_pipe_sep_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes pipe-separated data from a CSV record into a structured matrix. Processes pipe-separated data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """
@@ -58,14 +58,14 @@ async def make_pipe_sep_matrix(cfg: object, id: int, pool) -> list:
return matrice_valori return matrice_valori
async def make_ain_din_matrix(cfg: object, id: int, pool) -> list: async def make_ain_din_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes analog and digital input data from a CSV record into a structured matrix. Processes analog and digital input data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """
@@ -92,14 +92,14 @@ async def make_ain_din_matrix(cfg: object, id: int, pool) -> list:
return matrice_valori return matrice_valori
async def make_channels_matrix(cfg: object, id: int, pool) -> list: async def make_channels_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes channel-based data from a CSV record into a structured matrix. Processes channel-based data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """
@@ -120,14 +120,14 @@ async def make_channels_matrix(cfg: object, id: int, pool) -> list:
return matrice_valori return matrice_valori
async def make_musa_matrix(cfg: object, id: int, pool) -> list: async def make_musa_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes 'Musa' specific data from a CSV record into a structured matrix. Processes 'Musa' specific data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """
@@ -153,14 +153,14 @@ async def make_musa_matrix(cfg: object, id: int, pool) -> list:
return matrice_valori return matrice_valori
async def make_tlp_matrix(cfg: object, id: int, pool) -> list: async def make_tlp_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes 'TLP' specific data from a CSV record into a structured matrix. Processes 'TLP' specific data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """
@@ -180,14 +180,14 @@ async def make_tlp_matrix(cfg: object, id: int, pool) -> list:
async def make_gd_matrix(cfg: object, id: int, pool) -> list: async def make_gd_matrix(cfg: object, id: int, pool: object) -> list:
""" """
Processes 'GD' specific data from a CSV record into a structured matrix. Processes 'GD' specific data from a CSV record into a structured matrix.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record. id (int): The ID of the CSV record.
pool: The database connection pool. pool (object): The database connection pool.
Returns: Returns:
list: A list of lists, where each inner list represents a row in the matrix. list: A list of lists, where each inner list represents a row in the matrix.
""" """

View File

@@ -6,14 +6,14 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def main_loader(cfg: object, id: int, pool, action: str) -> None: async def main_loader(cfg: object, id: int, pool: object, action: str) -> None:
""" """
Main loader function to process CSV data based on the specified action. Main loader function to process CSV data based on the specified action.
Args: Args:
cfg (object): Configuration object. cfg (object): Configuration object.
id (int): The ID of the CSV record to process. id (int): The ID of the CSV record to process.
pool: The database connection pool. pool (object): The database connection pool.
action (str): The type of data processing to perform (e.g., "pipe_separator", "analogic_digital"). action (str): The type of data processing to perform (e.g., "pipe_separator", "analogic_digital").
""" """
type_matrix_mapping = { type_matrix_mapping = {

View File

@@ -1,9 +1,7 @@
import re import re
def extract_value(patterns: list, primary_source: str, secondary_source: str, default='Not Defined') -> str: def extract_value(patterns: list, primary_source: str, secondary_source: str, default='Not Defined') -> str:
"""Extracts the first match for a list of patterns from the primary source.
Falls back to the secondary source if no match is found.
"""
for source in (primary_source, secondary_source): for source in (primary_source, secondary_source):
for pattern in patterns: for pattern in patterns:
matches = re.findall(pattern, source, re.IGNORECASE) matches = re.findall(pattern, source, re.IGNORECASE)

View File

@@ -7,7 +7,7 @@ logger = logging.getLogger(__name__)
timestamp_cols = ["inserted_at", "loaded_at", "elaborated_at"] timestamp_cols = ["inserted_at", "loaded_at", "elaborated_at"]
async def load_data(cfg: object, matrice_valori: list, pool) -> bool: async def load_data(cfg: object, matrice_valori: list, pool: object) -> bool:
"""Carica una lista di record di dati grezzi nel database. """Carica una lista di record di dati grezzi nel database.
Esegue un'operazione di inserimento massivo (executemany) per caricare i dati. Esegue un'operazione di inserimento massivo (executemany) per caricare i dati.
@@ -17,7 +17,7 @@ async def load_data(cfg: object, matrice_valori: list, pool) -> bool:
Args: Args:
cfg (object): L'oggetto di configurazione contenente i nomi delle tabelle e i parametri di re-tentativo. cfg (object): L'oggetto di configurazione contenente i nomi delle tabelle e i parametri di re-tentativo.
matrice_valori (list): Una lista di tuple, dove ogni tupla rappresenta una riga da inserire. matrice_valori (list): Una lista di tuple, dove ogni tupla rappresenta una riga da inserire.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
Returns: Returns:
bool: True se il caricamento ha avuto successo, False altrimenti. bool: True se il caricamento ha avuto successo, False altrimenti.
@@ -93,14 +93,14 @@ async def load_data(cfg: object, matrice_valori: list, pool) -> bool:
return rc return rc
async def update_status(cfg: object, id: int, status: int, pool) -> None: async def update_status(cfg: object, id: int, status: int, pool: object) -> None:
"""Aggiorna lo stato di un record nella tabella dei record CSV. """Aggiorna lo stato di un record nella tabella dei record CSV.
Args: Args:
cfg (object): L'oggetto di configurazione contenente il nome della tabella. cfg (object): L'oggetto di configurazione contenente il nome della tabella.
id (int): L'ID del record da aggiornare. id (int): L'ID del record da aggiornare.
status (int): Il nuovo stato da impostare. status (int): Il nuovo stato da impostare.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
""" """
async with pool.acquire() as conn: async with pool.acquire() as conn:
async with conn.cursor() as cur: async with conn.cursor() as cur:
@@ -115,7 +115,7 @@ async def update_status(cfg: object, id: int, status: int, pool) -> None:
logging.error(f"Error: {e}") logging.error(f"Error: {e}")
async def unlock(cfg: object, id: int, pool) -> None: async def unlock(cfg: object, id: int, pool: object) -> None:
"""Sblocca un record nella tabella dei record CSV. """Sblocca un record nella tabella dei record CSV.
Imposta il campo 'locked' a 0 per un dato ID. Imposta il campo 'locked' a 0 per un dato ID.
@@ -123,7 +123,7 @@ async def unlock(cfg: object, id: int, pool) -> None:
Args: Args:
cfg (object): L'oggetto di configurazione contenente il nome della tabella. cfg (object): L'oggetto di configurazione contenente il nome della tabella.
id (int): L'ID del record da sbloccare. id (int): L'ID del record da sbloccare.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
""" """
async with pool.acquire() as conn: async with pool.acquire() as conn:
async with conn.cursor() as cur: async with conn.cursor() as cur:
@@ -138,14 +138,14 @@ async def unlock(cfg: object, id: int, pool) -> None:
logging.error(f"Error: {e}") logging.error(f"Error: {e}")
async def get_matlab_cmd(cfg: object, unit: str, tool: str, pool) -> tuple: async def get_matlab_cmd(cfg: object, unit: str, tool: str, pool: object) -> tuple:
"""Recupera le informazioni per l'esecuzione di un comando Matlab dal database. """Recupera le informazioni per l'esecuzione di un comando Matlab dal database.
Args: Args:
cfg (object): L'oggetto di configurazione. cfg (object): L'oggetto di configurazione.
unit (str): Il nome dell'unità. unit (str): Il nome dell'unità.
tool (str): Il nome dello strumento. tool (str): Il nome dello strumento.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
Returns: Returns:
tuple: Una tupla contenente le informazioni del comando Matlab, o None in caso di errore. tuple: Una tupla contenente le informazioni del comando Matlab, o None in caso di errore.

View File

@@ -3,7 +3,7 @@ import aiomysql
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def get_matlab_command(cfg: object, tool: str, unit: str, pool) -> tuple: async def get_matlab_command(cfg: object, tool: str, unit: str, pool: object) -> tuple:
"""Recupera le informazioni per l'esecuzione di un comando Matlab dal database. """Recupera le informazioni per l'esecuzione di un comando Matlab dal database.
Interroga il database per ottenere i dettagli necessari all'avvio di uno script Interroga il database per ottenere i dettagli necessari all'avvio di uno script
@@ -13,7 +13,7 @@ async def get_matlab_command(cfg: object, tool: str, unit: str, pool) -> tuple:
cfg (object): L'oggetto di configurazione. cfg (object): L'oggetto di configurazione.
tool (str): Il nome dello strumento. tool (str): Il nome dello strumento.
unit (str): Il nome dell'unità. unit (str): Il nome dell'unità.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
Returns: Returns:
tuple: Una tupla contenente le informazioni del comando Matlab, tuple: Una tupla contenente le informazioni del comando Matlab,

View File

@@ -4,14 +4,14 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def get_nodes_type(cfg: object, tool: str, unit: str, pool) -> tuple: async def get_nodes_type(cfg: object, tool: str, unit: str, pool: object) -> tuple:
"""Recupera le informazioni sui nodi (tipo, canali, input) per un dato strumento e unità. """Recupera le informazioni sui nodi (tipo, canali, input) per un dato strumento e unità.
Args: Args:
cfg (object): L'oggetto di configurazione. cfg (object): L'oggetto di configurazione.
tool (str): Il nome dello strumento. tool (str): Il nome dello strumento.
unit (str): Il nome dell'unità. unit (str): Il nome dell'unità.
pool: Il pool di connessioni al database. pool (object): Il pool di connessioni al database.
Returns: Returns:
tuple: Una tupla contenente quattro liste: canali, tipi, ain, din. tuple: Una tupla contenente quattro liste: canali, tipi, ain, din.

View File

@@ -10,7 +10,11 @@ from utils.database.connection import connetti_db
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def ftp_SITE_ADDU(self: object, line: str) -> None: def ftp_SITE_ADDU(self: object, line: str) -> None:
"""Adds a virtual user, creates their directory, and saves their details to the database. """
Adds a virtual user, creates their directory, and saves their details to the database.
Args:
line (str): A string containing the username and password separated by a space.
""" """
cfg = self.cfg cfg = self.cfg
try: try:
@@ -51,7 +55,12 @@ def ftp_SITE_ADDU(self: object, line: str) -> None:
print(e) print(e)
def ftp_SITE_DISU(self: object, line: str) -> None: def ftp_SITE_DISU(self: object, line: str) -> None:
"""Removes a virtual user from the authorizer and marks them as deleted in the database.""" """
Removes a virtual user from the authorizer and marks them as deleted in the database.
Args:
line (str): A string containing the username to be disabled.
"""
cfg = self.cfg cfg = self.cfg
parms = line.split() parms = line.split()
user = os.path.basename(parms[0]) # Extract the username user = os.path.basename(parms[0]) # Extract the username
@@ -78,7 +87,12 @@ def ftp_SITE_DISU(self: object, line: str) -> None:
print(e) print(e)
def ftp_SITE_ENAU(self: object, line: str) -> None: def ftp_SITE_ENAU(self: object, line: str) -> None:
"""Restores a virtual user by updating their status in the database and adding them back to the authorizer.""" """
Restores a virtual user by updating their status in the database and adding them back to the authorizer.
Args:
line (str): A string containing the username to be enabled.
"""
cfg = self.cfg cfg = self.cfg
parms = line.split() parms = line.split()
user = os.path.basename(parms[0]) # Extract the username user = os.path.basename(parms[0]) # Extract the username
@@ -117,7 +131,12 @@ def ftp_SITE_ENAU(self: object, line: str) -> None:
print(e) print(e)
def ftp_SITE_LSTU(self: object, line: str) -> None: def ftp_SITE_LSTU(self: object, line: str) -> None:
"""Lists all virtual users from the database.""" """
Lists all virtual users from the database.
Args:
line (str): An empty string (no arguments needed for this command).
"""
cfg = self.cfg cfg = self.cfg
users_list = [] users_list = []
try: try:

View File

@@ -1 +1 @@
"""Parser delle centraline""" """Parser delle centraline con le tipologie di unit e tool"""

View File

@@ -1 +1 @@
"""Parser delle centraline""" """Parser delle centraline con nomi di unit e tool"""

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'cr1000x_cr1000x'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'd2w_d2w'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as channels_main_loader from utils.csv.loaders import main_loader as channels_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g201_g201'.
Questa funzione è un wrapper per `channels_main_loader` e passa il tipo
di elaborazione come "channels".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await channels_main_loader(cfg, id, pool,"channels") await channels_main_loader(cfg, id, pool,"channels")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g301_g301'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g801_iptm'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as analog_dig_main_loader from utils.csv.loaders import main_loader as analog_dig_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g801_loc'.
Questa funzione è un wrapper per `analog_dig_main_loader` e passa il tipo
di elaborazione come "analogic_digital".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await analog_dig_main_loader(cfg, id, pool, "analogic_digital") await analog_dig_main_loader(cfg, id, pool, "analogic_digital")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g801_mums'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as musa_main_loader from utils.csv.loaders import main_loader as musa_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g801_musa'.
Questa funzione è un wrapper per `musa_main_loader` e passa il tipo
di elaborazione come "musa".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await musa_main_loader(cfg, id, pool, "musa") await musa_main_loader(cfg, id, pool, "musa")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as channels_main_loader from utils.csv.loaders import main_loader as channels_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g801_mux'.
Questa funzione è un wrapper per `channels_main_loader` e passa il tipo
di elaborazione come "channels".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await channels_main_loader(cfg, id, pool, "channels") await channels_main_loader(cfg, id, pool, "channels")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_dsas'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as gd_main_loader from utils.csv.loaders import main_loader as gd_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_gd'.
Questa funzione è un wrapper per `gd_main_loader` e passa il tipo
di elaborazione come "gd".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await gd_main_loader(cfg, id, pool, "gd") await gd_main_loader(cfg, id, pool, "gd")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as analog_dig_main_loader from utils.csv.loaders import main_loader as analog_dig_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_loc'.
Questa funzione è un wrapper per `analog_dig_main_loader` e passa il tipo
di elaborazione come "analogic_digital".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await analog_dig_main_loader(cfg, id, pool, "analogic_digital") await analog_dig_main_loader(cfg, id, pool, "analogic_digital")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_modb'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_mums'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as channels_main_loader from utils.csv.loaders import main_loader as channels_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'g802_mux'.
Questa funzione è un wrapper per `channels_main_loader` e passa il tipo
di elaborazione come "channels".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await channels_main_loader(cfg, id, pool, "channels") await channels_main_loader(cfg, id, pool, "channels")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as tlp_main_loader from utils.csv.loaders import main_loader as tlp_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'gs1_gs1'.
Questa funzione è un wrapper per `tlp_main_loader` e passa il tipo
di elaborazione come "tlp".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await tlp_main_loader(cfg, id, pool, "tlp") await tlp_main_loader(cfg, id, pool, "tlp")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as pipe_sep_main_loader from utils.csv.loaders import main_loader as pipe_sep_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'hortus_hortus'.
Questa funzione è un wrapper per `pipe_sep_main_loader` e passa il tipo
di elaborazione come "pipe_separator".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await pipe_sep_main_loader(cfg, id, pool, "pipe_separator") await pipe_sep_main_loader(cfg, id, pool, "pipe_separator")

View File

@@ -9,7 +9,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
UnitName, ToolNameID, ToolData = await get_data(cfg, id, pool) UnitName, ToolNameID, ToolData = await get_data(cfg, id, pool)
# Creare un file temporaneo # Creare un file temporaneo

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as analog_dig_main_loader from utils.csv.loaders import main_loader as analog_dig_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'tlp_loc'.
Questa funzione è un wrapper per `analog_dig_main_loader` e passa il tipo
di elaborazione come "analogic_digital".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await analog_dig_main_loader(cfg, id, pool, "analogic_digital") await analog_dig_main_loader(cfg, id, pool, "analogic_digital")

View File

@@ -1,4 +1,15 @@
from utils.csv.loaders import main_loader as tlp_main_loader from utils.csv.loaders import main_loader as tlp_main_loader
async def main_loader(cfg: object, id: int, pool) -> None: async def main_loader(cfg: object, id: int, pool: object) -> None:
"""
Carica ed elabora i dati CSV specifici per il tipo 'tlp_tlp'.
Questa funzione è un wrapper per `tlp_main_loader` e passa il tipo
di elaborazione come "tlp".
Args:
cfg (object): L'oggetto di configurazione.
id (int): L'ID del record CSV da elaborare.
pool (object): Il pool di connessioni al database.
"""
await tlp_main_loader(cfg, id, pool, "tlp") await tlp_main_loader(cfg, id, pool, "tlp")