Skip to content

Commit ea30615

Browse files
committed
Fix three type hints
1 parent a5c31cd commit ea30615

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_ds18x20.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import time
2424
from micropython import const
25-
from adafruit_onewire.device import OneWireDevice
25+
from adafruit_onewire.device import OneWireAddress, OneWireDevice
2626

2727
try:
2828
import typing # pylint: disable=unused-import
@@ -36,7 +36,7 @@
3636
_RD_SCRATCH = b"\xBE"
3737
_WR_SCRATCH = b"\x4E"
3838
_CONVERSION_TIMEOUT = const(1)
39-
RESOLUTION = (9, 10, 11, 12)
39+
RESOLUTION: tuple[Literal[9, 10, 11, 12], ...] = (9, 10, 11, 12)
4040
# Maximum conversion delay in seconds, from DS18B20 datasheet.
4141
_CONVERSION_DELAY = {9: 0.09375, 10: 0.1875, 11: 0.375, 12: 0.750}
4242

@@ -74,7 +74,7 @@ class DS18X20:
7474
7575
"""
7676

77-
def __init__(self, bus: OneWireBus, address: int) -> None:
77+
def __init__(self, bus: OneWireBus, address: OneWireAddress) -> None:
7878
if address.family_code in (0x10, 0x28):
7979
self._address = address
8080
self._device = OneWireDevice(bus, address)
@@ -84,7 +84,7 @@ def __init__(self, bus: OneWireBus, address: int) -> None:
8484
raise ValueError("Incorrect family code in device address.")
8585

8686
@property
87-
def temperature(self):
87+
def temperature(self) -> float:
8888
"""The temperature in degrees Celsius."""
8989
self._convert_temp()
9090
return self._read_temp()

0 commit comments

Comments
 (0)