From 19e2ff80e061bbff974f1dff5bed7753dee847ec Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Thu, 19 Jan 2023 13:36:25 +0100 Subject: [PATCH] Black formatting... --- b_asic/GUI/drag_button.py | 4 +++- b_asic/core_operations.py | 6 ++++-- b_asic/scheduler_gui/graphics_graph_event.py | 2 ++ b_asic/scheduler_gui/main_window.py | 4 ++-- b_asic/signal.py | 3 ++- b_asic/signal_flow_graph.py | 11 +++++------ test/test_sfg.py | 4 +++- 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/b_asic/GUI/drag_button.py b/b_asic/GUI/drag_button.py index a6e36c9c..84433e9e 100644 --- a/b_asic/GUI/drag_button.py +++ b/b_asic/GUI/drag_button.py @@ -114,7 +114,9 @@ class DragButton(QPushButton): path_to_image = os.path.join( os.path.dirname(__file__), "operation_icons", - f"{self.operation_path_name}{'_grey.png' if self.pressed else '.png'}", + ( + f"{self.operation_path_name}{'_grey.png' if self.pressed else '.png'}" + ), ) self.setIcon(QIcon(path_to_image)) self.setIconSize(QSize(55, 55)) diff --git a/b_asic/core_operations.py b/b_asic/core_operations.py index 73941405..a6984423 100644 --- a/b_asic/core_operations.py +++ b/b_asic/core_operations.py @@ -277,7 +277,8 @@ class Min(AbstractOperation): def evaluate(self, a, b): if isinstance(a, complex) or isinstance(b, complex): raise ValueError( - "core_operations.Min does not support complex numbers.") + "core_operations.Min does not support complex numbers." + ) return a if a < b else b @@ -316,7 +317,8 @@ class Max(AbstractOperation): def evaluate(self, a, b): if isinstance(a, complex) or isinstance(b, complex): raise ValueError( - "core_operations.Max does not support complex numbers.") + "core_operations.Max does not support complex numbers." + ) return a if a > b else b diff --git a/b_asic/scheduler_gui/graphics_graph_event.py b/b_asic/scheduler_gui/graphics_graph_event.py index 346f6e88..dab4c1e9 100644 --- a/b_asic/scheduler_gui/graphics_graph_event.py +++ b/b_asic/scheduler_gui/graphics_graph_event.py @@ -193,6 +193,7 @@ class GraphicsGraphEvent: # PyQt5 translate coordinates of the cursor within the graphic element in the coordinate system of the parent object. The object can only move horizontally in x-axis scale steps.""" + # Qt.DragMoveCursor # button = event.button() def update_pos(item, delta_x): @@ -245,6 +246,7 @@ class GraphicsGraphEvent: # PyQt5 translate coordinates of the cursor within the graphic element in the coordinate system of the parent object. The object can only move horizontally in x-axis scale steps.""" + # Qt.DragMoveCursor # button = event.button() def update_pos(item, delta_x): diff --git a/b_asic/scheduler_gui/main_window.py b/b_asic/scheduler_gui/main_window.py index 7e3f1e2d..cb3e9a20 100644 --- a/b_asic/scheduler_gui/main_window.py +++ b/b_asic/scheduler_gui/main_window.py @@ -212,8 +212,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): ).load_module() except Exception as e: log.exception( - "Exception occurred. Could not load module from file '{}'.\n\n{}" - .format(abs_path_filename, e) + "Exception occurred. Could not load module from file" + " '{}'.\n\n{}".format(abs_path_filename, e) ) return diff --git a/b_asic/signal.py b/b_asic/signal.py index 63914c00..0ec3cfa6 100644 --- a/b_asic/signal.py +++ b/b_asic/signal.py @@ -141,7 +141,8 @@ class Signal(AbstractGraphComponent): if bits is not None: if not isinstance(bits, int): raise TypeError( - f"Bits must be an int, not {type(bits)}: {bits!r}") + f"Bits must be an int, not {type(bits)}: {bits!r}" + ) if bits < 0: raise ValueError("Bits cannot be negative") self.set_param("bits", bits) diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index 37baeca8..80c3db57 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -624,15 +624,14 @@ class SFG(AbstractOperation): if output_comp is None: return None - if isinstance( - output_comp, Output - ): + if isinstance(output_comp, Output): raise TypeError("Source operation cannot be an output operation.") if len(output_comp.output_signals) != component.input_count: raise TypeError( - f"Source operation output count ({len(output_comp.output_signals)})" - f" does not match input count for component ({component.input_count})." - ) + "Source operation output count" + f" ({len(output_comp.output_signals)}) does not match input" + f" count for component ({component.input_count})." + ) assert len(output_comp.output_signals) == component.output_count, ( "Destination operation input count does not match output for" " component." diff --git a/test/test_sfg.py b/test/test_sfg.py index 30040995..63287b1d 100644 --- a/test/test_sfg.py +++ b/test/test_sfg.py @@ -250,7 +250,9 @@ class TestEvaluateOutput: def test_evaluate_output_cycle(self, operation_graph_with_cycle): sfg = SFG(outputs=[Output(operation_graph_with_cycle)]) - with pytest.raises(RuntimeError, match="Direct feedback loop detected"): + with pytest.raises( + RuntimeError, match="Direct feedback loop detected" + ): sfg.evaluate_output(0, []) -- GitLab