Skip to content

Commit ff65938

Browse files
authored
Merge pull request #556 from zxzxwu/default
Replace mutable default values
2 parents 737abdc + f06a357 commit ff65938

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bumble/avdtp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,10 @@ def __init__(
580580
self.service_category = service_category
581581
self.service_capabilities_bytes = service_capabilities_bytes
582582

583-
def to_string(self, details: List[str] = []) -> str:
583+
def to_string(self, details: Optional[List[str]] = None) -> str:
584584
attributes = ','.join(
585585
[name_or_number(AVDTP_SERVICE_CATEGORY_NAMES, self.service_category)]
586-
+ details
586+
+ (details or [])
587587
)
588588
return f'ServiceCapabilities({attributes})'
589589

bumble/gatt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def __init__(
345345
uuid: Union[str, UUID],
346346
characteristics: List[Characteristic],
347347
primary=True,
348-
included_services: List[Service] = [],
348+
included_services: Iterable[Service] = (),
349349
) -> None:
350350
# Convert the uuid to a UUID object if it isn't already
351351
if isinstance(uuid, str):
@@ -361,7 +361,7 @@ def __init__(
361361
uuid.to_pdu_bytes(),
362362
)
363363
self.uuid = uuid
364-
self.included_services = included_services[:]
364+
self.included_services = list(included_services)
365365
self.characteristics = characteristics[:]
366366
self.primary = primary
367367

@@ -395,7 +395,7 @@ def __init__(
395395
self,
396396
characteristics: List[Characteristic],
397397
primary: bool = True,
398-
included_services: List[Service] = [],
398+
included_services: Iterable[Service] = (),
399399
) -> None:
400400
super().__init__(self.UUID, characteristics, primary, included_services)
401401

0 commit comments

Comments
 (0)