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