Skip to content

Commit 93c7e0e

Browse files
authored
Merge pull request #104 from adafruit/typing-improvements
Typing improvements
2 parents 9661aa8 + 1546631 commit 93c7e0e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

adafruit_hid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def find_device(
3636
"""Search through the provided sequence of devices to find the one with the matching
3737
usage_page and usage."""
3838
if hasattr(devices, "send_report"):
39-
devices = [devices]
39+
devices = [devices] # type: ignore
4040
for device in devices:
4141
if (
4242
device.usage_page == usage_page

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)