code_relocation: fix ruff SUM401 warning
The ruff python linter produces a SIM401 warning when a dictionary is accessed using if-statements to check for key presence. In this case, the dict.get() method could be used instead. For example: value = foo["bar"] if "bar" in foo else 0 ...can be replaced with: value = foo.get("bar", 0) This patch corrects the single instance of this issue in the script. Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
This commit is contained in:
parent
f4c54fcb93
commit
6ede0d5bc1
2 changed files with 1 additions and 2 deletions
|
@ -234,7 +234,6 @@
|
|||
]
|
||||
"./scripts/build/gen_relocate_app.py" = [
|
||||
"E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs
|
||||
"SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get
|
||||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import
|
||||
"UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation
|
||||
|
|
|
@ -333,7 +333,7 @@ def print_linker_sections(list_sections: 'list[OutputSection]'):
|
|||
|
||||
|
||||
def add_phdr(memory_type, phdrs):
|
||||
return f'{memory_type} {phdrs[memory_type] if memory_type in phdrs else ""}'
|
||||
return f'{memory_type} {phdrs.get(memory_type, "")}'
|
||||
|
||||
|
||||
def string_create_helper(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue