Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/StreamDeck/DeviceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .Transport.Dummy import Dummy
from .Transport.LibUSBHIDAPI import LibUSBHIDAPI
from .ProductIDs import USBVendorIDs, USBProductIDs
from typing import Union


class ProbeError(Exception):
Expand All @@ -36,7 +37,7 @@ class DeviceManager:
"""

@staticmethod
def _get_transport(transport: str | None):
def _get_transport(transport: Union[str, None]):
"""
Creates a new HID transport instance from the given transport back-end
name. If no specific transport is supplied, an attempt to find an
Expand Down Expand Up @@ -79,7 +80,7 @@ def _get_transport(transport: str | None):

raise ProbeError("Probe failed to find any functional HID backend.", probe_errors)

def __init__(self, transport: str | None = None):
def __init__(self, transport: Union[str, None] = None):
"""
Creates a new StreamDeck DeviceManager, used to detect attached StreamDeck devices.

Expand Down
10 changes: 5 additions & 5 deletions src/StreamDeck/Devices/StreamDeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from abc import ABC, abstractmethod
from collections.abc import Callable
from enum import Enum
from typing import Any, Iterable, TypeVar
from typing import Any, Iterable, TypeVar, Optional, Union

from ..Transport.Transport import Transport, TransportError

Expand Down Expand Up @@ -81,9 +81,9 @@ class StreamDeck(ABC):
DECK_TOUCH = False

_Self = TypeVar('_Self', bound='StreamDeck')
KeyCallback = Callable[[_Self, int, bool], None] | None
DialCallback = Callable[[_Self, int, DialEventType, bool], None] | None
TouchScreenCallback = Callable[[_Self, TouchscreenEventType, Any], None] | None
KeyCallback = Optional[Callable[[_Self, int, bool], None]]
DialCallback = Optional[Callable[[_Self, int, DialEventType, bool], None]]
TouchScreenCallback = Optional[Callable[[_Self, TouchscreenEventType, Any], None]]

def __init__(self, device: Transport.Device):
self.device: Transport.Device = device
Expand Down Expand Up @@ -598,7 +598,7 @@ def reset(self) -> None:
pass

@abstractmethod
def set_brightness(self, percent: int | float) -> None:
def set_brightness(self, percent: Union[int, float]) -> None:
"""
Sets the global screen brightness of the StreamDeck, across all the
physical buttons.
Expand Down