Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/net/ynl: Use consistent array index expression formatting

Use expression formatting that conforms to the python style guide.

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20231215093720.18774-2-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Donald Hunter and committed by
Jakub Kicinski
62691b80 610a689d

+5 -5
+5 -5
tools/net/ynl/lib/ynl.py
··· 98 98 } 99 99 100 100 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]) 102 102 self.type = self._type & ~Netlink.NLA_TYPE_MASK 103 103 self.is_nest = self._type & Netlink.NLA_F_NESTED 104 104 self.payload_len = self._len 105 105 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] 107 107 108 108 @classmethod 109 109 def get_format(cls, attr_type, byte_order=None): ··· 154 154 for m in members: 155 155 # TODO: handle non-scalar members 156 156 if m.type == 'binary': 157 - decoded = self.raw[offset:offset+m['len']] 157 + decoded = self.raw[offset : offset + m['len']] 158 158 offset += m['len'] 159 159 elif m.type in NlAttr.type_formats: 160 160 format = self.get_format(m.type, m.byte_order) ··· 193 193 194 194 class NlMsg: 195 195 def __init__(self, msg, offset, attr_space=None): 196 - self.hdr = msg[offset:offset + 16] 196 + self.hdr = msg[offset : offset + 16] 197 197 198 198 self.nl_len, self.nl_type, self.nl_flags, self.nl_seq, self.nl_portid = \ 199 199 struct.unpack("IHHII", self.hdr) 200 200 201 - self.raw = msg[offset + 16:offset + self.nl_len] 201 + self.raw = msg[offset + 16 : offset + self.nl_len] 202 202 203 203 self.error = 0 204 204 self.done = 0