code_relocation: fix ruff UP037 warnings

In Python, type annotations can be quoted to avoid forward references.

However, if "from __future__ import annotations" is present, Python will
always evaluate type annotations in a deferred manner, making the quotes
unnecessary.

The ruff python linter produces UP037 warnings to indicate cases where
quoting of type annotations can be removed. This patch corrects the
warnings.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
This commit is contained in:
Joel Holdsworth 2025-05-21 10:41:19 -07:00 committed by Benjamin Cabé
commit 567984c12e
2 changed files with 2 additions and 3 deletions

View file

@ -234,7 +234,6 @@
]
"./scripts/build/gen_relocate_app.py" = [
"E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs
"UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation
]
"./scripts/build/gen_strerror_table.py" = [
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders

View file

@ -643,7 +643,7 @@ def main():
sram_data_linker_file = args.output_sram_data
sram_bss_linker_file = args.output_sram_bss
rel_dict, phdrs = create_dict_wrt_mem()
complete_list_of_sections: 'dict[MemoryRegion, dict[SectionKind, list[OutputSection]]]' = (
complete_list_of_sections: dict[MemoryRegion, dict[SectionKind, list[OutputSection]]] = (
defaultdict(lambda: defaultdict(list))
)
@ -652,7 +652,7 @@ def main():
# for each memory_type, create text/rodata/data/bss sections for all obj files
for memory_type, files in rel_dict.items():
full_list_of_sections: 'dict[SectionKind, list[OutputSection]]' = defaultdict(list)
full_list_of_sections: dict[SectionKind, list[OutputSection]] = defaultdict(list)
for filename, symbol_filter in files:
obj_filename = get_obj_filename(all_obj_files, filename)