Skip to content

Commit

Permalink
Merge pull request #104 from adafruit/typing-improvements
Browse files Browse the repository at this point in the history
Typing improvements
  • Loading branch information
dhalbert authored Sep 9, 2022
2 parents 9661aa8 + 1546631 commit 93c7e0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adafruit_hid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def find_device(
"""Search through the provided sequence of devices to find the one with the matching
usage_page and usage."""
if hasattr(devices, "send_report"):
devices = [devices]
devices = [devices] # type: ignore
for device in devices:
if (
device.usage_page == usage_page
Expand Down
6 changes: 5 additions & 1 deletion adafruit_hid/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

from . import find_device

try:
from typing import Sequence
except: # pylint: disable=bare-except
pass

_MAX_KEYPRESSES = const(6)

Expand All @@ -35,7 +39,7 @@ class Keyboard:

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

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

0 comments on commit 93c7e0e

Please sign in to comment.