Skip to content

Function signature fixes #183

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 1 commit into from
Mar 13, 2023
Merged
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
8 changes: 4 additions & 4 deletions adafruit_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down