Skip to content

Commit bd5e91e

Browse files
authored
perf(utils): cache human_readable_name (#266)
1 parent 780eb0a commit bd5e91e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/bluetooth_data_tools/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def short_address(address: str) -> str:
3939
return f"{second_last.upper()}{last.upper()}"[-4:]
4040

4141

42+
@lru_cache(maxsize=512)
4243
def human_readable_name(name: str | None, local_name: str, address: str) -> str:
4344
"""Return a human readable name for the given name, local_name, and address."""
4445
return f"{name or local_name} ({short_address(address)})"

0 commit comments

Comments
 (0)