adafruit / Adafruit_CircuitPython_TinyLoRa

Adafruit Tiny LoRa
MIT License
44 stars 45 forks source link

lint: add almost all annotations to pass `mypy --strict` #50

Closed samatjain closed 1 year ago

samatjain commented 1 year ago

One remains, for a context manager's exit:

adafruit_tinylora.py:240: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]

Not sure how this should be annotated, but it's not annotated in upstream cpython 3.12 either.

Added type aliases bytearray2, bytearray4, etc to signal that the bytearrays passed must be 2 bytes, 4 bytes, etc.

In adafruit_tinylora_encryption.py, there's a "state" matrix for the AES implementation there. It was mixing str and byte/int, which apparently works fine on circuitpython but fails on cpython. Change the state matrix to a bytearray, as was likely intended.

samatjain commented 1 year ago

@tekktrik PR all ready from me, and CI passing now; let me know if anything else needed!