Skip to content

Commit a511cec

Browse files
committed
Add Missing Type Annotations
1 parent 35a9e1b commit a511cec

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

adafruit_touchscreen.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
from analogio import AnalogIn
2929

3030
try:
31-
from typing import Optional, Tuple, Union
31+
from typing import Optional, Tuple
32+
from microcontroller import Pin
3233
except ImportError:
3334
pass
3435

3536

36-
def map_range(x, in_min, in_max, out_min, out_max) -> float:
37+
def map_range(x: float, in_min: int, in_max: int, out_min: int, out_max: int) -> float:
3738

3839
"""
3940
Maps a number from one range to another.
@@ -94,10 +95,10 @@ class Touchscreen:
9495

9596
def __init__(
9697
self,
97-
x1_pin: DigitalInOut,
98-
x2_pin: DigitalInOut,
99-
y1_pin: DigitalInOut,
100-
y2_pin: DigitalInOut,
98+
x1_pin: Pin,
99+
x2_pin: Pin,
100+
y1_pin: Pin,
101+
y2_pin: Pin,
101102
*,
102103
x_resistance: Optional[int] = None,
103104
samples: int = 4,
@@ -122,7 +123,7 @@ def __init__(
122123
@property
123124
def touch_point(
124125
self,
125-
) -> Union[None, Tuple[int, int, int]]: # pylint: disable=too-many-locals
126+
) -> Optional[Tuple[int, int, int]]: # pylint: disable=too-many-locals
126127
"""A tuple that represents the x, y and z (touch pressure) coordinates
127128
of a touch. Or, None if no touch is detected"""
128129
z_1 = z_2 = z = None

0 commit comments

Comments
 (0)