Skip to content

Commit ed9a268

Browse files
Copilotpuddly
andauthored
Bump zigpy to 0.91.2 and migrate from enum_factory to native enum types (#268)
Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
1 parent 012067a commit ed9a268

17 files changed

+56
-40
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ repos:
1010
- id: black
1111

1212
- repo: https://github.com/PyCQA/flake8
13-
rev: 6.1.0
13+
rev: 7.0.0
1414
hooks:
1515
- id: flake8
1616
entry: pflake8
1717
additional_dependencies:
18-
- pyproject-flake8==6.1.0
19-
- flake8-bugbear==23.1.20
20-
- flake8-comprehensions==3.10.1
21-
- flake8_2020==1.7.0
18+
- pyproject-flake8==7.0.0
19+
- flake8-bugbear==24.2.6
20+
- flake8-comprehensions==3.14.0
21+
- flake8_2020==1.8.1
2222
- mccabe==0.7.0
2323
- pycodestyle==2.11.1
24-
- pyflakes==3.1.0
24+
- pyflakes==3.2.0
2525

2626
- repo: https://github.com/PyCQA/isort
2727
rev: 5.12.0
2828
hooks:
2929
- id: isort
3030

3131
- repo: https://github.com/pre-commit/mirrors-mypy
32-
rev: v1.6.1
32+
rev: v1.19.1
3333
hooks:
3434
- id: mypy
3535
additional_dependencies:
36-
- zigpy
36+
- zigpy>=0.91.2
3737
- types-setuptools
3838

3939
- repo: https://github.com/asottile/pyupgrade

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "README.md"
1414
license = {text = "GPL-3.0"}
1515
requires-python = ">=3.8"
1616
dependencies = [
17-
"zigpy>=0.78.0",
17+
"zigpy>=0.91.2",
1818
'async-timeout; python_version<"3.11"',
1919
"voluptuous",
2020
"coloredlogs",
@@ -85,6 +85,12 @@ disable_error_code = [
8585
"union-attr",
8686
"var-annotated",
8787
"name-defined",
88+
"misc",
89+
"override",
90+
"return-value",
91+
"return",
92+
"type-arg",
93+
"list-item",
8894
]
8995

9096
[tool.coverage.run]

tests/application/test_connect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async def test_probe_unsuccessful_slow1(device, make_znp_server, mocker):
7272
)
7373
)
7474

75-
assert not any([t._is_connected for t in znp_server._transports])
75+
assert not any(t._is_connected for t in znp_server._transports)
7676

7777

7878
@pytest.mark.parametrize("device", FORMED_DEVICES)
@@ -82,7 +82,7 @@ async def test_probe_successful(device, make_znp_server):
8282
assert await ControllerApplication.probe(
8383
conf.SCHEMA_DEVICE({conf.CONF_DEVICE_PATH: znp_server.serial_port})
8484
)
85-
assert not any([t._is_connected for t in znp_server._transports])
85+
assert not any(t._is_connected for t in znp_server._transports)
8686

8787

8888
@pytest.mark.parametrize("device", FORMED_DEVICES)
@@ -97,7 +97,7 @@ async def test_probe_multiple(device, make_znp_server):
9797
assert await ControllerApplication.probe(config)
9898
assert await ControllerApplication.probe(config)
9999
assert await ControllerApplication.probe(config)
100-
assert not any([t._is_connected for t in znp_server._transports])
100+
assert not any(t._is_connected for t in znp_server._transports)
101101

102102

103103
@pytest.mark.parametrize("device", FORMED_DEVICES)

tests/application/test_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ async def test_send_security_and_packet_source_route(device, make_application, m
773773
tx_options=(
774774
zigpy_t.TransmitOptions.ACK | zigpy_t.TransmitOptions.APS_Encryption
775775
),
776-
source_route=[0xAABB, 0xCCDD],
776+
source_route=[zigpy_t.NWK(0xAABB), zigpy_t.NWK(0xCCDD)],
777777
)
778778

779779
data_req = znp_server.reply_once_to(

tests/application/test_startup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"CC2652",
2626
f"Z-Stack {FormedLaunchpadCC26X2R1.code_revision}",
2727
15,
28-
t.Channels.from_channel_list([15]),
28+
t.Channels.from_channel_list([15]), # type: ignore[misc]
2929
0x4402,
3030
t.EUI64.convert("A2:BA:38:A8:B5:E6:83:A0"),
3131
t.KeyData.convert("4C:4E:72:B8:41:22:51:79:9A:BF:35:25:12:88:CA:83"),
@@ -34,7 +34,7 @@
3434
"CC2531",
3535
f"Z-Stack 3.0.x {FormedZStack3CC2531.code_revision}",
3636
15,
37-
t.Channels.from_channel_list([15]),
37+
t.Channels.from_channel_list([15]), # type: ignore[misc]
3838
0xB6AB,
3939
t.EUI64.convert("62:92:32:46:3C:77:2D:B2"),
4040
t.KeyData.convert("6D:DE:24:EA:E2:85:52:B6:DE:29:56:EB:05:85:1A:FA"),
@@ -43,7 +43,7 @@
4343
"CC2531",
4444
f"Z-Stack Home 1.2 {FormedZStack1CC2531.code_revision}",
4545
11,
46-
t.Channels.from_channel_list([11]),
46+
t.Channels.from_channel_list([11]), # type: ignore[misc]
4747
0x1A62,
4848
t.EUI64.convert("DD:DD:DD:DD:DD:DD:DD:DD"),
4949
t.KeyData([1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13]),

tests/application/test_zdo_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def update_channel(req):
5656
request=c.ZDO.MgmtNWKUpdateReq.Req(
5757
Dst=0x0000,
5858
DstAddrMode=t.AddrMode.NWK,
59-
Channels=t.Channels.from_channel_list([new_channel]),
59+
Channels=t.Channels.from_channel_list([new_channel]), # type: ignore[misc]
6060
ScanDuration=254,
6161
# Missing fields in the request cannot be `None` in the Z-Stack command
6262
ScanCount=0,

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def passthrough_serial_conn(loop, protocol_factory, url, *args, **kwargs):
122122
assert url == FAKE_SERIAL_PORT
123123

124124
# No double connections!
125-
if any([t._is_connected for t in transports]):
125+
if any(t._is_connected for t in transports):
126126
raise RuntimeError(
127127
"Cannot open two connections to the same serial port"
128128
)

tests/test_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def test_command_optional_params_failures():
335335

336336

337337
def test_simple_descriptor():
338-
lvlist16_type = zigpy_t.LVList[t.uint16_t]
338+
lvlist16_type = zigpy_t.LVList[t.uint16_t, zigpy_t.uint8_t]
339339

340340
simple_descriptor = zigpy.zdo.types.SimpleDescriptor()
341341
simple_descriptor.endpoint = zigpy_t.uint8_t(1)

tests/tools/test_network_backup_restore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ 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+
# type: ignore[misc]
185186
assert t.Channels.from_channel_list(backup["channel_mask"]) == channels
186187

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

zigpy_znp/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
)
2626

2727
# Used only when creating a temporary network during formation
28-
STARTUP_CHANNELS = t.Channels.from_channel_list([15, 20, 25])
28+
STARTUP_CHANNELS = t.Channels.from_channel_list([15, 20, 25]) # type: ignore[misc]

0 commit comments

Comments
 (0)