Skip to content

Commit 1546631

Browse files
committed
Restore python pre-3.9 compatibility
.. and anyway the type is actually a Tuple when using usb_hid.devices in CircuitPython. This has a small cost in mpy file size but not as much as we earned back with earlier optimizations. The over-broad exception is used in order to reduce byte code growth
1 parent 311a02d commit 1546631

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_hid/keyboard.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
from . import find_device
1919

20+
try:
21+
from typing import Sequence
22+
except: # pylint: disable=bare-except
23+
pass
2024

2125
_MAX_KEYPRESSES = const(6)
2226

@@ -35,7 +39,7 @@ class Keyboard:
3539

3640
# No more than _MAX_KEYPRESSES regular keys may be pressed at once.
3741

38-
def __init__(self, devices: list[usb_hid.Device]) -> None:
42+
def __init__(self, devices: Sequence[usb_hid.Device]) -> None:
3943
"""Create a Keyboard object that will send keyboard HID reports.
4044
4145
Devices can be a sequence of devices that includes a keyboard device or a keyboard device

0 commit comments

Comments
 (0)