5050# to have this in a try/except to enable type hinting for the IDEs while
5151# not breaking the runtime on the controller.
5252try :
53- from typing import Any , Sized
53+ from typing import Any , Sized , Optional
54+ from busio import I2C
5455except ImportError :
5556 pass
5657
5758from micropython import const
58- from adafruit_bus_device .i2c_device import I2CDevice , I2C
59+ from adafruit_bus_device .i2c_device import I2CDevice
5960from adafruit_binascii import hexlify , unhexlify
6061
6162__version__ = "0.0.0+auto.0"
@@ -260,7 +261,7 @@ def lock_all_zones(self):
260261 self .lock (0 )
261262 self .lock (1 )
262263
263- def lock (self , zone : Any ):
264+ def lock (self , zone : int ):
264265 """Locks specific ATECC zones.
265266 :param int zone: ATECC zone to lock.
266267 """
@@ -272,7 +273,7 @@ def lock(self, zone: Any):
272273 assert res [0 ] == 0x00 , "Failed locking ATECC!"
273274 self .idle ()
274275
275- def info (self , mode : int , param : Any = None ) -> bytearray :
276+ def info (self , mode : int , param : Optional [ Any ] = None ) -> bytearray :
276277 """
277278 Returns device state information
278279
@@ -394,7 +395,7 @@ def _random(self, data: bytearray) -> bytearray:
394395 return data
395396
396397 # SHA-256 Commands
397- def sha_start (self ):
398+ def sha_start (self ) -> bytearray :
398399 """
399400 Initializes the SHA-256 calculation engine
400401 and the SHA context in memory.
@@ -409,7 +410,7 @@ def sha_start(self):
409410 self .idle ()
410411 return status
411412
412- def sha_update (self , message : Any ) -> bytearray :
413+ def sha_update (self , message : bytes ) -> bytearray :
413414 """
414415 Appends bytes to the message. Can be repeatedly called.
415416
@@ -535,11 +536,11 @@ def _write(self, zone: Any, address: int, buffer: bytearray):
535536 self ._get_response (status )
536537 self .idle ()
537538
538- def _read (self , zone : Any , address : int , buffer : bytearray ):
539+ def _read (self , zone : int , address : int , buffer : bytearray ):
539540 """
540541 Reads from the I2C
541542
542- :param Any zone: Zone to read from
543+ :param int zone: Zone to read from
543544 :param int address: The address to read from
544545 :param bytearray buffer: The buffer to read to
545546 """
0 commit comments