Skip to content

Commit efa3e6e

Browse files
Copilotpuddly
andcommitted
Fix mypy type errors properly for zigpy 0.91.2 compatibility
Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
1 parent a10e2bc commit efa3e6e

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

tests/tools/test_network_backup_restore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ async def test_network_backup_formed(device, make_znp_server, tmp_path):
182182
assert backup["nwk_update_id"] == 0
183183
assert backup["security_level"] == 5
184184
assert backup["channel"] == channel
185-
assert t.Channels.from_channel_list(backup["channel_mask"]) == channels # type: ignore[misc]
185+
# type: ignore[misc]
186+
assert t.Channels.from_channel_list(backup["channel_mask"]) == channels
186187

187188
assert t.KeyData(bytes.fromhex(backup["network_key"]["key"])) == network_key
188189
assert backup["network_key"]["sequence_number"] == 0

zigpy_znp/tools/network_restore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def json_backup_to_zigpy_state(
3636
network_info.nwk_update_id = backup["nwk_update_id"]
3737
network_info.nwk_manager_id = 0x0000
3838
network_info.channel = backup["channel"]
39-
network_info.channel_mask = t.Channels.from_channel_list(backup["channel_mask"]) # type: ignore[misc]
39+
# type: ignore[misc]
40+
network_info.channel_mask = t.Channels.from_channel_list(backup["channel_mask"])
4041
network_info.security_level = backup["security_level"]
4142
network_info.stack_specific = backup.get("stack_specific")
4243
network_info.tc_link_key = zigpy.state.Key()

zigpy_znp/tools/network_scan.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ async def main(argv):
106106
"-c",
107107
"--channels",
108108
dest="channels",
109-
type=lambda s: t.Channels.from_channel_list(map(int, s.split(","))), # type: ignore[misc]
109+
# type: ignore[misc]
110+
type=lambda s: t.Channels.from_channel_list(map(int, s.split(","))),
110111
default=t.Channels.ALL_CHANNELS,
111112
help="Channels on which to scan for networks",
112113
)

zigpy_znp/zigbee/application.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ async def _move_network_to_channel(
336336
request=c.ZDO.MgmtNWKUpdateReq.Req(
337337
Dst=0x0000,
338338
DstAddrMode=t.AddrMode.NWK,
339-
Channels=t.Channels.from_channel_list([new_channel]), # type: ignore[misc]
339+
# type: ignore[misc]
340+
Channels=t.Channels.from_channel_list([new_channel]),
340341
ScanDuration=zdo_t.NwkUpdate.CHANNEL_CHANGE_REQ,
341342
ScanCount=0,
342343
NwkManagerAddr=0x0000,

zigpy_znp/zigbee/device.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ def manufacturer(self) -> str:
2121

2222
@manufacturer.setter
2323
def manufacturer(self, value: str) -> None:
24-
# Setter required to match parent class interface (which has read-write properties)
25-
# but intentionally does nothing since coordinator manufacturer is hardware-determined
24+
# Setter for parent class interface; no-op (hardware-determined)
2625
pass
2726

2827
@property
@@ -31,8 +30,7 @@ def model(self) -> str:
3130

3231
@model.setter
3332
def model(self, value: str) -> None:
34-
# Setter required to match parent class interface (which has read-write properties)
35-
# but intentionally does nothing since coordinator model is hardware-determined
33+
# Setter for parent class interface; no-op (hardware-determined)
3634
pass
3735

3836
async def request(

zigpy_znp/znp/security.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ async def write_devices(
376376
devices: typing.Sequence[StoredDevice],
377377
counter_increment: t.uint32_t = 2500,
378378
tclk_seed: t.KeyData = None,
379-
) -> t.KeyData:
379+
) -> None:
380380
hashed_link_key_table = []
381381
aps_key_data_table = []
382382
link_key_table = t.APSLinkKeyTable()
@@ -446,7 +446,7 @@ async def write_devices(
446446

447447
# Z-Stack Home 1.2 does not store keys
448448
if znp.version < 3.0:
449-
return tclk_seed
449+
return
450450

451451
# Make sure the new table is the same size as the old table. Because this type is
452452
# prefixed by the number of entries, the trailing table bytes are not kept track of
@@ -506,5 +506,3 @@ async def write_devices(
506506
values=aps_key_data_table,
507507
fill_value=aps_key_data_fill_value,
508508
)
509-
510-
return tclk_seed

0 commit comments

Comments
 (0)