Skip to content

Commit 0164e28

Browse files
committed
Styling fixes.
1 parent 1a5bd8e commit 0164e28

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

canopen/objectdictionary/datatypes.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,26 @@
3030
SDO_PARAMETER = 0x22
3131
IDENTITY = 0x23
3232

33-
SIGNED_TYPES = (INTEGER8, INTEGER16, INTEGER24, INTEGER32, INTEGER40, INTEGER48, INTEGER56, INTEGER64)
34-
UNSIGNED_TYPES = (UNSIGNED8, UNSIGNED16, UNSIGNED24, UNSIGNED32, UNSIGNED40, UNSIGNED48, UNSIGNED56, UNSIGNED64)
33+
SIGNED_TYPES = (
34+
INTEGER8,
35+
INTEGER16,
36+
INTEGER24,
37+
INTEGER32,
38+
INTEGER40,
39+
INTEGER48,
40+
INTEGER56,
41+
INTEGER64,
42+
)
43+
UNSIGNED_TYPES = (
44+
UNSIGNED8,
45+
UNSIGNED16,
46+
UNSIGNED24,
47+
UNSIGNED32,
48+
UNSIGNED40,
49+
UNSIGNED48,
50+
UNSIGNED56,
51+
UNSIGNED64,
52+
)
3553
INTEGER_TYPES = SIGNED_TYPES + UNSIGNED_TYPES
3654
FLOAT_TYPES = (REAL32, REAL64)
3755
NUMBER_TYPES = INTEGER_TYPES + FLOAT_TYPES
@@ -43,6 +61,7 @@ class UnsignedN(struct.Struct):
4361
4462
The width must be a multiple of 8 and must be between 8 and 64.
4563
"""
64+
4665
def __init__(self, width: int):
4766
self.width = width
4867
if width % 8 != 0:
@@ -75,6 +94,7 @@ class IntegerN(struct.Struct):
7594
7695
The width must be a multiple of 8 and must be between 8 and 64.
7796
"""
97+
7898
def __init__(self, width: int):
7999
self.width = width
80100
if width % 8 != 0:
@@ -94,7 +114,9 @@ def __init__(self, width: int):
94114
def unpack(self, buffer):
95115
mask = 0x80
96116
neg = (buffer[self.size - 1] & mask) > 0
97-
return super().unpack(buffer + (b'\xff' if neg else b'\x00') * (super().size - self.size))
117+
return super().unpack(
118+
buffer + (b'\xff' if neg else b'\x00') * (super().size - self.size)
119+
)
98120

99121
def pack(self, *v):
100122
return super().pack(*v)[:self.size]

0 commit comments

Comments
 (0)