From 5a84e9dd5c716795f637e55d27f611d90104a2cb Mon Sep 17 00:00:00 2001 From: Thomas Franks Date: Mon, 5 Sep 2022 17:49:33 -0400 Subject: [PATCH] Add Missing Type Annotations --- adafruit_tc74.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/adafruit_tc74.py b/adafruit_tc74.py index 7bd0ceb..f710dca 100644 --- a/adafruit_tc74.py +++ b/adafruit_tc74.py @@ -29,6 +29,12 @@ from adafruit_register.i2c_bit import RWBit, ROBit import adafruit_bus_device.i2c_device as i2cdevice +try: + import typing # pylint: disable=unused-import + from busio import I2C +except ImportError: + pass + __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_TC74.git" # pylint: disable=too-few-public-methods @@ -73,7 +79,7 @@ class TC74: """ - def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS): + def __init__(self, i2c_bus: I2C, address: int = TC74_DEFAULT_ADDRESS) -> None: self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address) _temperature = ROUnaryStruct(TC74_REGISTER_TEMP, "b") @@ -89,7 +95,7 @@ def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS): from the shutdown to the normal state.""" @property - def temperature(self): + def temperature(self) -> int: """ Returns the current temperature in degrees Celsius. Resolution is 1 degrees Celsius.