Skip to content

Commit a83a3ab

Browse files
bluetoothbotclaude
andauthored
feat: remove unused address_to_bytes helper (#218)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 43b0aaa commit a83a3ab

3 files changed

Lines changed: 0 additions & 20 deletions

File tree

src/bluetooth_data_tools/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from .privacy import get_cipher_for_irk, resolve_private_address
1414
from .time import monotonic_time_coarse
1515
from .utils import (
16-
address_to_bytes,
1716
human_readable_name,
1817
int_to_bluetooth_address,
1918
mac_to_int,
@@ -26,7 +25,6 @@
2625

2726

2827
__all__ = [
29-
"address_to_bytes",
3028
"manufacturer_data_to_raw",
3129
"newest_manufacturer_data",
3230
"human_readable_name",

src/bluetooth_data_tools/utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from __future__ import annotations
44

55
from functools import lru_cache
6-
from struct import Struct
7-
8-
L_PACK = Struct(">L")
96

107
try:
118
from ._utils_impl import _int_to_bluetooth_address # noqa: F811 F401
@@ -47,15 +44,6 @@ def newest_manufacturer_data(manufacturer_data: dict[int, bytes]) -> bytes | Non
4744
return None
4845

4946

50-
def address_to_bytes(address: str) -> bytes:
51-
"""Return the address as bytes."""
52-
if ":" not in address:
53-
address_as_int = 0
54-
else:
55-
address_as_int = mac_to_int(address)
56-
return L_PACK.pack(address_as_int)
57-
58-
5947
def manufacturer_data_to_raw(manufacturer_id: int, manufacturer_data: bytes) -> bytes:
6048
"""Return the raw data from manufacturer data."""
6149
init_bytes: bytes = int(manufacturer_id).to_bytes(2, byteorder="little")

tests/test_utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from bluetooth_data_tools import (
2-
address_to_bytes,
32
human_readable_name,
43
int_to_bluetooth_address,
54
mac_to_int,
@@ -23,11 +22,6 @@ def test_newest_manufacturer_data():
2322
assert newest_manufacturer_data({}) is None
2423

2524

26-
def test_address_to_bytes():
27-
assert address_to_bytes("00:00:00:00:00:00") == b"\x00\x00\x00\x00"
28-
assert address_to_bytes("a-c-b") == b"\x00\x00\x00\x00"
29-
30-
3125
def test_manufacturer_data_to_raw():
3226
assert (
3327
manufacturer_data_to_raw(1, b"\x01\x02\x03\x04")

0 commit comments

Comments
 (0)