Skip to content

Commit 6e56a6f

Browse files
committed
Add Missing Type Annotations
1 parent 77fc12e commit 6e56a6f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_us100.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import time
2727

2828
try:
29-
from typing import Union
29+
from typing import Optional
3030
from busio import UART
3131
except ImportError:
3232
pass
@@ -35,11 +35,11 @@
3535
class US100:
3636
"""Control a US-100 ultrasonic range sensor."""
3737

38-
def __init__(self, uart: UART):
38+
def __init__(self, uart: UART) -> None:
3939
self._uart = uart
4040

4141
@property
42-
def distance(self) -> float:
42+
def distance(self) -> Optional[float]:
4343
"""Return the distance measured by the sensor in cm.
4444
This is the function that will be called most often in user code.
4545
If no signal is received, return ``None``. This can happen when the
@@ -73,7 +73,7 @@ def distance(self) -> float:
7373
return dist
7474

7575
@property
76-
def temperature(self) -> Union[None, int]:
76+
def temperature(self) -> Optional[int]:
7777
"""Return the on-chip temperature, in Celsius"""
7878
for _ in range(2): # Attempt to read twice.
7979
self._uart.write(bytes([0x50]))

0 commit comments

Comments
 (0)