Skip to content

Commit 4fdd6c6

Browse files
pdgendtkartben
authored andcommitted
scripts: logging: dictionary: log_database: Fix linter issues
Fix issues reported by ruff. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 00727ed commit 4fdd6c6

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +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_database.py" = [
572-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
573-
"SIM103", # https://docs.astral.sh/ruff/rules/needless-bool
574-
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
575-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
576-
]
577571
"./scripts/logging/dictionary/dictionary_parser/log_parser.py" = [
578572
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
579573
]

scripts/logging/dictionary/dictionary_parser/log_database.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
import json
1414

1515
from .mipi_syst import gen_syst_xml_file
16-
from .utils import extract_one_string_in_section
17-
from .utils import find_string_in_mappings
18-
16+
from .utils import extract_one_string_in_section, find_string_in_mappings
1917

2018
ARCHS = {
2119
"arc" : {
@@ -51,7 +49,7 @@
5149
}
5250

5351

54-
class LogDatabase():
52+
class LogDatabase:
5553
"""Class of log database"""
5654
# Update this if database format of dictionary based logging
5755
# has changed
@@ -168,10 +166,7 @@ def set_string_mappings(self, database):
168166

169167
def has_string_mappings(self):
170168
"""Return True if there are string mappings in database"""
171-
if 'string_mappings' in self.database:
172-
return True
173-
174-
return False
169+
return 'string_mappings' in self.database
175170

176171

177172
def has_string_sections(self):
@@ -253,7 +248,7 @@ def get_kconfigs(self):
253248
def read_json_database(db_file_name):
254249
"""Read database from file and return a LogDatabase object"""
255250
try:
256-
with open(db_file_name, "r", encoding="iso-8859-1") as db_fd:
251+
with open(db_file_name, encoding="iso-8859-1") as db_fd:
257252
json_db = json.load(db_fd)
258253
except (OSError, json.JSONDecodeError):
259254
return None

0 commit comments

Comments
 (0)