Skip to content

Commit 0d20081

Browse files
committed
review fixes
1 parent bb68abe commit 0d20081

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

adafruit_tinylora/adafruit_tinylora.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@
3434
from adafruit_tinylora.adafruit_tinylora_encryption import AES
3535

3636
try: # typing
37-
from typing import Annotated, Optional, TypeAlias, Union
37+
from types import TracebackType
38+
from typing import Optional, Type, Union
3839

39-
import busio.SPI
40-
import digitalio.DigitalInOut
40+
import busio
41+
import digitalio
4142
from typing_extensions import Self # Python <3.11
43+
from typing_extensions import Annotated, TypeAlias
4244

4345
# type aliases
4446
bytearray2: TypeAlias = Annotated[bytearray, 2]
@@ -237,7 +239,12 @@ def __init__(
237239
def __enter__(self) -> Self:
238240
return self
239241

240-
def __exit__(self, exception_type, exception_value, traceback) -> None:
242+
def __exit__(
243+
self,
244+
exception_type: Optional[Type[type]],
245+
exception_value: Optional[BaseException],
246+
traceback: Optional[TracebackType],
247+
) -> None:
241248
self.deinit()
242249

243250
def deinit(self) -> None:
@@ -301,9 +308,7 @@ def send_data(
301308
lora_pkt_len += 4
302309
self.send_packet(lora_pkt, lora_pkt_len, timeout)
303310

304-
def send_packet(
305-
self, lora_packet: bytearray, packet_length: int, timeout: int
306-
) -> None:
311+
def send_packet(self, lora_packet: bytearray, packet_length: int, timeout: int) -> None:
307312
"""Sends a LoRa packet using the RFM Module
308313
:param bytearray lora_packet: assembled LoRa packet from send_data
309314
:param int packet_length: length of LoRa packet to send

0 commit comments

Comments
 (0)