Skip to content

Commit 10d32b0

Browse files
matttbekuba-moo
authored andcommitted
tools: ynl: use 'cond is None'
It is better to use the 'is' keyword instead of comparing to None according to Ruff. This is linked to Ruff error E711 [1]: According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators." Link: https://docs.astral.sh/ruff/rules/none-comparison/ [1] Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Asbjørn Sloth Tønnesen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 616129d commit 10d32b0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/net/ynl/pyynl/lib/ynl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def _decode_unknown(self, attr):
705705
return attr.as_bin()
706706

707707
def _rsp_add(self, rsp, name, is_multi, decoded):
708-
if is_multi == None:
708+
if is_multi is None:
709709
if name in rsp and type(rsp[name]) is not list:
710710
rsp[name] = [rsp[name]]
711711
is_multi = True

tools/net/ynl/pyynl/ynl_gen_c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def _init_checks(self):
397397
if 'enum' in self.attr:
398398
enum = self.family.consts[self.attr['enum']]
399399
low, high = enum.value_range()
400-
if low == None and high == None:
400+
if low is None and high is None:
401401
self.checks['sparse'] = True
402402
else:
403403
if 'min' not in self.checks:

0 commit comments

Comments
 (0)