lint con ruff
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user