Skip to content

Commit 1da2a48

Browse files
authored
style: update type hints to satisfy new mypy strictness (#141)
1 parent ce1e738 commit 1da2a48

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,6 @@ _skbuild
180180

181181
# examples generate a list of assigned network addresses corresponding to mesh node IDs
182182
dhcplist.txt
183+
184+
# This project does not use uv officially, but it can be used locally.
185+
uv.lock

‎requirements-dev.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mypy
2-
cpp-linter>=1.7.1
2+
cpp-linter>=1.12.1
33
ruff

‎src/pyrf24/fake_ble.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _make_payload(self, payload) -> bytes:
530530
pl_size = 9 + len(payload) + name_length + self._show_dbm * 3
531531
buf = bytes([0x42, pl_size]) + self.mac
532532
buf += chunk(b"\x05", 1)
533-
pa_level = b""
533+
pa_level: Union[bytes, bytearray] = b""
534534
if self._show_dbm:
535535
lvl = self._radio.pa_level
536536
# assume this radio is an actual nRF24L01 (& not a clone)
@@ -621,12 +621,12 @@ def advertise(self, buf: Union[bytes, bytearray] = b"", data_type: int = 0xFF):
621621
"""
622622
if not isinstance(buf, (bytearray, bytes, list, tuple)):
623623
raise ValueError("buffer is an invalid format")
624-
payload = b""
624+
payload = bytearray()
625625
if isinstance(buf, (list, tuple)):
626626
for byte in buf:
627627
payload += byte
628628
else:
629-
payload = chunk(buf, data_type) if buf else b""
629+
payload = chunk(buf, data_type) if buf else bytearray()
630630
payload = self.whiten(self._make_payload(payload))
631631
# print("original: 0x{}".format(address_repr(payload)))
632632
# print("reversed: 0x{}".format(address_repr(reverse_bits(payload))))

0 commit comments

Comments
 (0)