From f06a35713f6db739e3c53738eda25598efcd47f4 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Wed, 18 Sep 2024 21:09:08 +0800 Subject: [PATCH] Replace unsafe default values --- bumble/avdtp.py | 4 ++-- bumble/gatt.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bumble/avdtp.py b/bumble/avdtp.py index 85f7ede3..fd79dc33 100644 --- a/bumble/avdtp.py +++ b/bumble/avdtp.py @@ -580,10 +580,10 @@ def __init__( self.service_category = service_category self.service_capabilities_bytes = service_capabilities_bytes - def to_string(self, details: List[str] = []) -> str: + def to_string(self, details: Optional[List[str]] = None) -> str: attributes = ','.join( [name_or_number(AVDTP_SERVICE_CATEGORY_NAMES, self.service_category)] - + details + + (details or []) ) return f'ServiceCapabilities({attributes})' diff --git a/bumble/gatt.py b/bumble/gatt.py index 3e679bbe..ea65116d 100644 --- a/bumble/gatt.py +++ b/bumble/gatt.py @@ -345,7 +345,7 @@ def __init__( uuid: Union[str, UUID], characteristics: List[Characteristic], primary=True, - included_services: List[Service] = [], + included_services: Iterable[Service] = (), ) -> None: # Convert the uuid to a UUID object if it isn't already if isinstance(uuid, str): @@ -361,7 +361,7 @@ def __init__( uuid.to_pdu_bytes(), ) self.uuid = uuid - self.included_services = included_services[:] + self.included_services = list(included_services) self.characteristics = characteristics[:] self.primary = primary @@ -395,7 +395,7 @@ def __init__( self, characteristics: List[Characteristic], primary: bool = True, - included_services: List[Service] = [], + included_services: Iterable[Service] = (), ) -> None: super().__init__(self.UUID, characteristics, primary, included_services)