Skip to content

Commit f833e09

Browse files
committed
rewrite to make both yapf and flake8 happy since they do not agree on the formatting
1 parent c2d61e2 commit f833e09

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dbus_next/_private/unmarshaller.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
UNPACK_SYMBOL = {LITTLE_ENDIAN: "<", BIG_ENDIAN: ">"}
2323
UNPACK_LENGTHS = {BIG_ENDIAN: Struct(">III"), LITTLE_ENDIAN: Struct("<III")}
24+
IS_BIG_ENDIAN = sys.byteorder == "big"
25+
IS_LITTLE_ENDIAN = sys.byteorder == "little"
2426

2527
DBUS_TO_CTYPE = {
2628
"y": ("B", 1), # byte
@@ -253,8 +255,9 @@ def _read_header(self):
253255

254256
self.body_len, self.serial, self.header_len = UNPACK_LENGTHS[endian].unpack_from(buffer, 4)
255257
self.msg_len = (self.header_len + (-self.header_len & 7) + self.body_len) # align 8
256-
if (sys.byteorder == "little" and endian == LITTLE_ENDIAN) or (sys.byteorder == "big"
257-
and endian == BIG_ENDIAN):
258+
if endian == BIG_ENDIAN and IS_BIG_ENDIAN:
259+
self.can_cast = True
260+
elif endian == LITTLE_ENDIAN and IS_LITTLE_ENDIAN:
258261
self.can_cast = True
259262
self.readers = self._readers_by_type[endian]
260263

0 commit comments

Comments
 (0)