Skip to content

Commit 8362a5b

Browse files
committed
connections.pybricks: don't shadow builtin len()
Rename a variable named len to avoid shadowing the built-in len() function.
1 parent e0c8dad commit 8362a5b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pybricksdev/connections/pybricks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ async def _client_connect(self) -> bool:
784784
bos_descriptor = get_descriptor(self._device, bos_len, 0x0F, 0)
785785

786786
while ofst < bos_len:
787-
(len, desc_type, cap_type) = struct.unpack_from(
787+
(size, desc_type, cap_type) = struct.unpack_from(
788788
"<BBB", bos_descriptor, offset=ofst
789789
)
790790

@@ -798,23 +798,23 @@ async def _client_connect(self) -> bool:
798798
uuid_str = str(UUID(bytes_le=bytes(uuid_bytes)))
799799

800800
if uuid_str == FW_REV_UUID:
801-
fw_version = bytearray(bos_descriptor[ofst + 20 : ofst + len])
801+
fw_version = bytearray(bos_descriptor[ofst + 20 : ofst + size])
802802
self.fw_version = Version(fw_version.decode())
803803

804804
elif uuid_str == SW_REV_UUID:
805805
self._protocol_version = bytearray(
806-
bos_descriptor[ofst + 20 : ofst + len]
806+
bos_descriptor[ofst + 20 : ofst + size]
807807
)
808808

809809
elif uuid_str == PYBRICKS_HUB_CAPABILITIES_UUID:
810-
caps = bytearray(bos_descriptor[ofst + 20 : ofst + len])
810+
caps = bytearray(bos_descriptor[ofst + 20 : ofst + size])
811811
(
812812
_,
813813
self._capability_flags,
814814
self._max_user_program_size,
815815
) = unpack_hub_capabilities(caps)
816816

817-
ofst += len
817+
ofst += size
818818

819819
self._monitor_task = asyncio.create_task(self._monitor_usb())
820820

0 commit comments

Comments
 (0)