Skip to content

Commit 0d5c9f1

Browse files
walacglemco
authored andcommitted
rv/rvgen: fix PEP 8 whitespace violations
Fix whitespace violations throughout the rvgen codebase to comply with PEP 8 style guidelines. The changes address missing whitespace after commas, around operators, and in collection literals that were flagged by pycodestyle. The fixes include adding whitespace after commas in string replace chains and function arguments, adding whitespace around arithmetic operators, removing extra whitespace in list comprehensions, and fixing dictionary literal spacing. These changes improve code readability and consistency with Python coding standards. Signed-off-by: Wander Lairson Costa <wander@redhat.com> Reviewed-by: Gabriele Monaco <gmonaco@redhat.com> Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20260223162407.147003-9-wander@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
1 parent 76ad28a commit 0d5c9f1

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

tools/verification/rvgen/rvgen/automata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __get_state_variables(self) -> tuple[list[str], str, list[str]]:
135135
raw_state = line[-1]
136136

137137
# "enabled_fired"}; -> enabled_fired
138-
state = raw_state.replace('"', '').replace('};', '').replace(',','_')
138+
state = raw_state.replace('"', '').replace('};', '').replace(',', '_')
139139
if state[0:7] == "__init_":
140140
initial_state = state[7:]
141141
else:
@@ -264,7 +264,7 @@ def __create_matrix(self) -> tuple[list[list[str]], dict[_ConstraintKey, list[st
264264
nr_state += 1
265265

266266
# declare the matrix....
267-
matrix = [[ self.invalid_state_str for x in range(nr_event)] for y in range(nr_state)]
267+
matrix = [[self.invalid_state_str for x in range(nr_event)] for y in range(nr_state)]
268268
constraints: dict[_ConstraintKey, list[str]] = {}
269269

270270
# and we are back! Let's fill the matrix
@@ -273,8 +273,8 @@ def __create_matrix(self) -> tuple[list[list[str]], dict[_ConstraintKey, list[st
273273
while self.__dot_lines[cursor].lstrip()[0] == '"':
274274
if self.__dot_lines[cursor].split()[1] == "->":
275275
line = self.__dot_lines[cursor].split()
276-
origin_state = line[0].replace('"','').replace(',','_')
277-
dest_state = line[2].replace('"','').replace(',','_')
276+
origin_state = line[0].replace('"', '').replace(',', '_')
277+
dest_state = line[2].replace('"', '').replace(',', '_')
278278
possible_events = "".join(line[line.index("label") + 2:-1]).replace('"', '')
279279
for event in possible_events.split("\\n"):
280280
event, *constr = event.split(";")

tools/verification/rvgen/rvgen/dot2c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def get_aut_init_function(self) -> str:
182182
line += f"\t\t\t{next_state}"
183183
else:
184184
line += f"{next_state:>{maxlen}}"
185-
if y != nr_events-1:
185+
if y != nr_events - 1:
186186
line += ",\n" if linetoolong else ", "
187187
else:
188188
line += ",\n\t\t}," if linetoolong else " },"

tools/verification/rvgen/rvgen/dot2k.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def fill_tracepoint_args_skel(self, tp_type: str) -> str:
134134
tp_args = tp_args_dict[tp_type]
135135
if self._is_id_monitor():
136136
tp_args.insert(0, tp_args_id)
137-
tp_proto_c = ", ".join([a+b for a,b in tp_args])
138-
tp_args_c = ", ".join([b for a,b in tp_args])
137+
tp_proto_c = ", ".join([a + b for a, b in tp_args])
138+
tp_args_c = ", ".join([b for a, b in tp_args])
139139
buff.append(f" TP_PROTO({tp_proto_c}),")
140140
buff.append(f" TP_ARGS({tp_args_c})")
141141
return '\n'.join(buff)

tools/verification/rvgen/rvgen/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def print_files(self):
228228

229229

230230
class Monitor(RVGenerator):
231-
monitor_types = { "global" : 1, "per_cpu" : 2, "per_task" : 3, "per_obj" : 4 }
231+
monitor_types = {"global": 1, "per_cpu": 2, "per_task": 3, "per_obj": 4}
232232

233233
def __init__(self, extra_params={}):
234234
super().__init__(extra_params)

0 commit comments

Comments
 (0)