code_relocation: fix ruff SIM102 warning

The ruff python linter produces a SIM102 warning when there are nested if
statements which can be collapsed into a single if statement:

    if foo:
        if bar:
	    ...

...becomes...

    if foo and bar:
        ...

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:
Joel Holdsworth 2025-05-21 10:17:15 -07:00 committed by Benjamin Cabé
commit f4c54fcb93
2 changed files with 2 additions and 4 deletions

View file

@ -234,7 +234,6 @@
] ]
"./scripts/build/gen_relocate_app.py" = [ "./scripts/build/gen_relocate_app.py" = [
"E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
"SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import

View file

@ -551,9 +551,8 @@ def get_obj_filename(all_obj_files, filename):
obj_filename = filename.split("/")[-1] + ".obj" obj_filename = filename.split("/")[-1] + ".obj"
for obj_file in all_obj_files: for obj_file in all_obj_files:
if obj_file.name == obj_filename: if obj_file.name == obj_filename and filename.split("/")[-2] in obj_file.parent.name:
if filename.split("/")[-2] in obj_file.parent.name: return str(obj_file)
return str(obj_file)
# Extracts all possible components for the input string: # Extracts all possible components for the input string: