Skip to content

Commit 2e61973

Browse files
authored
Merge pull request #974 from zyv/sdp-service-alias
Make sdp.Server.Service a type alias
2 parents 68f7c24 + 19b7859 commit 2e61973

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

bumble/device.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,11 +2644,13 @@ def host(self, host: Host) -> None:
26442644
host.link_key_provider = self.get_link_key
26452645

26462646
@property
2647-
def sdp_service_records(self):
2647+
def sdp_service_records(self) -> dict[int, sdp.Server.Service]:
26482648
return self.sdp_server.service_records
26492649

26502650
@sdp_service_records.setter
2651-
def sdp_service_records(self, service_records):
2651+
def sdp_service_records(
2652+
self, service_records: dict[int, sdp.Server.Service]
2653+
) -> None:
26522654
self.sdp_server.service_records = service_records
26532655

26542656
def lookup_connection(self, connection_handle: int) -> Connection | None:

bumble/sdp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import struct
2323
from collections.abc import Iterable, Sequence
2424
from dataclasses import dataclass, field
25-
from typing import TYPE_CHECKING, Any, ClassVar, NewType, TypeVar
25+
from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias, TypeVar
2626

2727
from typing_extensions import Self
2828

@@ -1076,7 +1076,7 @@ async def __aexit__(self, *args) -> None:
10761076
class Server:
10771077
CONTINUATION_STATE = bytes([0x01, 0x00])
10781078
channel: l2cap.ClassicChannel | None
1079-
Service = NewType('Service', list[ServiceAttribute])
1079+
Service: TypeAlias = list[ServiceAttribute]
10801080
service_records: dict[int, Service]
10811081
current_response: None | bytes | tuple[int, list[int]]
10821082

0 commit comments

Comments
 (0)