Skip to content

Commit 29e12f6

Browse files
committed
ruff ignores
1 parent a9ce58d commit 29e12f6

File tree

5 files changed

+125
-133
lines changed

5 files changed

+125
-133
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
3030
"""
3131

32+
# ruff: noqa: PLR6104,PLR6201,PLR6301 non-augmented-assignment,literal-membership,no-self-use
33+
3234
import errno
3335
import struct
3436
import time

tests/test_loop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5+
# ruff: noqa: PLR6301 no-self-use
6+
57
"""loop() tests"""
68

79
import errno

tests/test_port_ssl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5+
# ruff: noqa: PLR6301 no-self-use
6+
57
"""tests that verify the connect behavior w.r.t. port number and TLS"""
68

79
import socket

tests/test_subscribe.py

Lines changed: 69 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,43 @@ def handle_subscribe(client, user_data, topic, qos):
2929
(
3030
"foo/bar",
3131
bytearray([0x90, 0x03, 0x00, 0x01, 0x00]), # SUBACK
32-
bytearray(
33-
[
34-
0x82, # fixed header
35-
0x0C, # remaining length
36-
0x00,
37-
0x01, # message ID
38-
0x00,
39-
0x07, # topic length
40-
0x66, # topic
41-
0x6F,
42-
0x6F,
43-
0x2F,
44-
0x62,
45-
0x61,
46-
0x72,
47-
0x00, # QoS
48-
]
49-
),
32+
bytearray([
33+
0x82, # fixed header
34+
0x0C, # remaining length
35+
0x00,
36+
0x01, # message ID
37+
0x00,
38+
0x07, # topic length
39+
0x66, # topic
40+
0x6F,
41+
0x6F,
42+
0x2F,
43+
0x62,
44+
0x61,
45+
0x72,
46+
0x00, # QoS
47+
]),
5048
),
5149
# same as before but with tuple
5250
(
5351
("foo/bar", 0),
5452
bytearray([0x90, 0x03, 0x00, 0x01, 0x00]), # SUBACK
55-
bytearray(
56-
[
57-
0x82, # fixed header
58-
0x0C, # remaining length
59-
0x00,
60-
0x01, # message ID
61-
0x00,
62-
0x07, # topic length
63-
0x66, # topic
64-
0x6F,
65-
0x6F,
66-
0x2F,
67-
0x62,
68-
0x61,
69-
0x72,
70-
0x00, # QoS
71-
]
72-
),
53+
bytearray([
54+
0x82, # fixed header
55+
0x0C, # remaining length
56+
0x00,
57+
0x01, # message ID
58+
0x00,
59+
0x07, # topic length
60+
0x66, # topic
61+
0x6F,
62+
0x6F,
63+
0x2F,
64+
0x62,
65+
0x61,
66+
0x72,
67+
0x00, # QoS
68+
]),
7369
),
7470
# remaining length is encoded as 2 bytes due to long topic name.
7571
(
@@ -93,47 +89,43 @@ def handle_subscribe(client, user_data, topic, qos):
9389
# SUBSCRIBE responded to by PUBLISH followed by SUBACK
9490
(
9591
"foo/bar",
96-
bytearray(
97-
[
98-
0x30, # PUBLISH
99-
0x0C,
100-
0x00,
101-
0x07,
102-
0x66,
103-
0x6F,
104-
0x6F,
105-
0x2F,
106-
0x62,
107-
0x61,
108-
0x72,
109-
0x66,
110-
0x6F,
111-
0x6F,
112-
0x90, # SUBACK
113-
0x03,
114-
0x00,
115-
0x01,
116-
0x00,
117-
]
118-
),
119-
bytearray(
120-
[
121-
0x82, # fixed header
122-
0x0C, # remaining length
123-
0x00,
124-
0x01, # message ID
125-
0x00,
126-
0x07, # topic length
127-
0x66, # topic
128-
0x6F,
129-
0x6F,
130-
0x2F,
131-
0x62,
132-
0x61,
133-
0x72,
134-
0x00, # QoS
135-
]
136-
),
92+
bytearray([
93+
0x30, # PUBLISH
94+
0x0C,
95+
0x00,
96+
0x07,
97+
0x66,
98+
0x6F,
99+
0x6F,
100+
0x2F,
101+
0x62,
102+
0x61,
103+
0x72,
104+
0x66,
105+
0x6F,
106+
0x6F,
107+
0x90, # SUBACK
108+
0x03,
109+
0x00,
110+
0x01,
111+
0x00,
112+
]),
113+
bytearray([
114+
0x82, # fixed header
115+
0x0C, # remaining length
116+
0x00,
117+
0x01, # message ID
118+
0x00,
119+
0x07, # topic length
120+
0x66, # topic
121+
0x6F,
122+
0x6F,
123+
0x2F,
124+
0x62,
125+
0x61,
126+
0x72,
127+
0x00, # QoS
128+
]),
137129
),
138130
# use list of topics for more coverage. If the range was (1, 10000), that would be
139131
# long enough to use 3 bytes for remaining length, however that would make the test

tests/test_unsubscribe.py

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,21 @@ def handle_unsubscribe(client, user_data, topic, pid):
3232
(
3333
"foo/bar",
3434
bytearray([0xB0, 0x02, 0x00, 0x01]),
35-
bytearray(
36-
[
37-
0xA2, # fixed header
38-
0x0B, # remaining length
39-
0x00, # message ID
40-
0x01,
41-
0x00, # topic length
42-
0x07,
43-
0x66, # topic
44-
0x6F,
45-
0x6F,
46-
0x2F,
47-
0x62,
48-
0x61,
49-
0x72,
50-
]
51-
),
35+
bytearray([
36+
0xA2, # fixed header
37+
0x0B, # remaining length
38+
0x00, # message ID
39+
0x01,
40+
0x00, # topic length
41+
0x07,
42+
0x66, # topic
43+
0x6F,
44+
0x6F,
45+
0x2F,
46+
0x62,
47+
0x61,
48+
0x72,
49+
]),
5250
),
5351
# remaining length is encoded as 2 bytes due to long topic name.
5452
(
@@ -71,45 +69,41 @@ def handle_unsubscribe(client, user_data, topic, pid):
7169
# UNSUBSCRIBE responded to by PUBLISH followed by UNSUBACK
7270
(
7371
"foo/bar",
74-
bytearray(
75-
[
76-
0x30, # PUBLISH
77-
0x0C,
78-
0x00,
79-
0x07,
80-
0x66,
81-
0x6F,
82-
0x6F,
83-
0x2F,
84-
0x62,
85-
0x61,
86-
0x72,
87-
0x66,
88-
0x6F,
89-
0x6F,
90-
0xB0, # UNSUBACK
91-
0x02,
92-
0x00,
93-
0x01,
94-
]
95-
),
96-
bytearray(
97-
[
98-
0xA2, # fixed header
99-
0x0B, # remaining length
100-
0x00,
101-
0x01, # message ID
102-
0x00,
103-
0x07, # topic length
104-
0x66, # topic
105-
0x6F,
106-
0x6F,
107-
0x2F,
108-
0x62,
109-
0x61,
110-
0x72,
111-
]
112-
),
72+
bytearray([
73+
0x30, # PUBLISH
74+
0x0C,
75+
0x00,
76+
0x07,
77+
0x66,
78+
0x6F,
79+
0x6F,
80+
0x2F,
81+
0x62,
82+
0x61,
83+
0x72,
84+
0x66,
85+
0x6F,
86+
0x6F,
87+
0xB0, # UNSUBACK
88+
0x02,
89+
0x00,
90+
0x01,
91+
]),
92+
bytearray([
93+
0xA2, # fixed header
94+
0x0B, # remaining length
95+
0x00,
96+
0x01, # message ID
97+
0x00,
98+
0x07, # topic length
99+
0x66, # topic
100+
0x6F,
101+
0x6F,
102+
0x2F,
103+
0x62,
104+
0x61,
105+
0x72,
106+
]),
113107
),
114108
# use list of topics for more coverage. If the range was (1, 10000), that would be
115109
# long enough to use 3 bytes for remaining length, however that would make the test

0 commit comments

Comments
 (0)