[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260119205601.105821-8-wander@redhat.com>
Date: Mon, 19 Jan 2026 17:45:43 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Gabriele Monaco <gmonaco@...hat.com>,
Nam Cao <namcao@...utronix.de>,
Wander Lairson Costa <wander@...hat.com>,
linux-kernel@...r.kernel.org (open list),
linux-trace-kernel@...r.kernel.org (open list:RUNTIME VERIFICATION (RV))
Subject: [PATCH 07/26] rv/rvgen: replace __contains__() with in operator
Replace the direct call to the __contains__() dunder method with the
idiomatic in operator in the dot2c module. The previous implementation
explicitly called the __contains__() method to check for membership in
the final_states collection, which is not the recommended Python
style.
Python provides the in operator as the proper way to test membership,
which internally calls the __contains__() method. Directly calling
dunder methods bypasses Python's abstraction layer and reduces code
readability. Using the in operator makes the code more natural and
familiar to Python developers while maintaining identical functionality.
Signed-off-by: Wander Lairson Costa <wander@...hat.com>
---
tools/verification/rvgen/rvgen/dot2c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/verification/rvgen/rvgen/dot2c.py b/tools/verification/rvgen/rvgen/dot2c.py
index b9a2c009a9246..c97bb9466af6d 100644
--- a/tools/verification/rvgen/rvgen/dot2c.py
+++ b/tools/verification/rvgen/rvgen/dot2c.py
@@ -207,7 +207,7 @@ class Dot2c(Automata):
else:
first = False
- if self.final_states.__contains__(state):
+ if state in self.final_states:
line = line + '1'
else:
line = line + '0'
--
2.52.0
Powered by blists - more mailing lists