scripts: logging: dictionary: log_database: Fix linter issues
Fix issues reported by ruff. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
00727ed5b1
commit
4fdd6c6cdc
2 changed files with 4 additions and 15 deletions
|
@ -568,12 +568,6 @@
|
||||||
"UP036", # https://docs.astral.sh/ruff/rules/outdated-version-block
|
"UP036", # https://docs.astral.sh/ruff/rules/outdated-version-block
|
||||||
"UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
|
"UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
|
||||||
]
|
]
|
||||||
"./scripts/logging/dictionary/dictionary_parser/log_database.py" = [
|
|
||||||
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
|
|
||||||
"SIM103", # https://docs.astral.sh/ruff/rules/needless-bool
|
|
||||||
"UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes
|
|
||||||
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
|
|
||||||
]
|
|
||||||
"./scripts/logging/dictionary/dictionary_parser/log_parser.py" = [
|
"./scripts/logging/dictionary/dictionary_parser/log_parser.py" = [
|
||||||
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
|
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
|
||||||
]
|
]
|
||||||
|
|
|
@ -13,9 +13,7 @@ import copy
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .mipi_syst import gen_syst_xml_file
|
from .mipi_syst import gen_syst_xml_file
|
||||||
from .utils import extract_one_string_in_section
|
from .utils import extract_one_string_in_section, find_string_in_mappings
|
||||||
from .utils import find_string_in_mappings
|
|
||||||
|
|
||||||
|
|
||||||
ARCHS = {
|
ARCHS = {
|
||||||
"arc" : {
|
"arc" : {
|
||||||
|
@ -51,7 +49,7 @@ ARCHS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class LogDatabase():
|
class LogDatabase:
|
||||||
"""Class of log database"""
|
"""Class of log database"""
|
||||||
# Update this if database format of dictionary based logging
|
# Update this if database format of dictionary based logging
|
||||||
# has changed
|
# has changed
|
||||||
|
@ -168,10 +166,7 @@ class LogDatabase():
|
||||||
|
|
||||||
def has_string_mappings(self):
|
def has_string_mappings(self):
|
||||||
"""Return True if there are string mappings in database"""
|
"""Return True if there are string mappings in database"""
|
||||||
if 'string_mappings' in self.database:
|
return 'string_mappings' in self.database
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def has_string_sections(self):
|
def has_string_sections(self):
|
||||||
|
@ -253,7 +248,7 @@ class LogDatabase():
|
||||||
def read_json_database(db_file_name):
|
def read_json_database(db_file_name):
|
||||||
"""Read database from file and return a LogDatabase object"""
|
"""Read database from file and return a LogDatabase object"""
|
||||||
try:
|
try:
|
||||||
with open(db_file_name, "r", encoding="iso-8859-1") as db_fd:
|
with open(db_file_name, encoding="iso-8859-1") as db_fd:
|
||||||
json_db = json.load(db_fd)
|
json_db = json.load(db_fd)
|
||||||
except (OSError, json.JSONDecodeError):
|
except (OSError, json.JSONDecodeError):
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue