Remove unnecessary semicolons from Python code in the rvgen tool. Python does not require semicolons to terminate statements, and their presence goes against PEP 8 style guidelines. These semicolons were likely added out of habit from C-style languages.
The changes affect four instances across two files. In dot2c.py, one semicolon is removed from a boolean assignment. In dot2k.py, three semicolons are removed from string append operations that build generated C code. Note that the semicolons inside the string literals themselves are correctly preserved as they are part of the C code being generated, not Python syntax. This cleanup improves consistency with Python coding standards and aligns with the recent improvements to remove other Python anti-patterns from the codebase. Signed-off-by: Wander Lairson Costa <[email protected]> --- tools/verification/rvgen/rvgen/dot2c.py | 2 +- tools/verification/rvgen/rvgen/dot2k.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/verification/rvgen/rvgen/dot2c.py b/tools/verification/rvgen/rvgen/dot2c.py index 0fb3617ad8ce9..b9a2c009a9246 100644 --- a/tools/verification/rvgen/rvgen/dot2c.py +++ b/tools/verification/rvgen/rvgen/dot2c.py @@ -120,7 +120,7 @@ class Dot2c(Automata): for entry in buff: if first: string = string + "\t\t\"" + entry - first = False; + first = False else: string = string + "\",\n\t\t\"" + entry string = string + "\"" diff --git a/tools/verification/rvgen/rvgen/dot2k.py b/tools/verification/rvgen/rvgen/dot2k.py index 1c0d0235bdf62..291385adb2c20 100644 --- a/tools/verification/rvgen/rvgen/dot2k.py +++ b/tools/verification/rvgen/rvgen/dot2k.py @@ -37,10 +37,10 @@ class dot2k(Monitor, Dot2c): buff.append("\t/* XXX: validate that this event is only valid in the initial state */") handle = "handle_start_run_event" if self.monitor_type == "per_task": - buff.append("\tstruct task_struct *p = /* XXX: how do I get p? */;"); - buff.append(f"\tda_{handle}_{self.name}(p, {event}{self.enum_suffix});"); + buff.append("\tstruct task_struct *p = /* XXX: how do I get p? */;") + buff.append(f"\tda_{handle}_{self.name}(p, {event}{self.enum_suffix});") else: - buff.append(f"\tda_{handle}_{self.name}({event}{self.enum_suffix});"); + buff.append(f"\tda_{handle}_{self.name}({event}{self.enum_suffix});") buff.append("}") buff.append("") return '\n'.join(buff) -- 2.52.0
