mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
Fix GATT TemplateSerivce annotations
This commit is contained in:
@@ -1383,10 +1383,7 @@ class Peer:
|
||||
def create_service_proxy(
|
||||
self, proxy_class: type[_PROXY_CLASS]
|
||||
) -> _PROXY_CLASS | None:
|
||||
if proxy := proxy_class.from_client(self.gatt_client):
|
||||
return cast(_PROXY_CLASS, proxy)
|
||||
|
||||
return None
|
||||
return proxy_class.from_client(self.gatt_client)
|
||||
|
||||
async def discover_service_and_create_proxy(
|
||||
self, proxy_class: type[_PROXY_CLASS]
|
||||
|
||||
@@ -29,7 +29,7 @@ import functools
|
||||
import logging
|
||||
import struct
|
||||
from collections.abc import Iterable, Sequence
|
||||
from typing import TypeVar
|
||||
from typing import ClassVar, TypeVar
|
||||
|
||||
from bumble.att import Attribute, AttributeValue, AttributeValueV2
|
||||
from bumble.colors import color
|
||||
@@ -403,7 +403,7 @@ class TemplateService(Service):
|
||||
to expose their UUID as a class property
|
||||
'''
|
||||
|
||||
UUID: UUID
|
||||
UUID: ClassVar[UUID]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -34,11 +34,14 @@ from datetime import datetime
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
ClassVar,
|
||||
Generic,
|
||||
TypeVar,
|
||||
overload,
|
||||
)
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
from bumble import att, core, l2cap, utils
|
||||
from bumble.colors import color
|
||||
from bumble.core import UUID, InvalidStateError
|
||||
@@ -249,10 +252,10 @@ class ProfileServiceProxy:
|
||||
Base class for profile-specific service proxies
|
||||
'''
|
||||
|
||||
SERVICE_CLASS: type[TemplateService]
|
||||
SERVICE_CLASS: ClassVar[type[TemplateService]]
|
||||
|
||||
@classmethod
|
||||
def from_client(cls, client: Client) -> ProfileServiceProxy | None:
|
||||
def from_client(cls, client: Client) -> Self | None:
|
||||
return ServiceProxy.from_client(cls, client, cls.SERVICE_CLASS.UUID)
|
||||
|
||||
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
from collections.abc import Callable
|
||||
|
||||
from bumble import device
|
||||
from bumble import gatt
|
||||
from bumble import gatt_adapters
|
||||
from bumble import gatt_client
|
||||
from bumble import device, gatt, gatt_adapters, gatt_client
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -19,19 +19,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
from collections.abc import Sequence, Callable
|
||||
import struct
|
||||
import enum
|
||||
import struct
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import Any
|
||||
|
||||
from bumble import core
|
||||
from bumble import device
|
||||
from bumble import utils
|
||||
from bumble import att
|
||||
from bumble import gatt
|
||||
from bumble import gatt_adapters
|
||||
from bumble import gatt_client
|
||||
from typing_extensions import Self
|
||||
|
||||
from bumble import att, core, device, gatt, gatt_adapters, gatt_client, utils
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from collections.abc import Sequence
|
||||
import asyncio
|
||||
import itertools
|
||||
from collections.abc import Sequence
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user