Skip to content

Commit 044e462

Browse files
committed
lint
1 parent 5901965 commit 044e462

6 files changed

Lines changed: 13 additions & 9 deletions

File tree

dbus_next/_private/unmarshaller.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ def read_string(self, _=None):
167167
str_start = self.offset
168168
# read terminating '\0' byte as well (str_length + 1)
169169
self.offset += str_length + 1
170-
return self.buf[str_start : str_start + str_length].decode()
170+
return self.buf[str_start:str_start + str_length].decode()
171171

172172
def read_signature(self, _=None):
173173
signature_len = self.view[self.offset] # byte
174174
o = self.offset + 1
175175
# read terminating '\0' byte as well (str_length + 1)
176176
self.offset = o + signature_len + 1
177-
return self.buf[o : o + signature_len].decode()
177+
return self.buf[o:o + signature_len].decode()
178178

179179
def read_variant(self, _=None):
180180
tree = SignatureTree._get(self.read_signature())
@@ -202,7 +202,7 @@ def read_array(self, type_: SignatureType):
202202

203203
if child_type.token == "y":
204204
self.offset += array_length
205-
return self.buf[self.offset - array_length : self.offset]
205+
return self.buf[self.offset - array_length:self.offset]
206206

207207
beginning_offset = self.offset
208208

@@ -226,7 +226,7 @@ def read_argument(self, type_: SignatureType) -> Any:
226226
return reader(self, type_)
227227
self.offset += size + (-self.offset & (size - 1)) # align
228228
if self.can_cast:
229-
return self.view[self.offset - size : self.offset].cast(ctype)[0]
229+
return self.view[self.offset - size:self.offset].cast(ctype)[0]
230230
return struct.unpack_from(self.view, self.offset - size)[0]
231231

232232
def header_fields(self, header_length):
@@ -242,7 +242,7 @@ def header_fields(self, header_length):
242242
signature_len = self.view[self.offset] # byte
243243
o = self.offset + 1
244244
self.offset += signature_len + 2 # one for the byte, one for the '\0'
245-
tree = SignatureTree._get(self.buf[o : o + signature_len].decode())
245+
tree = SignatureTree._get(self.buf[o:o + signature_len].decode())
246246
headers[HEADER_NAME_MAP[field_0]] = self.read_argument(tree.types[0])
247247
return headers
248248

dbus_next/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class MessageType(Enum):
1919

2020
MESSAGE_TYPE_MAP = {field.value: field for field in MessageType}
2121

22+
2223
class MessageFlag(IntFlag):
2324
"""Flags that affect the behavior of sent and received messages
2425
"""
@@ -30,6 +31,7 @@ class MessageFlag(IntFlag):
3031

3132
MESSAGE_FLAG_MAP = {field.value: field for field in MessageFlag}
3233

34+
3335
class NameFlag(IntFlag):
3436
"""A flag that affects the behavior of a name request.
3537
"""

dbus_next/message.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
MessageType.ERROR: ('error_name', 'reply_serial'),
1414
MessageType.METHOD_RETURN: ('reply_serial',),
1515
}
16+
17+
1618
class Message:
1719
"""A class for sending and receiving messages through the
1820
:class:`MessageBus <dbus_next.message_bus.BaseMessageBus>` with the

dbus_next/signature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from typing import Any, List, Union
66

77

8-
98
class SignatureType:
109
"""A class that represents a single complete type within a signature.
1110
@@ -286,6 +285,7 @@ def verify(self, body: Any) -> bool:
286285
"v": _verify_variant,
287286
}
288287

288+
289289
class SignatureTree:
290290
"""A class that represents a signature as a tree structure for conveniently
291291
working with DBus signatures.

dbus_next/validators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def is_interface_name_valid(name: str) -> bool:
104104

105105
return True
106106

107+
107108
@lru_cache(maxsize=512)
108109
def is_member_name_valid(member: str) -> bool:
109110
"""Whether this is a valid member name.

test/test_marshaller.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def print_buf(buf):
1313
i = 0
1414
while True:
15-
p = buf[i : i + 8]
15+
p = buf[i:i + 8]
1616
if not p:
1717
break
1818
print(p)
@@ -23,7 +23,6 @@ def print_buf(buf):
2323
table = json.load(open(os.path.dirname(__file__) + "/data/messages.json"))
2424

2525

26-
2726
def json_to_message(message: Dict[str, Any]) -> Message:
2827
copy = dict(message)
2928
if "message_type" in copy:
@@ -149,7 +148,7 @@ def __init__(self):
149148
self.pos = 0
150149

151150
def read(self, n) -> bytes:
152-
data = self.data[self.pos : self.pos + 1]
151+
data = self.data[self.pos:self.pos + 1]
153152
self.pos += 1
154153
return data
155154

0 commit comments

Comments
 (0)