Skip to content

Commit 3d9a069

Browse files
author
Victor Tang
committed
Add type hints to modernized functions
1 parent 5d863e6 commit 3d9a069

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/python/memap/memap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class MemoryBankInfo:
9191
# Size used in the memory bank in bytes (sum of the sizes of all symbols)
9292
used_size: int = 0
9393

94-
def contains_addr(self, addr: int):
94+
def contains_addr(self, addr: int) -> bool:
9595
"""
9696
:return: True if the given address is contained inside this memory bank
9797
"""
@@ -142,7 +142,7 @@ def _add_symbol_to_memory_banks(self, symbol_name: str, start_addr: int, size: i
142142
print(f"Warning: Symbol {symbol_name} (at address 0x{start_addr:x}, size {size}) is not inside a defined memory "
143143
f"bank for this target.")
144144

145-
def add_symbol(self, symbol_name: str, object_name: str, start_addr: int, size: int, section: str, vma_lma_offset: int):
145+
def add_symbol(self, symbol_name: str, object_name: str, start_addr: int, size: int, section: str, vma_lma_offset: int) -> None:
146146
""" Adds information about a symbol (e.g. a function or global variable) to the data structures.
147147
148148
Positional arguments:
@@ -243,7 +243,7 @@ class _GccParser(_Parser):
243243
+ ('unknown', )
244244
)
245245

246-
def check_new_output_section(self, line) -> tuple[str, int] | None:
246+
def check_new_output_section(self, line: str) -> tuple[str, int] | None:
247247
""" Check whether a new output section in a map file has been detected
248248
249249
Positional arguments:
@@ -293,7 +293,7 @@ def check_input_section(self, line) -> Optional[str]:
293293

294294
return match.group(1)
295295

296-
def parse_object_name(self, line) -> str:
296+
def parse_object_name(self, line: str) -> str:
297297
""" Parse a path to object file
298298
299299
Positional arguments:
@@ -805,7 +805,7 @@ def compute_report(self):
805805

806806
self.mem_report["memory_bank_usage"] = self.memory_bank_summary
807807

808-
def parse(self, mapfile: str, toolchain: str, memory_banks_json_path: str | None):
808+
def parse(self, mapfile: str, toolchain: str, memory_banks_json_path: str | None) -> bool:
809809
""" Parse and decode map file depending on the toolchain
810810
811811
Positional arguments:

0 commit comments

Comments
 (0)