Skip to content

Commit 62691b8

Browse files
donaldhkuba-moo
authored andcommitted
tools/net/ynl: Use consistent array index expression formatting
Use expression formatting that conforms to the python style guide. Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: Donald Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 610a689 commit 62691b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/net/ynl/lib/ynl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ class NlAttr:
9898
}
9999

100100
def __init__(self, raw, offset):
101-
self._len, self._type = struct.unpack("HH", raw[offset:offset + 4])
101+
self._len, self._type = struct.unpack("HH", raw[offset : offset + 4])
102102
self.type = self._type & ~Netlink.NLA_TYPE_MASK
103103
self.is_nest = self._type & Netlink.NLA_F_NESTED
104104
self.payload_len = self._len
105105
self.full_len = (self.payload_len + 3) & ~3
106-
self.raw = raw[offset + 4:offset + self.payload_len]
106+
self.raw = raw[offset + 4 : offset + self.payload_len]
107107

108108
@classmethod
109109
def get_format(cls, attr_type, byte_order=None):
@@ -154,7 +154,7 @@ def as_struct(self, members):
154154
for m in members:
155155
# TODO: handle non-scalar members
156156
if m.type == 'binary':
157-
decoded = self.raw[offset:offset+m['len']]
157+
decoded = self.raw[offset : offset + m['len']]
158158
offset += m['len']
159159
elif m.type in NlAttr.type_formats:
160160
format = self.get_format(m.type, m.byte_order)
@@ -193,12 +193,12 @@ def __repr__(self):
193193

194194
class NlMsg:
195195
def __init__(self, msg, offset, attr_space=None):
196-
self.hdr = msg[offset:offset + 16]
196+
self.hdr = msg[offset : offset + 16]
197197

198198
self.nl_len, self.nl_type, self.nl_flags, self.nl_seq, self.nl_portid = \
199199
struct.unpack("IHHII", self.hdr)
200200

201-
self.raw = msg[offset + 16:offset + self.nl_len]
201+
self.raw = msg[offset + 16 : offset + self.nl_len]
202202

203203
self.error = 0
204204
self.done = 0

0 commit comments

Comments
 (0)