From c6ec6b6bbf4bf93f54e89b7a90ed9a09b93126cc Mon Sep 17 00:00:00 2001
From: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Date: Wed, 29 Mar 2023 09:41:37 +0200
Subject: [PATCH] Fix linting issues

---
 b_asic/codegen/vhdl/__init__.py     |   3 -
 b_asic/codegen/vhdl/architecture.py | 131 ++++++++++++++--------------
 b_asic/codegen/vhdl/common.py       |  26 +++---
 b_asic/codegen/vhdl/entity.py       |  18 ++--
 b_asic/gui_utils/about_window.py    |  15 ++--
 b_asic/gui_utils/plot_window.py     |   2 +-
 b_asic/operation.py                 |  21 ++---
 b_asic/research/__init__.py         |   3 +-
 b_asic/resources.py                 |  25 ++++--
 b_asic/simulation.py                |   3 +-
 10 files changed, 129 insertions(+), 118 deletions(-)

diff --git a/b_asic/codegen/vhdl/__init__.py b/b_asic/codegen/vhdl/__init__.py
index 168593c1..8ffcf487 100644
--- a/b_asic/codegen/vhdl/__init__.py
+++ b/b_asic/codegen/vhdl/__init__.py
@@ -63,6 +63,3 @@ def write_lines(
             write(f, indent_level=tpl[0], text=tpl[1], end=tpl[2])
         else:
             raise ValueError('All tuples in list `lines` must have length 2 or 3')
-
-
-from b_asic.codegen.vhdl import architecture, common, entity
diff --git a/b_asic/codegen/vhdl/architecture.py b/b_asic/codegen/vhdl/architecture.py
index 94948285..5eed5a26 100644
--- a/b_asic/codegen/vhdl/architecture.py
+++ b/b_asic/codegen/vhdl/architecture.py
@@ -2,10 +2,9 @@
 Module for code generation of VHDL architectures.
 """
 from io import TextIOWrapper
-from typing import Dict, List, Set, Tuple, cast
+from typing import Dict, Set, Tuple, cast
 
 from b_asic.codegen import vhdl
-from b_asic.codegen.vhdl import VHDL_TAB
 from b_asic.process import MemoryVariable, PlainMemoryVariable
 from b_asic.resources import ProcessCollection, _ForwardBackwardTable
 
@@ -91,7 +90,7 @@ def write_memory_based_storage(
         vhdl.common.write_signal_decl(f, f'write_en_{i}', 'std_logic', name_pad=14)
 
     # Schedule time counter
-    vhdl.write(f, 1, f'-- Schedule counter', start='\n')
+    vhdl.write(f, 1, '-- Schedule counter', start='\n')
     vhdl.common.write_signal_decl(
         f,
         name='schedule_cnt',
@@ -101,7 +100,7 @@ def write_memory_based_storage(
 
     # Input sync signals
     if input_sync:
-        vhdl.write(f, 1, f'-- Input synchronization', start='\n')
+        vhdl.write(f, 1, '-- Input synchronization', start='\n')
         for i in range(read_ports):
             vhdl.common.write_signal_decl(
                 f, f'p_{i}_in_sync', 'std_logic_vector(WL-1 downto 0)', name_pad=14
@@ -110,8 +109,8 @@ def write_memory_based_storage(
     #
     # Architecture body begin
     #
-    vhdl.write(f, 0, f'begin', start='\n', end='\n\n')
-    vhdl.write(f, 1, f'-- Schedule counter')
+    vhdl.write(f, 0, 'begin', start='\n', end='\n\n')
+    vhdl.write(f, 1, '-- Schedule counter')
     vhdl.common.write_synchronous_process_prologue(
         f=f,
         name='schedule_cnt_proc',
@@ -120,17 +119,17 @@ def write_memory_based_storage(
     vhdl.write_lines(
         f,
         [
-            (3, f'if rst = \'1\' then'),
-            (4, f'schedule_cnt <= 0;'),
-            (3, f'else'),
-            (4, f'if en = \'1\' then'),
+            (3, 'if rst = \'1\' then'),
+            (4, 'schedule_cnt <= 0;'),
+            (3, 'else'),
+            (4, 'if en = \'1\' then'),
             (5, f'if schedule_cnt = {schedule_time-1} then'),
-            (6, f'schedule_cnt <= 0;'),
-            (5, f'else'),
-            (6, f'schedule_cnt <= schedule_cnt + 1;'),
-            (5, f'end if;'),
-            (4, f'end if;'),
-            (3, f'end if;'),
+            (6, 'schedule_cnt <= 0;'),
+            (5, 'else'),
+            (6, 'schedule_cnt <= schedule_cnt + 1;'),
+            (5, 'end if;'),
+            (4, 'end if;'),
+            (3, 'end if;'),
         ],
     )
     vhdl.common.write_synchronous_process_epilogue(
@@ -140,7 +139,7 @@ def write_memory_based_storage(
     )
 
     if input_sync:
-        vhdl.write(f, 1, f'-- Input synchronization', start='\n')
+        vhdl.write(f, 1, '-- Input synchronization', start='\n')
         vhdl.common.write_synchronous_process_prologue(
             f=f,
             name='input_sync_proc',
@@ -155,7 +154,7 @@ def write_memory_based_storage(
         )
 
     # Infer memory
-    vhdl.write(f, 1, f'-- Memory', start='\n')
+    vhdl.write(f, 1, '-- Memory', start='\n')
     vhdl.common.write_asynchronous_read_memory(
         f=f,
         clk='clk',
@@ -171,7 +170,7 @@ def write_memory_based_storage(
     )
 
     # Write address generation
-    vhdl.write(f, 1, f'-- Memory write address generation', start='\n')
+    vhdl.write(f, 1, '-- Memory write address generation', start='\n')
     if input_sync:
         vhdl.common.write_synchronous_process_prologue(
             f, clk="clk", name="mem_write_address_proc"
@@ -180,7 +179,7 @@ def write_memory_based_storage(
         vhdl.common.write_process_prologue(
             f, sensitivity_list="schedule_cnt", name="mem_write_address_proc"
         )
-    vhdl.write(f, 3, f'case schedule_cnt is')
+    vhdl.write(f, 3, 'case schedule_cnt is')
     for i, collection in enumerate(assignment):
         for mv in collection:
             mv = cast(MemoryVariable, mv)
@@ -191,7 +190,7 @@ def write_memory_based_storage(
                         (4, f'-- {mv!r}'),
                         (4, f'when {(mv.start_time) % schedule_time} =>'),
                         (5, f'write_adr_0 <= {i};'),
-                        (5, f'write_en_0 <= \'1\';'),
+                        (5, 'write_en_0 <= \'1\';'),
                     ],
                 )
     vhdl.write_lines(
@@ -213,11 +212,11 @@ def write_memory_based_storage(
         )
 
     # Read address generation
-    vhdl.write(f, 1, f'-- Memory read address generation', start='\n')
+    vhdl.write(f, 1, '-- Memory read address generation', start='\n')
     vhdl.common.write_synchronous_process_prologue(
         f, clk="clk", name="mem_read_address_proc"
     )
-    vhdl.write(f, 3, f'case schedule_cnt is')
+    vhdl.write(f, 3, 'case schedule_cnt is')
     for i, collection in enumerate(assignment):
         for mv in collection:
             mv = cast(PlainMemoryVariable, mv)
@@ -233,27 +232,27 @@ def write_memory_based_storage(
                     f,
                     [
                         (5, f'read_adr_0 <= {i};'),
-                        (5, f'read_en_0 <= \'1\';'),
+                        (5, 'read_en_0 <= \'1\';'),
                     ],
                 )
     vhdl.write_lines(
         f,
         [
-            (4, f'when others =>'),
-            (5, f'read_adr_0 <= 0;'),
-            (5, f'read_en_0 <= \'0\';'),
-            (3, f'end case;'),
+            (4, 'when others =>'),
+            (5, 'read_adr_0 <= 0;'),
+            (5, 'read_en_0 <= \'0\';'),
+            (3, 'end case;'),
         ],
     )
     vhdl.common.write_synchronous_process_epilogue(
         f, clk="clk", name="mem_read_address_proc"
     )
 
-    vhdl.write(f, 1, f'-- Input and output assignmentn', start='\n')
+    vhdl.write(f, 1, '-- Input and output assignmentn', start='\n')
     if input_sync:
-        vhdl.write(f, 1, f'write_port_0 <= p_0_in_sync;')
+        vhdl.write(f, 1, 'write_port_0 <= p_0_in_sync;')
     else:
-        vhdl.write(f, 1, f'write_port_0 <= p_0_in;')
+        vhdl.write(f, 1, 'write_port_0 <= p_0_in;')
     p_zero_exec = filter(
         lambda p: p.execution_time == 0, (p for pc in assignment for p in pc)
     )
@@ -262,7 +261,7 @@ def write_memory_based_storage(
         clk='clk',
         name='output_reg_proc',
     )
-    vhdl.write(f, 3, f'case schedule_cnt is')
+    vhdl.write(f, 3, 'case schedule_cnt is')
     for p in p_zero_exec:
         if input_sync:
             write_time = (p.start_time + 1) % schedule_time
@@ -273,8 +272,8 @@ def write_memory_based_storage(
     vhdl.write_lines(
         f,
         [
-            (4, f'when others => p_0_out <= read_port_0;'),
-            (3, f'end case;'),
+            (4, 'when others => p_0_out <= read_port_0;'),
+            (3, 'end case;'),
         ],
     )
     vhdl.common.write_synchronous_process_epilogue(
@@ -330,7 +329,7 @@ def write_register_based_storage(
     )
 
     # Schedule time counter
-    vhdl.write(f, 1, f'-- Schedule counter')
+    vhdl.write(f, 1, '-- Schedule counter')
     vhdl.common.write_signal_decl(
         f,
         name='schedule_cnt',
@@ -340,7 +339,7 @@ def write_register_based_storage(
     )
 
     # Shift register
-    vhdl.write(f, 1, f'-- Shift register', start='\n')
+    vhdl.write(f, 1, '-- Shift register', start='\n')
     vhdl.common.write_type_decl(
         f,
         name='shift_reg_type',
@@ -354,7 +353,7 @@ def write_register_based_storage(
     )
 
     # Back edge mux decoder
-    vhdl.write(f, 1, f'-- Back-edge mux select signal', start='\n')
+    vhdl.write(f, 1, '-- Back-edge mux select signal', start='\n')
     vhdl.common.write_signal_decl(
         f,
         name='back_edge_mux_sel',
@@ -363,7 +362,7 @@ def write_register_based_storage(
     )
 
     # Output mux selector
-    vhdl.write(f, 1, f'-- Output mux select signal', start='\n')
+    vhdl.write(f, 1, '-- Output mux select signal', start='\n')
     vhdl.common.write_signal_decl(
         f,
         name='out_mux_sel',
@@ -374,8 +373,8 @@ def write_register_based_storage(
     #
     # Architecture body begin
     #
-    vhdl.write(f, 0, f'begin', start='\n', end='\n\n')
-    vhdl.write(f, 1, f'-- Schedule counter')
+    vhdl.write(f, 0, 'begin', start='\n', end='\n\n')
+    vhdl.write(f, 1, '-- Schedule counter')
     vhdl.common.write_synchronous_process_prologue(
         f=f,
         name='schedule_cnt_proc',
@@ -384,13 +383,13 @@ def write_register_based_storage(
     vhdl.write_lines(
         f,
         [
-            (4, f'if en = \'1\' then'),
+            (4, 'if en = \'1\' then'),
             (5, f'if schedule_cnt = {schedule_time}-1 then'),
-            (6, f'schedule_cnt <= 0;'),
-            (5, f'else'),
-            (6, f'schedule_cnt <= schedule_cnt + 1;'),
-            (5, f'end if;'),
-            (4, f'end if;'),
+            (6, 'schedule_cnt <= 0;'),
+            (5, 'else'),
+            (6, 'schedule_cnt <= schedule_cnt + 1;'),
+            (5, 'end if;'),
+            (4, 'end if;'),
         ],
     )
     vhdl.common.write_synchronous_process_epilogue(
@@ -400,13 +399,13 @@ def write_register_based_storage(
     )
 
     # Shift register back-edge decoding
-    vhdl.write(f, 1, f'-- Shift register back-edge decoding', start='\n')
+    vhdl.write(f, 1, '-- Shift register back-edge decoding', start='\n')
     vhdl.common.write_synchronous_process_prologue(
         f,
         clk='clk',
         name='shift_reg_back_edge_decode_proc',
     )
-    vhdl.write(f, 3, f'case schedule_cnt is')
+    vhdl.write(f, 3, 'case schedule_cnt is')
     for time, entry in enumerate(forward_backward_table):
         if entry.back_edge_to:
             assert len(entry.back_edge_to) == 1
@@ -423,9 +422,9 @@ def write_register_based_storage(
     vhdl.write_lines(
         f,
         [
-            (4, f'when others =>'),
-            (5, f'back_edge_mux_sel <= 0;'),
-            (3, f'end case;'),
+            (4, 'when others =>'),
+            (5, 'back_edge_mux_sel <= 0;'),
+            (3, 'end case;'),
         ],
     )
     vhdl.common.write_synchronous_process_epilogue(
@@ -435,28 +434,28 @@ def write_register_based_storage(
     )
 
     # Shift register multiplexer logic
-    vhdl.write(f, 1, f'-- Multiplexers for shift register', start='\n')
+    vhdl.write(f, 1, '-- Multiplexers for shift register', start='\n')
     vhdl.common.write_synchronous_process_prologue(
         f,
         clk='clk',
         name='shift_reg_proc',
     )
     if sync_rst:
-        vhdl.write(f, 3, f'if rst = \'1\' then')
+        vhdl.write(f, 3, 'if rst = \'1\' then')
         for reg_idx in range(reg_cnt):
             vhdl.write(f, 4, f'shift_reg({reg_idx}) <= (others => \'0\');')
-        vhdl.write(f, 3, f'else')
+        vhdl.write(f, 3, 'else')
 
     vhdl.write_lines(
         f,
         [
-            (3, f'-- Default case'),
-            (3, f'shift_reg(0) <= p_0_in;'),
+            (3, '-- Default case'),
+            (3, 'shift_reg(0) <= p_0_in;'),
         ],
     )
     for reg_idx in range(1, reg_cnt):
         vhdl.write(f, 3, f'shift_reg({reg_idx}) <= shift_reg({reg_idx-1});')
-    vhdl.write(f, 3, f'case back_edge_mux_sel is')
+    vhdl.write(f, 3, 'case back_edge_mux_sel is')
     for edge, mux_sel in back_edge_table.items():
         vhdl.write_lines(
             f,
@@ -468,13 +467,13 @@ def write_register_based_storage(
     vhdl.write_lines(
         f,
         [
-            (4, f'when others => null;'),
-            (3, f'end case;'),
+            (4, 'when others => null;'),
+            (3, 'end case;'),
         ],
     )
 
     if sync_rst:
-        vhdl.write(f, 3, f'end if;')
+        vhdl.write(f, 3, 'end if;')
 
     vhdl.common.write_synchronous_process_epilogue(
         f,
@@ -483,36 +482,36 @@ def write_register_based_storage(
     )
 
     # Output multiplexer decoding logic
-    vhdl.write(f, 1, f'-- Output muliplexer decoding logic', start='\n')
+    vhdl.write(f, 1, '-- Output muliplexer decoding logic', start='\n')
     vhdl.common.write_synchronous_process_prologue(
         f, clk='clk', name='out_mux_decode_proc'
     )
-    vhdl.write(f, 3, f'case schedule_cnt is')
+    vhdl.write(f, 3, 'case schedule_cnt is')
     for i, entry in enumerate(forward_backward_table):
         if entry.outputs_from is not None:
             sel = output_mux_table[entry.outputs_from]
             vhdl.write(f, 4, f'when {(i-1)%schedule_time} =>')
             vhdl.write(f, 5, f'out_mux_sel <= {sel};')
-    vhdl.write(f, 3, f'end case;')
+    vhdl.write(f, 3, 'end case;')
     vhdl.common.write_synchronous_process_epilogue(
         f, clk='clk', name='out_mux_decode_proc'
     )
 
     # Output multiplexer logic
-    vhdl.write(f, 1, f'-- Output muliplexer', start='\n')
+    vhdl.write(f, 1, '-- Output muliplexer', start='\n')
     vhdl.common.write_synchronous_process_prologue(
         f,
         clk='clk',
         name='out_mux_proc',
     )
-    vhdl.write(f, 3, f'case out_mux_sel is')
+    vhdl.write(f, 3, 'case out_mux_sel is')
     for reg_i, mux_i in output_mux_table.items():
         vhdl.write(f, 4, f'when {mux_i} =>')
         if reg_i < 0:
             vhdl.write(f, 5, f'p_0_out <= p_{-1-reg_i}_in;')
         else:
             vhdl.write(f, 5, f'p_0_out <= shift_reg({reg_i});')
-    vhdl.write(f, 3, f'end case;')
+    vhdl.write(f, 3, 'end case;')
     vhdl.common.write_synchronous_process_epilogue(
         f,
         clk='clk',
diff --git a/b_asic/codegen/vhdl/common.py b/b_asic/codegen/vhdl/common.py
index 7925b6f3..cf3dfee8 100644
--- a/b_asic/codegen/vhdl/common.py
+++ b/b_asic/codegen/vhdl/common.py
@@ -29,8 +29,8 @@ def write_b_asic_vhdl_preamble(f: TextIOWrapper):
     vhdl.write_lines(
         f,
         [
-            (0, f'--'),
-            (0, f'-- This code was automatically generated by the B-ASIC toolbox.'),
+            (0, '--'),
+            (0, '-- This code was automatically generated by the B-ASIC toolbox.'),
             (0, f'-- Code generation timestamp: ({datetime.now()})'),
         ],
     )
@@ -39,8 +39,8 @@ def write_b_asic_vhdl_preamble(f: TextIOWrapper):
     vhdl.write_lines(
         f,
         [
-            (0, f'-- URL: https://gitlab.liu.se/da/B-ASIC'),
-            (0, f'--', '\n\n'),
+            (0, '-- URL: https://gitlab.liu.se/da/B-ASIC'),
+            (0, '--', '\n\n'),
         ],
     )
 
@@ -113,7 +113,7 @@ def write_signal_decl(
         vhdl.write_lines(
             f,
             [
-                (1, f'attribute ram_style : string;'),
+                (1, 'attribute ram_style : string;'),
                 (1, f'attribute ram_style of {name} : signal is "{vivado_ram_style}";'),
             ],
         )
@@ -121,7 +121,7 @@ def write_signal_decl(
         vhdl.write_lines(
             f,
             [
-                (1, f'attribute ramstyle : string;'),
+                (1, 'attribute ramstyle : string;'),
                 (1, f'attribute ramstyle of {name} : signal is "{quartus_ram_style}";'),
             ],
         )
@@ -200,7 +200,7 @@ def write_process_prologue(
         vhdl.write(f, indent, f'{name}: process({sensitivity_list})')
     else:
         vhdl.write(f, indent, f'process({sensitivity_list})')
-    vhdl.write(f, indent, f'begin')
+    vhdl.write(f, indent, 'begin')
 
 
 def write_process_epilogue(
@@ -224,7 +224,7 @@ def write_process_epilogue(
         An optional name of the ending process.
     """
     _ = sensitivity_list
-    vhdl.write(f, indent, f'end process', end="")
+    vhdl.write(f, indent, 'end process', end="")
     if name is not None:
         vhdl.write(f, 0, ' ' + name, end="")
     vhdl.write(f, 0, ';')
@@ -253,7 +253,7 @@ def write_synchronous_process_prologue(
         An optional name for the process.
     """
     write_process_prologue(f, sensitivity_list=clk, indent=indent, name=name)
-    vhdl.write(f, indent + 1, f'if rising_edge(clk) then')
+    vhdl.write(f, indent + 1, 'if rising_edge(clk) then')
 
 
 def write_synchronous_process_epilogue(
@@ -279,7 +279,7 @@ def write_synchronous_process_epilogue(
         An optional name for the process
     """
     _ = clk
-    vhdl.write(f, indent + 1, f'end if;')
+    vhdl.write(f, indent + 1, 'end if;')
     write_process_epilogue(f, sensitivity_list=clk, indent=indent, name=name)
 
 
@@ -346,7 +346,7 @@ def write_synchronous_memory(
             [
                 (3, f'if {re} = \'1\' then'),
                 (4, f'{read_name} <= memory({address});'),
-                (3, f'end if;'),
+                (3, 'end if;'),
             ],
         )
     for write_name, address, we in write_ports:
@@ -355,7 +355,7 @@ def write_synchronous_memory(
             [
                 (3, f'if {we} = \'1\' then'),
                 (4, f'memory({address}) <= {write_name};'),
-                (3, f'end if;'),
+                (3, 'end if;'),
             ],
         )
     write_synchronous_process_epilogue(f, clk=clk, name=name)
@@ -393,7 +393,7 @@ def write_asynchronous_read_memory(
             [
                 (3, f'if {we} = \'1\' then'),
                 (4, f'memory({address}) <= {write_name};'),
-                (3, f'end if;'),
+                (3, 'end if;'),
             ],
         )
     write_synchronous_process_epilogue(f, clk=clk, name=name)
diff --git a/b_asic/codegen/vhdl/entity.py b/b_asic/codegen/vhdl/entity.py
index 1e0cba8f..962ce7bd 100644
--- a/b_asic/codegen/vhdl/entity.py
+++ b/b_asic/codegen/vhdl/entity.py
@@ -33,11 +33,11 @@ def write_memory_based_storage(
         f,
         [
             (0, f'entity {entity_name} is'),
-            (1, f'generic('),
-            (2, f'-- Data word length'),
+            (1, 'generic('),
+            (2, '-- Data word length'),
             (2, f'WL : integer := {word_length}'),
-            (1, f');'),
-            (1, f'port('),
+            (1, ');'),
+            (1, 'port('),
         ],
     )
 
@@ -45,11 +45,11 @@ def write_memory_based_storage(
     vhdl.write_lines(
         f,
         [
-            (0, f'-- Clock, synchronous reset and enable signals'),
-            (2, f'clk : in std_logic;'),
-            (2, f'rst : in std_logic;'),
-            (2, f'en  : in std_logic;'),
-            (0, f''),
+            (0, '-- Clock, synchronous reset and enable signals'),
+            (2, 'clk : in std_logic;'),
+            (2, 'rst : in std_logic;'),
+            (2, 'en  : in std_logic;'),
+            (0, ''),
         ],
     )
 
diff --git a/b_asic/gui_utils/about_window.py b/b_asic/gui_utils/about_window.py
index ac7b4cae..7c203d4f 100644
--- a/b_asic/gui_utils/about_window.py
+++ b/b_asic/gui_utils/about_window.py
@@ -32,7 +32,9 @@ class AboutWindow(QDialog):
         self._add_information_to_layout()
 
     def _hover_text(self, url):
-        # self.setWindowTitle(url) # When removing mouse, the title gets "B-ASIC Scheduler". Where does THAT come from?
+        # self.setWindowTitle(url)
+        # When removing mouse, the title gets "B-ASIC Scheduler".
+        # Where does THAT come from?
         if url:
             QToolTip.showText(QCursor.pos(), url)
         else:
@@ -54,7 +56,8 @@ class AboutWindow(QDialog):
             " Computer Engineering</a> at <a"
             " href=\"https://liu.se/?l=en\">Linköping University</a>,"
             " Sweden.\n\nB-ASIC is released under the <a"
-            " href=\"https://gitlab.liu.se/da/B-ASIC/-/blob/master/LICENSE\">MIT-license</a>"
+            " href=\"https://gitlab.liu.se/da/B-ASIC/-/blob/master/LICENSE\">"
+            "MIT-license</a>"
             " and any extension to the program should follow that same"
             f" license.\n\n*Version: {__version__}*\n\nCopyright 2020-2023,"
             " Oscar Gustafsson et al."
@@ -74,9 +77,11 @@ class AboutWindow(QDialog):
         self.logo2.setFixedWidth(100)
 
         label3 = QLabel(
-            """Additional resources: <a href="https://da.gitlab-pages.liu.se/B-ASIC/">documentation</a>,"""
-            """ <a href="https://gitlab.liu.se/da/B-ASIC/">git repository</a>,"""
-            """ <a href="https://gitlab.liu.se/da/B-ASIC/-/issues">report issues and suggestions</a>."""
+            'Additional resources: <a href="https://da.gitlab-pages.liu.se/B-ASIC/">'
+            'documentation</a>,'
+            ' <a href="https://gitlab.liu.se/da/B-ASIC/">git repository</a>,'
+            ' <a href="https://gitlab.liu.se/da/B-ASIC/-/issues">report issues and'
+            ' suggestions</a>.'
         )
         label3.setOpenExternalLinks(True)
         label3.linkHovered.connect(self._hover_text)
diff --git a/b_asic/gui_utils/plot_window.py b/b_asic/gui_utils/plot_window.py
index c92c8b5a..cdf56592 100644
--- a/b_asic/gui_utils/plot_window.py
+++ b/b_asic/gui_utils/plot_window.py
@@ -211,7 +211,7 @@ def start_simulation_dialog(
     sfg_name : str, optional
         The name of the SFG.
     """
-    app = QApplication(sys.argv)
+    QApplication(sys.argv)
     win = PlotWindow(sim_result=sim_results, sfg_name=sfg_name)
     win.exec_()
 
diff --git a/b_asic/operation.py b/b_asic/operation.py
index 96f424f6..4af199a4 100644
--- a/b_asic/operation.py
+++ b/b_asic/operation.py
@@ -951,7 +951,7 @@ class AbstractOperation(Operation, AbstractGraphComponent):
         for i, input_port in enumerate(self.inputs):
             value = input_values[i]
             if bits_override is None and input_port.signal_count >= 1:
-                bits = input_port.signals[0].bits
+                input_port.signals[0].bits
             if bits_override is not None:
                 if isinstance(value, complex):
                     raise TypeError(
@@ -992,7 +992,8 @@ class AbstractOperation(Operation, AbstractGraphComponent):
         return latency_offsets
 
     def _check_all_latencies_set(self) -> None:
-        """Raises an exception if an input or output does not have its latency offset set
+        """
+        Raises an exception if an input or output does not have a latency offset.
         """
         self.input_latency_offsets()
         self.output_latency_offsets()
@@ -1001,10 +1002,10 @@ class AbstractOperation(Operation, AbstractGraphComponent):
         latency_offsets = [i.latency_offset for i in self.inputs]
 
         if any(val is None for val in latency_offsets):
-            raise ValueError(
-                "Missing latencies for input(s)"
-                f" {[i for (i, latency) in enumerate(latency_offsets) if latency is None]}"
-            )
+            missing = [
+                i for (i, latency) in enumerate(latency_offsets) if latency is None
+            ]
+            raise ValueError(f"Missing latencies for input(s) {missing}")
 
         return cast(List[int], latency_offsets)
 
@@ -1012,10 +1013,10 @@ class AbstractOperation(Operation, AbstractGraphComponent):
         latency_offsets = [i.latency_offset for i in self.outputs]
 
         if any(val is None for val in latency_offsets):
-            raise ValueError(
-                "Missing latencies for output(s)"
-                f" {[i for (i, latency) in enumerate(latency_offsets) if latency is None]}"
-            )
+            missing = [
+                i for (i, latency) in enumerate(latency_offsets) if latency is None
+            ]
+            raise ValueError(f"Missing latencies for output(s) {missing}")
 
         return cast(List[int], latency_offsets)
 
diff --git a/b_asic/research/__init__.py b/b_asic/research/__init__.py
index 5004affd..39255ea1 100644
--- a/b_asic/research/__init__.py
+++ b/b_asic/research/__init__.py
@@ -8,5 +8,6 @@ that they may be useful for someone else as well.
 
 The following module is currently available:
 
-- :mod:`b_asic.research.interleaver`: generate matrix transposers and random interleavers.
+- :mod:`b_asic.research.interleaver`: generate matrix transposers and random
+  interleavers.
 """
diff --git a/b_asic/resources.py b/b_asic/resources.py
index 2f582e3f..dd5cc724 100644
--- a/b_asic/resources.py
+++ b/b_asic/resources.py
@@ -311,7 +311,7 @@ class _ForwardBackwardTable:
 
         # All passes failed, raise exception...
         raise ValueError(
-            f"Can't backward allocate any variable. This should not happen."
+            "Can't backward allocate any variable. This should not happen."
         )
 
     def __getitem__(self, key):
@@ -325,7 +325,9 @@ class _ForwardBackwardTable:
 
     def __str__(self):
         # Text width of input and output column
-        lst_w = lambda proc_lst: reduce(lambda n, p: n + len(str(p)) + 1, proc_lst, 0)
+        def lst_w(proc_lst):
+            return reduce(lambda n, p: n + len(str(p)) + 1, proc_lst, 0)
+
         input_col_w = max(5, max(lst_w(pl.inputs) for pl in self.table) + 1)
         output_col_w = max(5, max(lst_w(pl.outputs) for pl in self.table) + 1)
 
@@ -499,7 +501,7 @@ class ProcessCollection:
 
         # Generate the life-time chart
         for i, process in enumerate(_sorted_nicely(self._collection)):
-            bar_row = i if row == None else row
+            bar_row = i if row is None else row
             bar_start = process.start_time % self._schedule_time
             bar_end = process.start_time + process.execution_time
             bar_end = (
@@ -553,7 +555,7 @@ class ProcessCollection:
         _ax.xaxis.set_major_locator(MaxNLocator(integer=True))  # type: ignore
         _ax.yaxis.set_major_locator(MaxNLocator(integer=True))  # type: ignore
         _ax.set_xlim(0, self._schedule_time)  # type: ignore
-        if row == None:
+        if row is None:
             _ax.set_ylim(0.25, len(self._collection) + 0.75)  # type: ignore
         else:
             pass
@@ -998,11 +1000,16 @@ class ProcessCollection:
 
         # Make sure that concurrent reads/writes do not surpass the port setting
         for mv in self:
-            filter_write = lambda p: p.start_time == mv.start_time
-            filter_read = (
-                lambda p: (p.start_time + p.execution_time) % self._schedule_time
-                == mv.start_time + mv.execution_time % self._schedule_time
-            )
+
+            def filter_write(p):
+                return p.start_time == mv.start_time
+
+            def filter_read(p):
+                return (
+                    (p.start_time + p.execution_time) % self._schedule_time
+                    == mv.start_time + mv.execution_time % self._schedule_time
+                )
+
             needed_write_ports = len(list(filter(filter_write, self)))
             needed_read_ports = len(list(filter(filter_read, self)))
             if needed_write_ports > write_ports + 1:
diff --git a/b_asic/simulation.py b/b_asic/simulation.py
index 1defde58..7e449eef 100644
--- a/b_asic/simulation.py
+++ b/b_asic/simulation.py
@@ -204,7 +204,8 @@ class Simulation:
         appropriate output index.
         Example result after 3 iterations::
 
-            {"c1": [3, 6, 7], "c2": [4, 5, 5], "bfly1.0": [7, 0, 0], "bfly1.1": [-1, 0, 2], "0": [7, -2, -1]}
+            {"c1": [3, 6, 7], "c2": [4, 5, 5], "bfly1.0": [7, 0, 0], "bfly1.1":\
+ [-1, 0, 2], "0": [7, -2, -1]}
         """
         return {key: np.array(value) for key, value in self._results.items()}
 
-- 
GitLab