From fdfe91957995d90059e391f5962bc424b80c16d8 Mon Sep 17 00:00:00 2001 From: Boaz Haim Date: Thu, 7 Nov 2024 14:28:56 +0200 Subject: [PATCH] pylint fixes --- .../src/loganalyze/log_analyzer.py | 7 +++---- .../ibdiagnet2_port_counters_log_regex.py | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzer.py b/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzer.py index 32a39cc0..add4a7be 100755 --- a/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzer.py +++ b/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzer.py @@ -44,7 +44,6 @@ from loganalyze.log_analyzers.console_log_analyzer import ConsoleLogAnalyzer from loganalyze.log_analyzers.rest_api_log_analyzer import RestApiAnalyzer from loganalyze.log_analyzers.link_flapping_analyzer import LinkFlappingAnalyzer -from loganalyze.log_analyzers.ibdiagnet_log_analyzer import IBDIAGNETLogAnalyzer from loganalyze.pdf_creator import PDFCreator from loganalyze.utils.common import delete_files_by_types @@ -392,9 +391,9 @@ def create_analyzer(parsed_args, full_extracted_logs_list, # Clean some unended files created during run files_types_to_delete = set() files_types_to_delete.add("png") #png images created for PDF report - # files_types_to_delete.add("log") #logs taken from the logs - # files_types_to_delete.add("csv") #tmp csv + telemetery samples - # files_types_to_delete.add("gz") #gz files of logs and samples + files_types_to_delete.add("log") #logs taken from the logs + files_types_to_delete.add("csv") #tmp csv + telemetery samples + files_types_to_delete.add("gz") #gz files of logs and samples delete_files_by_types(args.destination, files_types_to_delete) except Exception as exc: diff --git a/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_parsing/ibdiagnet2_port_counters_log_regex.py b/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_parsing/ibdiagnet2_port_counters_log_regex.py index 6d3e384c..5f994f2f 100644 --- a/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_parsing/ibdiagnet2_port_counters_log_regex.py +++ b/plugins/ufm_log_analyzer_plugin/src/loganalyze/log_parsing/ibdiagnet2_port_counters_log_regex.py @@ -15,7 +15,8 @@ from loganalyze.log_parsing.base_regex import RegexAndHandlers -ITERATION_TIME_REGEX = re.compile(r"^\[ExportAPI_STATS\] Iteration time\: ([\d\.]+) sec \@ \[([\d\-]+ [\d\:\.]+)\]$") +ITERATION_TIME_REGEX = re.compile(r"^\[ExportAPI_STATS\] Iteration time" + r"\: ([\d\.]+) sec \@ \[([\d\-]+ [\d\:\.]+)\]$") TIMEOUT_DUMP_CORE_REGEX = re.compile(r"^timeout: the monitored command dumped core$") @@ -28,7 +29,7 @@ def iteration_time(match: Match): timestamp = match.group(2) return ("iteration_time", timestamp, iteration_time_sec, None) -def timeout_dump_core(match: Match): +def timeout_dump_core(_: Match): return ("timeout_dump_core", None, None, None) def total_switch_ports(match: Match): @@ -37,19 +38,21 @@ def total_switch_ports(match: Match): return ("total_switch_ports", None, total_switches, total_ports) def collectx_version(match:Match): - collectx_version = match.group(1) - return ("collectx_version", None, collectx_version, None) + collectx_version_str = match.group(1) + return ("collectx_version", None, collectx_version_str, None) ibdiagnet2_headers = ("type", "timestamp", "data", "extra") -ibdiagnet2_primary_log_regex_cls = RegexAndHandlers("ufm_logs_ibdiagnet2_port_counters.log", ibdiagnet2_headers) -ibdiagnet2_secondary_log_regex_cls = RegexAndHandlers("secondary_telemetry_ibdiagnet2_port_counters.log", ibdiagnet2_headers) +ibdiagnet2_primary_log_regex_cls = \ + RegexAndHandlers("ufm_logs_ibdiagnet2_port_counters.log", ibdiagnet2_headers) +ibdiagnet2_secondary_log_regex_cls = \ + RegexAndHandlers("secondary_telemetry_ibdiagnet2_port_counters.log", ibdiagnet2_headers) regex_funcs_map = {ITERATION_TIME_REGEX: iteration_time, TIMEOUT_DUMP_CORE_REGEX:timeout_dump_core, TOTAL_SWITCH_PORTS_REGEX: total_switch_ports, COLLECTX_VERSION_REGEX: collectx_version} -for regex in regex_funcs_map: - ibdiagnet2_primary_log_regex_cls.add_regex(regex, regex_funcs_map[regex]) - ibdiagnet2_secondary_log_regex_cls.add_regex(regex, regex_funcs_map[regex]) +for regex, regex_func in regex_funcs_map.items(): + ibdiagnet2_primary_log_regex_cls.add_regex(regex, regex_func) + ibdiagnet2_secondary_log_regex_cls.add_regex(regex, regex_func)