Skip to content

Commit 0e2fbac

Browse files
committed
Made changes requested in review
1 parent ec1b921 commit 0e2fbac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

adafruit_74hc595.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
import digitalio
2929
import adafruit_bus_device.spi_device as spi_device
3030

31+
try:
32+
import typing
33+
from _typing import ReadableBuffer
34+
from microcontroller import Pin
35+
import busio
36+
except ImportError:
37+
pass
3138

3239
__version__ = "0.0.0-auto.0"
3340
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_74HC595.git"
@@ -42,7 +49,7 @@ class DigitalInOut:
4249

4350
def __init__(
4451
self,
45-
pin_number: "microcontroller.Pin",
52+
pin_number: Pin,
4653
shift_register_74hc595: "ShiftRegister74HC595",
4754
):
4855
"""Specify the pin number of the shift register (0...7) and
@@ -120,7 +127,7 @@ class ShiftRegister74HC595:
120127

121128
def __init__(
122129
self,
123-
spi: "busio.I2C",
130+
spi: busio.I2C,
124131
latch: digitalio.DigitalInOut,
125132
number_of_shift_registers: int = 1,
126133
):
@@ -141,14 +148,14 @@ def gpio(self):
141148
return self._gpio
142149

143150
@gpio.setter
144-
def gpio(self, val: "_typing.ReadableBuffer"):
151+
def gpio(self, val: ReadableBuffer):
145152
self._gpio = val
146153

147154
with self._device as spi:
148155
# pylint: disable=no-member
149156
spi.write(self._gpio)
150157

151-
def get_pin(self, pin: int) -> "microcontroller.Pin":
158+
def get_pin(self, pin: int) -> Pin:
152159
"""Convenience function to create an instance of the DigitalInOut class
153160
pointing at the specified pin of this 74HC595 device .
154161
"""

0 commit comments

Comments
 (0)