Skip to content

Commit c8921ac

Browse files
authored
Merge pull request #7 from tcfranks/main
Add Missing Type Annotations
2 parents b5acc39 + 5a84e9d commit c8921ac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

adafruit_tc74.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
from adafruit_register.i2c_bit import RWBit, ROBit
3030
import adafruit_bus_device.i2c_device as i2cdevice
3131

32+
try:
33+
import typing # pylint: disable=unused-import
34+
from busio import I2C
35+
except ImportError:
36+
pass
37+
3238
__version__ = "0.0.0+auto.0"
3339
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_TC74.git"
3440
# pylint: disable=too-few-public-methods
@@ -73,7 +79,7 @@ class TC74:
7379
7480
"""
7581

76-
def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
82+
def __init__(self, i2c_bus: I2C, address: int = TC74_DEFAULT_ADDRESS) -> None:
7783
self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address)
7884

7985
_temperature = ROUnaryStruct(TC74_REGISTER_TEMP, "b")
@@ -89,7 +95,7 @@ def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
8995
from the shutdown to the normal state."""
9096

9197
@property
92-
def temperature(self):
98+
def temperature(self) -> int:
9399
"""
94100
Returns the current temperature in degrees Celsius. Resolution
95101
is 1 degrees Celsius.

0 commit comments

Comments
 (0)