|
34 | 34 | from adafruit_tinylora.adafruit_tinylora_encryption import AES
|
35 | 35 |
|
36 | 36 | try: # typing
|
37 |
| - from typing import Annotated, Optional, TypeAlias, Union |
| 37 | + from types import TracebackType |
| 38 | + from typing import Optional, Type, Union |
38 | 39 |
|
39 |
| - import busio.SPI |
40 |
| - import digitalio.DigitalInOut |
| 40 | + import busio |
| 41 | + import digitalio |
41 | 42 | from typing_extensions import Self # Python <3.11
|
| 43 | + from typing_extensions import Annotated, TypeAlias |
42 | 44 |
|
43 | 45 | # type aliases
|
44 | 46 | bytearray2: TypeAlias = Annotated[bytearray, 2]
|
@@ -237,7 +239,12 @@ def __init__(
|
237 | 239 | def __enter__(self) -> Self:
|
238 | 240 | return self
|
239 | 241 |
|
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: |
241 | 248 | self.deinit()
|
242 | 249 |
|
243 | 250 | def deinit(self) -> None:
|
@@ -301,9 +308,7 @@ def send_data(
|
301 | 308 | lora_pkt_len += 4
|
302 | 309 | self.send_packet(lora_pkt, lora_pkt_len, timeout)
|
303 | 310 |
|
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: |
307 | 312 | """Sends a LoRa packet using the RFM Module
|
308 | 313 | :param bytearray lora_packet: assembled LoRa packet from send_data
|
309 | 314 | :param int packet_length: length of LoRa packet to send
|
|
0 commit comments