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 <[email protected]> Reviewed-by: Gabriele Monaco <[email protected]> Reviewed-by: Nam Cao <[email protected]> --- tools/verification/rvgen/rvgen/automata.py | 12 ++++++------ tools/verification/rvgen/rvgen/dot2c.py | 2 +- tools/verification/rvgen/rvgen/dot2k.py | 4 ++-- tools/verification/rvgen/rvgen/generator.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/verification/rvgen/rvgen/automata.py b/tools/verification/rvgen/rvgen/automata.py index 0d7cbd0c634a9..deb1f09556c3c 100644 --- a/tools/verification/rvgen/rvgen/automata.py +++ b/tools/verification/rvgen/rvgen/automata.py @@ -95,7 +95,7 @@ class Automata: raw_state = line[-1] # "enabled_fired"}; -> enabled_fired - state = raw_state.replace('"', '').replace('};', '').replace(',','_') + state = raw_state.replace('"', '').replace('};', '').replace(',', '_') if state[0:7] == "__init_": initial_state = state[7:] else: @@ -132,7 +132,7 @@ class Automata: # ------------ event is here ------------^^^^^ if self.__dot_lines[cursor].split()[1] == "->": line = self.__dot_lines[cursor].split() - event = line[-2].replace('"','') + event = line[-2].replace('"', '') # when a transition has more than one labels, they are like this # "local_irq_enable\nhw_local_irq_enable_n" @@ -162,7 +162,7 @@ class Automata: nr_state += 1 # declare the matrix.... - matrix = [[ self.invalid_state_str for x in range(nr_event)] for y in range(nr_state)] + matrix = [[self.invalid_state_str for x in range(nr_event)] for y in range(nr_state)] # and we are back! Let's fill the matrix cursor = self.__get_cursor_begin_events() @@ -170,9 +170,9 @@ class Automata: while self.__dot_lines[cursor].lstrip()[0] == '"': if self.__dot_lines[cursor].split()[1] == "->": line = self.__dot_lines[cursor].split() - origin_state = line[0].replace('"','').replace(',','_') - dest_state = line[2].replace('"','').replace(',','_') - possible_events = line[-2].replace('"','').replace("\\n", " ") + origin_state = line[0].replace('"', '').replace(',', '_') + dest_state = line[2].replace('"', '').replace(',', '_') + possible_events = line[-2].replace('"', '').replace("\\n", " ") for event in possible_events.split(): matrix[states_dict[origin_state]][events_dict[event]] = dest_state cursor += 1 diff --git a/tools/verification/rvgen/rvgen/dot2c.py b/tools/verification/rvgen/rvgen/dot2c.py index b3a49779d4cc5..6ab519b03789c 100644 --- a/tools/verification/rvgen/rvgen/dot2c.py +++ b/tools/verification/rvgen/rvgen/dot2c.py @@ -137,7 +137,7 @@ class Dot2c(Automata): line += f"\t\t\t{next_state}" else: line += f"{next_state:>{maxlen}}" - if y != nr_events-1: + if y != nr_events - 1: line += ",\n" if linetoolong else ", " else: line += ",\n\t\t}," if linetoolong else " }," diff --git a/tools/verification/rvgen/rvgen/dot2k.py b/tools/verification/rvgen/rvgen/dot2k.py index c70a9812abbf6..4bf0db52e6264 100644 --- a/tools/verification/rvgen/rvgen/dot2k.py +++ b/tools/verification/rvgen/rvgen/dot2k.py @@ -111,8 +111,8 @@ class dot2k(Monitor, Dot2c): tp_args = tp_args_event if tp_type == "event" else tp_args_error if self.monitor_type == "per_task": tp_args.insert(0, tp_args_id) - tp_proto_c = ", ".join([a+b for a,b in tp_args]) - tp_args_c = ", ".join([b for a,b in tp_args]) + tp_proto_c = ", ".join([a + b for a, b in tp_args]) + tp_args_c = ", ".join([b for a, b in tp_args]) buff.append(f" TP_PROTO({tp_proto_c}),") buff.append(f" TP_ARGS({tp_args_c})") return '\n'.join(buff) diff --git a/tools/verification/rvgen/rvgen/generator.py b/tools/verification/rvgen/rvgen/generator.py index a3fbb1ac74916..31c454329e8e1 100644 --- a/tools/verification/rvgen/rvgen/generator.py +++ b/tools/verification/rvgen/rvgen/generator.py @@ -228,7 +228,7 @@ obj-$(CONFIG_RV_MON_{name_up}) += monitors/{name}/{name}.o class Monitor(RVGenerator): - monitor_types = { "global" : 1, "per_cpu" : 2, "per_task" : 3 } + monitor_types = {"global": 1, "per_cpu": 2, "per_task": 3} def __init__(self, extra_params={}): super().__init__(extra_params) -- 2.52.0
