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

@@ -1,11 +1,11 @@
import glob
import os
from itertools import cycle, chain
import logging
import os
from itertools import chain, cycle
logger = logging.getLogger()
def alterna_valori(*valori: any, ping_pong: bool = False) -> any:
"""
Genera una sequenza ciclica di valori, con opzione per una sequenza "ping-pong".
@@ -64,13 +64,13 @@ async def read_error_lines_from_logs(base_path: str, pattern: str) -> tuple[list
for file_path in matching_files:
try:
with open(file_path, 'r', encoding='utf-8') as file:
with open(file_path, encoding="utf-8") as file:
lines = file.readlines()
# Usando dict.fromkeys() per mantenere l'ordine e togliere le righe duplicate per i warnings
non_empty_lines = [line.strip() for line in lines if line.strip()]
errors = [line for line in non_empty_lines if line.startswith('Error')]
warnings = list(dict.fromkeys(line for line in non_empty_lines if not line.startswith('Error')))
errors = [line for line in non_empty_lines if line.startswith("Error")]
warnings = list(dict.fromkeys(line for line in non_empty_lines if not line.startswith("Error")))
except Exception as e:
logger.error(f"Errore durante la lettura del file {file_path}: {e}")