[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250909-net-next-ynl-ruff-v1-8-238c2bccdd99@kernel.org>
Date: Tue, 09 Sep 2025 23:07:54 +0200
From: "Matthieu Baerts (NGI0)" <matttbe@...nel.org>
To: Donald Hunter <donald.hunter@...il.com>,
Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
"Matthieu Baerts (NGI0)" <matttbe@...nel.org>
Subject: [PATCH net-next 8/8] tools: ynl: check for membership with 'not
in'
It is better to use 'not in' instead of 'not {element} in {collection}'
according to Ruff.
This is linked to Ruff error E713 [1]:
Testing membership with {element} not in {collection} is more readable.
Link: https://docs.astral.sh/ruff/rules/not-in-test/ [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
---
tools/net/ynl/pyynl/ynl_gen_c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index c7fb8abfd65e5d7bdd0ee705aed65f9262431880..101d8ba9626f238a82cddd0bbc10bb4399e2ab22 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -638,7 +638,7 @@ class TypeBitfield32(Type):
return '.type = YNL_PT_BITFIELD32, '
def _attr_policy(self, policy):
- if not 'enum' in self.attr:
+ if 'enum' not in self.attr:
raise Exception('Enum required for bitfield32 attr')
enum = self.family.consts[self.attr['enum']]
mask = enum.get_mask(as_flags=True)
--
2.51.0
Powered by blists - more mailing lists