8000 Typing improvements by jepler · Pull Request #104 · adafruit/Adafruit_CircuitPython_HID · GitHub
[go: up one dir, main page]

Skip to content

Typing improvements #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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