From d1e34da41bce594ee29b2a0a7d5b041087f7887f Mon Sep 17 00:00:00 2001 From: Brent Yi Date: Sun, 12 Mar 2023 00:20:43 -0800 Subject: [PATCH] Function signature fixes --- adafruit_ble/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_ble/__init__.py b/adafruit_ble/__init__.py index 7b1ab1a..c1180fd 100755 --- a/adafruit_ble/__init__.py +++ b/adafruit_ble/__init__.py @@ -28,7 +28,7 @@ from .advertising import Advertisement try: - from typing import Optional, Iterator, Union, Tuple, NoReturn, TYPE_CHECKING + from typing import Iterator, NoReturn, Optional, Tuple, Type, TYPE_CHECKING, Union from typing_extensions import Literal if TYPE_CHECKING: @@ -72,7 +72,7 @@ def _discover_remote(self, uuid: UUID) -> Optional[_bleio.Service]: self._discovered_bleio_services[uuid] = remote_service return remote_service - def __contains__(self, key: Union[UUID, Service]) -> bool: + def __contains__(self, key: Union[UUID, Type[Service]]) -> bool: """ Allows easy testing for a particular Service class or a particular UUID associated with this connection. @@ -90,7 +90,7 @@ def __contains__(self, key: Union[UUID, Service]) -> bool: uuid = key.uuid return self._discover_remote(uuid) is not None - def __getitem__(self, key: Union[UUID, Service]) -> Optional[Service]: + def __getitem__(self, key: Union[UUID, Type[Service]]) -> Optional[Service]: """Return the Service for the given Service class or uuid, if any.""" uuid = key maybe_service = False @@ -221,7 +221,7 @@ def stop_advertising(self) -> None: def start_scan( self, - *advertisement_types: Advertisement, + *advertisement_types: Type[Advertisement], buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None,