Skip to content

Commit c9d46b1

Browse files
authored
Merge pull request #38 from zha-ng/ac/black-20
Migrate to black 20.8b1
2 parents 901f3fc + 806744b commit c9d46b1

20 files changed

+166
-57
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 19.10b0
3+
rev: 20.8b1
44
hooks:
55
- id: black
66
args:

tests/application/test_requests.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ async def test_zigpy_request(device, make_application):
9292
),
9393
responses=[
9494
c.AF.DataRequestExt.Rsp(Status=t.Status.SUCCESS),
95-
c.AF.DataConfirm.Callback(Status=t.Status.SUCCESS, Endpoint=1, TSN=TSN,),
95+
c.AF.DataConfirm.Callback(
96+
Status=t.Status.SUCCESS,
97+
Endpoint=1,
98+
TSN=TSN,
99+
),
96100
c.ZDO.SrcRtgInd.Callback(DstAddr=device.nwk, Relays=[]),
97101
c.AF.IncomingMsg.Callback(
98102
GroupId=0x0000,
@@ -149,7 +153,11 @@ async def test_zigpy_request_failure(device, make_application, mocker):
149153
),
150154
responses=[
151155
c.AF.DataRequestExt.Rsp(Status=t.Status.SUCCESS),
152-
c.AF.DataConfirm.Callback(Status=t.Status.FAILURE, Endpoint=1, TSN=TSN,),
156+
c.AF.DataConfirm.Callback(
157+
Status=t.Status.FAILURE,
158+
Endpoint=1,
159+
TSN=TSN,
160+
),
153161
],
154162
)
155163

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ def __init__(self, *args, **kwargs):
289289

290290
for req in getattr(func, "_reply_to", []):
291291
self.reply_to(
292-
request=req, responses=[func],
292+
request=req,
293+
responses=[func],
293294
)
294295

295296
def _unhandled_command(self, command):

tests/test_commands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ def test_command_param_binding():
242242
def test_command_optional_params():
243243
# Optional params values don't need a value
244244
short_version_rsp = c.SYS.Version.Rsp(
245-
TransportRev=0, ProductId=1, MajorRel=2, MinorRel=3, MaintRel=4,
245+
TransportRev=0,
246+
ProductId=1,
247+
MajorRel=2,
248+
MinorRel=3,
249+
MaintRel=4,
246250
)
247251

248252
# Some can still be passed

tests/tools/test_energy_scan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ async def response(request):
5050

5151
znp_server.callback_for_response(
5252
c.ZDO.MgmtNWKUpdateReq.Req(
53-
Dst=0x0000, DstAddrMode=t.AddrMode.NWK, NwkManagerAddr=0x0000, partial=True,
53+
Dst=0x0000,
54+
DstAddrMode=t.AddrMode.NWK,
55+
NwkManagerAddr=0x0000,
56+
partial=True,
5457
),
5558
fake_scanner,
5659
)

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ deps = flake8
1818
commands = flake8
1919

2020
[testenv:black]
21-
deps=black
21+
deps =
22+
black==20.8.b1
2223
setenv =
2324
LC_ALL=C.UTF-8
2425
LANG=C.UTF-8

zigpy_znp/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ async def nvram_write(self, nv_id: nvids.BaseNvIds, value, *, create: bool = Fal
615615

616616
await self.request(
617617
c.SYS.OSALNVItemInit.Req(
618-
Id=nv_id, ItemLen=len(value), Value=t.ShortBytes(value[:244]),
618+
Id=nv_id,
619+
ItemLen=len(value),
620+
Value=t.ShortBytes(value[:244]),
619621
),
620622
RspStatus=t.Status.NV_ITEM_UNINIT,
621623
)
@@ -641,7 +643,8 @@ async def nvram_read(self, nv_id: nvids.BaseNvIds) -> bytes:
641643
# XXX: Some NVIDs don't really exist and Z-Stack behaves strangely with them
642644
if nv_id == t.nvids.NwkNvIds.POLL_RATE_OLD16:
643645
read_rsp = await self.request(
644-
c.SYS.OSALNVRead.Req(Id=nv_id, Offset=0), RspStatus=t.Status.SUCCESS,
646+
c.SYS.OSALNVRead.Req(Id=nv_id, Offset=0),
647+
RspStatus=t.Status.SUCCESS,
645648
)
646649

647650
return read_rsp.Value

zigpy_znp/commands/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ class App(t.CommandsBase, subsystem=t.Subsystem.APP):
1010
0x00,
1111
req_schema=(
1212
t.Param(
13-
"Endpoint", t.uint8_t, "Application endpoint of the outgoing message",
13+
"Endpoint",
14+
t.uint8_t,
15+
"Application endpoint of the outgoing message",
1416
),
1517
t.Param("DstAddr", t.NWK, "Destination address of the outgoing message"),
1618
t.Param(
@@ -31,7 +33,9 @@ class App(t.CommandsBase, subsystem=t.Subsystem.APP):
3133
0x01,
3234
req_schema=(
3335
t.Param(
34-
"SrcEndpoint", t.uint8_t, "Source Endpoint of the user-defined command",
36+
"SrcEndpoint",
37+
t.uint8_t,
38+
"Source Endpoint of the user-defined command",
3539
),
3640
t.Param("CommandId", t.uint16_t, "Command Id of the user-defined command"),
3741
t.Param("Parameter1", t.uint16_t, "Parameter #1 of the command"),

zigpy_znp/commands/app_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ class AppConfig(t.CommandsBase, subsystem=t.Subsystem.APPConfig):
104104
0x03,
105105
req_schema=(
106106
t.Param(
107-
"AllowRejoin", t.Bool, "whether or not the Trust center allows rejoins",
107+
"AllowRejoin",
108+
t.Bool,
109+
"whether or not the Trust center allows rejoins",
108110
),
109111
),
110112
rsp_schema=t.STATUS_SCHEMA,

zigpy_znp/commands/mac.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
1212
0x01,
1313
req_schema=(
1414
t.Param(
15-
"SetDefault", t.Bool, "TRUE - Set the MAC pib values to default values",
15+
"SetDefault",
16+
t.Bool,
17+
"TRUE - Set the MAC pib values to default values",
1618
),
1719
),
1820
rsp_schema=t.STATUS_SCHEMA,
@@ -70,15 +72,19 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
7072
t.Param("RealignKeySource", t.KeySource, "Key Source of this data frame"),
7173
# ToDo: Enum for for RealignSecurityLevel
7274
t.Param(
73-
"RealignSecurityLevel", t.uint8_t, "Security level of this data frame",
75+
"RealignSecurityLevel",
76+
t.uint8_t,
77+
"Security level of this data frame",
7478
),
7579
# ToDo: Make this an enum
7680
t.Param("RealignKeyIdMode", t.uint8_t, "Key Id Mode of this frame"),
7781
t.Param("RealignKeyIndex", t.uint8_t, "Key index of this frame"),
7882
t.Param("BeaconKeySource", t.KeySource, "Key source of this data frame"),
7983
# ToDo: Make this an enum
8084
t.Param(
81-
"BeaconSecurityLevel", t.uint8_t, "Security Level of this data frame",
85+
"BeaconSecurityLevel",
86+
t.uint8_t,
87+
"Security Level of this data frame",
8288
),
8389
t.Param("BeaconKeyIdMode", t.uint8_t, "Key Id Mode of this data frame"),
8490
t.Param("BeaconKeyIndex", t.uint8_t, "Key index of this data frame"),
@@ -270,7 +276,9 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
270276
),
271277
t.Param("NWK", t.NWK, "Short address of the associated device"),
272278
t.Param(
273-
"AssociatedMember", t.Bool, "True is the orphan is a associated member",
279+
"AssociatedMember",
280+
t.Bool,
281+
"True is the orphan is a associated member",
274282
),
275283
),
276284
rsp_schema=t.STATUS_SCHEMA,
@@ -323,7 +331,9 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
323331
rsp_schema=(
324332
t.Param("Status", t.Status, "Status is either Success (0) or Failure (1)"),
325333
t.Param(
326-
"PanId", t.PanId, "The PAN Id to use. This parameter is ignored if Pan",
334+
"PanId",
335+
t.PanId,
336+
"The PAN Id to use. This parameter is ignored if Pan",
327337
),
328338
t.Param("LogicalChannel", t.uint8_t, "The logical channel to use"),
329339
t.Param("ChannelPage", t.uint8_t, "The channel page to use"),
@@ -381,7 +391,9 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
381391
"Extended address of coordinator",
382392
),
383393
t.Param(
384-
"PanId", t.PanId, "The PAN Id to use. This parameter is ignored if Pan",
394+
"PanId",
395+
t.PanId,
396+
"The PAN Id to use. This parameter is ignored if Pan",
385397
),
386398
t.Param("Superframe", t.uint16_t, "Superframe specification"),
387399
t.Param("LogicalChannel", t.uint8_t, "The logical channel to use"),
@@ -396,7 +408,9 @@ class MAC(t.CommandsBase, subsystem=t.Subsystem.MAC):
396408
t.Param("KeyIndex", t.uint8_t, "Key index of this frame"),
397409
t.Param("PendingAddrSpec", t.uint8_t, "Pending address spec"),
398410
t.Param(
399-
"AddressList", t.uint8_t, "List of address associate with the device",
411+
"AddressList",
412+
t.uint8_t,
413+
"List of address associate with the device",
400414
),
401415
t.Param("NSDU", t.ShortBytes, "Beacon payload"),
402416
),

zigpy_znp/commands/sapi.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ class SAPI(t.CommandsBase, subsystem=t.Subsystem.SAPI):
7272
t.Param("Destination", t.NWK, "Short address of the destination"),
7373
t.Param("CommandId", t.uint16_t, "The command id to send with the message"),
7474
t.Param(
75-
"Handle", t.uint8_t, "A handle used to Identify the send data request",
75+
"Handle",
76+
t.uint8_t,
77+
"A handle used to Identify the send data request",
7678
),
7779
t.Param("Ack", t.Bool, "True if requesting ACK from the destination"),
7880
t.Param(
@@ -163,7 +165,9 @@ class SAPI(t.CommandsBase, subsystem=t.Subsystem.SAPI):
163165
0x83,
164166
rsp_schema=(
165167
t.Param(
166-
"Handle", t.uint8_t, "A handle used to Identify the send data request",
168+
"Handle",
169+
t.uint8_t,
170+
"A handle used to Identify the send data request",
167171
),
168172
t.Param("Status", t.Status, "Status is either Success (0) or Failure (1)"),
169173
),

zigpy_znp/commands/sys.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ class SYS(t.CommandsBase, subsystem=t.Subsystem.SYS):
306306
0x10,
307307
req_schema=(
308308
t.Param(
309-
"UTCTime", t.uint32_t, "Number of seconds since 00:00:00 on Jan 2000",
309+
"UTCTime",
310+
t.uint32_t,
311+
"Number of seconds since 00:00:00 on Jan 2000",
310312
),
311313
t.Param("Hour", t.uint8_t, "Hour of the day (0 -- 23)"),
312314
t.Param("Minute", t.uint8_t, "Minute of the hour (0 -- 59)"),
@@ -326,7 +328,9 @@ class SYS(t.CommandsBase, subsystem=t.Subsystem.SYS):
326328
req_schema=(),
327329
rsp_schema=(
328330
t.Param(
329-
"UTCTime", t.uint32_t, "Number of seconds since 00:00:00 on Jan 2000",
331+
"UTCTime",
332+
t.uint32_t,
333+
"Number of seconds since 00:00:00 on Jan 2000",
330334
),
331335
t.Param("Hour", t.uint8_t, "Hour of the day (0 -- 23)"),
332336
t.Param("Minute", t.uint8_t, "Minute of the hour (0 -- 59)"),

zigpy_znp/commands/util.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ class Util(t.CommandsBase, subsystem=t.Subsystem.UTIL):
9595
"Channels to be scanned when starting the device. Big endian!",
9696
),
9797
t.Param(
98-
"PanId", t.PanId, "The PAN Id to use. This parameter is ignored if Pan",
98+
"PanId",
99+
t.PanId,
100+
"The PAN Id to use. This parameter is ignored if Pan",
99101
),
100102
# ToDo: Make this an enum
101103
t.Param("SecurityLevel", t.uint8_t, "Security level of this data frame"),
@@ -233,7 +235,9 @@ class Util(t.CommandsBase, subsystem=t.Subsystem.UTIL):
233235
req_schema=(
234236
t.Param("AddrModeAddress", t.AddrModeAddress, "Address mode and address"),
235237
t.Param(
236-
"PanId", t.PanId, "PAN Id of the device. Only use with a short address",
238+
"PanId",
239+
t.PanId,
240+
"PAN Id of the device. Only use with a short address",
237241
),
238242
),
239243
rsp_schema=t.STATUS_SCHEMA,
@@ -246,7 +250,9 @@ class Util(t.CommandsBase, subsystem=t.Subsystem.UTIL):
246250
req_schema=(
247251
t.Param("AddrModeAddress", t.AddrModeAddress, "Address mode and address"),
248252
t.Param(
249-
"PanId", t.PanId, "PAN Id of the device. Only use with a short address",
253+
"PanId",
254+
t.PanId,
255+
"PAN Id of the device. Only use with a short address",
250256
),
251257
),
252258
rsp_schema=t.STATUS_SCHEMA,
@@ -259,7 +265,9 @@ class Util(t.CommandsBase, subsystem=t.Subsystem.UTIL):
259265
req_schema=(
260266
t.Param("AddrModeAddress", t.AddrModeAddress, "Address mode and address"),
261267
t.Param(
262-
"PanId", t.PanId, "PAN Id of the device. Only use with a short address",
268+
"PanId",
269+
t.PanId,
270+
"PAN Id of the device. Only use with a short address",
263271
),
264272
),
265273
rsp_schema=t.STATUS_SCHEMA,

0 commit comments

Comments
 (0)