Skip to content

Commit 57df788

Browse files
pdgendtkartben
authored andcommitted
scripts: logging: dictionary: log_parser_v3: Fix linter issues
Fix issues reported by ruff. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 18a8e5c commit 57df788

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,6 @@
568568
"UP036", # https://docs.astral.sh/ruff/rules/outdated-version-block
569569
"UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
570570
]
571-
"./scripts/logging/dictionary/dictionary_parser/log_parser_v3.py" = [
572-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
573-
]
574571
"./scripts/logging/dictionary/dictionary_parser/mipi_syst.py" = [
575572
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
576573
]

scripts/logging/dictionary/dictionary_parser/log_parser_v3.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
import logging
1919
import struct
20+
2021
import colorama
2122
from colorama import Fore
2223

23-
from .log_parser import (LogParser, get_log_level_str_color, formalize_fmt_string)
2424
from .data_types import DataTypes
25-
25+
from .log_parser import LogParser, formalize_fmt_string, get_log_level_str_color
2626

2727
HEX_BYTES_IN_LINE = 16
2828

@@ -101,10 +101,7 @@ def __get_string(self, arg, arg_offset, string_tbl):
101101
str_idx = arg_offset + self.data_types.get_sizeof(DataTypes.PTR) * 2
102102
str_idx /= self.data_types.get_sizeof(DataTypes.INT)
103103

104-
if int(str_idx) not in string_tbl:
105-
ret = f'<string@0x{arg:x}>'
106-
else:
107-
ret = string_tbl[int(str_idx)]
104+
ret = string_tbl.get(int(str_idx), f"<string@0x{arg:x}>")
108105

109106
return ret
110107

0 commit comments

Comments
 (0)