From 6a18397353d41622f9b73d28ea497de1afc0c724 Mon Sep 17 00:00:00 2001
From: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com>
Date: Thu, 2 Feb 2023 13:56:27 +0100
Subject: [PATCH] Silence flake8 and appease black. (#2086)

New versions, new warnings. Begone.
---
 .flake8                                             |  2 +-
 doc/scripts/make_images.py                          |  2 --
 example/lfp/neuron_lfp_example.py                   |  1 -
 python/example/brunel.py                            |  2 --
 python/example/calcium_stdp.py                      |  1 -
 python/example/gap_junctions.py                     |  1 -
 python/example/network_two_cells_gap_junctions.py   |  3 +--
 python/example/ou_lif/ou_lif.py                     |  3 ---
 python/example/probe_lfpykit.py                     | 13 ++++---------
 python/example/single_cell_bluepyopt_l5pc.py        |  1 -
 python/example/single_cell_cable.py                 |  1 -
 python/example/single_cell_detailed_recipe.py       |  1 -
 python/test/unit/test_multiple_connections.py       |  1 -
 .../unit_distributed/test_domain_decompositions.py  |  1 -
 14 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/.flake8 b/.flake8
index c38577d8..fbc5cc3a 100644
--- a/.flake8
+++ b/.flake8
@@ -2,7 +2,7 @@
 max-line-length = 88
 extend-ignore =
               # for black
-              E203,
+              E203, E231,
               # zealous line lengths
               E501,
               # inconsistent ruling on newlines before bin op
diff --git a/doc/scripts/make_images.py b/doc/scripts/make_images.py
index 2e6ee0c9..af9f4cfe 100644
--- a/doc/scripts/make_images.py
+++ b/doc/scripts/make_images.py
@@ -170,7 +170,6 @@ def morph_image(morphs, methods, filename, **kwargs):
 # Handling this case would make rendering regions more complex, but would
 # not bee too hard to support.
 def label_image(morphology, labels, filename, **kwargs):
-
     loc_sc = kwargs.get("loc_sc", 2)
     sc = kwargs.get("sc", 20)
     drawroot = kwargs.get("drawroot", True)
@@ -294,7 +293,6 @@ def label_image(morphology, labels, filename, **kwargs):
 
 
 def generate(path=""):
-
     morph_image(
         [inputs.branch_morph2],
         ["segments"],
diff --git a/example/lfp/neuron_lfp_example.py b/example/lfp/neuron_lfp_example.py
index 4b8b9315..66d0339b 100755
--- a/example/lfp/neuron_lfp_example.py
+++ b/example/lfp/neuron_lfp_example.py
@@ -195,7 +195,6 @@ class Cell:
         self.diam = diamvec
 
     def simulate(self):
-
         neuron.h.finitialize(self.v_init)
         neuron.h.fcurrent()
 
diff --git a/python/example/brunel.py b/python/example/brunel.py
index ba8258e2..2af659eb 100755
--- a/python/example/brunel.py
+++ b/python/example/brunel.py
@@ -45,7 +45,6 @@ class brunel_recipe(arbor.recipe):
         poiss_lambda,
         seed=42,
     ):
-
         arbor.recipe.__init__(self)
 
         # Make sure that in_degree_prop in the interval (0, 1]
@@ -115,7 +114,6 @@ class brunel_recipe(arbor.recipe):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser(description="Brunel model miniapp.")
     parser.add_argument(
         "-n",
diff --git a/python/example/calcium_stdp.py b/python/example/calcium_stdp.py
index 6f287184..890871f3 100644
--- a/python/example/calcium_stdp.py
+++ b/python/example/calcium_stdp.py
@@ -107,7 +107,6 @@ class stdp_recipe(arbor.recipe):
 
 
 def run(time_lag):
-
     # Time between stimuli
     T = 1000.0 / f
 
diff --git a/python/example/gap_junctions.py b/python/example/gap_junctions.py
index 50da0589..42529581 100644
--- a/python/example/gap_junctions.py
+++ b/python/example/gap_junctions.py
@@ -19,7 +19,6 @@ import matplotlib.pyplot as plt
 
 
 def make_cable_cell(gid):
-
     # Build a segment tree
     tree = arbor.segment_tree()
 
diff --git a/python/example/network_two_cells_gap_junctions.py b/python/example/network_two_cells_gap_junctions.py
index 181833f9..06221bb8 100755
--- a/python/example/network_two_cells_gap_junctions.py
+++ b/python/example/network_two_cells_gap_junctions.py
@@ -113,7 +113,6 @@ class TwoCellsWithGapJunction(arbor.recipe):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser(
         description="Two cells connected via a gap junction"
     )
@@ -197,7 +196,7 @@ if __name__ == "__main__":
     si_gj_R = 1 / si_gj_g
 
     # indicate the expected equilibrium potentials
-    for (i, j) in [[0, 1], [1, 0]]:
+    for i, j in [[0, 1], [1, 0]]:
         weighted_potential = args.Vms[i] + (
             (args.Vms[j] - args.Vms[i]) * (si_gj_R + cell_R)
         ) / (2 * cell_R + si_gj_R)
diff --git a/python/example/ou_lif/ou_lif.py b/python/example/ou_lif/ou_lif.py
index c308ec18..dde32404 100644
--- a/python/example/ou_lif/ou_lif.py
+++ b/python/example/ou_lif/ou_lif.py
@@ -20,7 +20,6 @@ def make_catalogue():
 
 
 def make_cell():
-
     # cell morphology
     # ===============
 
@@ -176,7 +175,6 @@ class ou_recipe(arb.recipe):
     # Here, if the value of the 'weight' parameter is 1, stimulation is switched on,
     # whereas if it is -1, stimulation is switched off.
     def get_generators(self, protocol):
-
         prot_name = protocol["scheme"]  # name of the protocol (defining its structure)
         start_time = protocol["time_start"]  # time at which the stimulus starts in s
         label = protocol["label"]  # target synapse (mechanism label)
@@ -255,7 +253,6 @@ class ou_recipe(arb.recipe):
 
 
 if __name__ == "__main__":
-
     # set up and run simulation
     # =========================
 
diff --git a/python/example/probe_lfpykit.py b/python/example/probe_lfpykit.py
index 0db4733f..f9dff508 100644
--- a/python/example/probe_lfpykit.py
+++ b/python/example/probe_lfpykit.py
@@ -162,6 +162,7 @@ I_m = I_c_samples[:, 1:] + I_m_samples[:, 1:]  # (nA)
 # Compute extracellular potentials
 ###############################################################################
 
+
 # ## Compute extracellular potentials
 # First we define a couple of classes to interface the LFPykit
 # library (https://LFPykit.readthedocs.io, https://github.com/LFPy/LFPykit):
@@ -334,15 +335,9 @@ def get_cv_polycollection(cell_geometry, V_m, vlims=[-66, -64], cmap="viridis"):
         inds = cell_geometry._CV_ind == i
         zips.append(
             create_polygon(
-                cell_geometry.x[
-                    inds,
-                ].flatten(),
-                cell_geometry.y[
-                    inds,
-                ].flatten(),
-                cell_geometry.d[
-                    inds,
-                ].flatten(),
+                cell_geometry.x[inds,].flatten(),
+                cell_geometry.y[inds,].flatten(),
+                cell_geometry.d[inds,].flatten(),
             )
         )
     polycol = PolyCollection(zips, edgecolors=colors, facecolors=colors, linewidths=0.0)
diff --git a/python/example/single_cell_bluepyopt_l5pc.py b/python/example/single_cell_bluepyopt_l5pc.py
index 2a8b6f39..502a6084 100755
--- a/python/example/single_cell_bluepyopt_l5pc.py
+++ b/python/example/single_cell_bluepyopt_l5pc.py
@@ -50,7 +50,6 @@ probe = arbor.cable_probe_membrane_voltage('"dend1"')
 
 # (6) Create a class that inherits from arbor.recipe
 class single_recipe(arbor.recipe):
-
     # (6.1) Define the class constructor
     def __init__(self, cell, probes):
         # The base C++ class constructor must be called first, to ensure that
diff --git a/python/example/single_cell_cable.py b/python/example/single_cell_cable.py
index 348fad91..2a8b61c6 100755
--- a/python/example/single_cell_cable.py
+++ b/python/example/single_cell_cable.py
@@ -149,7 +149,6 @@ def get_tmax(data):
 
 
 if __name__ == "__main__":
-
     parser = argparse.ArgumentParser(description="Cable")
 
     parser.add_argument(
diff --git a/python/example/single_cell_detailed_recipe.py b/python/example/single_cell_detailed_recipe.py
index cefb4dc9..436f80f6 100644
--- a/python/example/single_cell_detailed_recipe.py
+++ b/python/example/single_cell_detailed_recipe.py
@@ -73,7 +73,6 @@ cell = arbor.cable_cell(morph, decor, labels)
 
 # (5) Create a class that inherits from arbor.recipe
 class single_recipe(arbor.recipe):
-
     # (5.1) Define the class constructor
     def __init__(self):
         # The base C++ class constructor must be called first, to ensure that
diff --git a/python/test/unit/test_multiple_connections.py b/python/test/unit/test_multiple_connections.py
index b01c2fd3..965f96c3 100644
--- a/python/test/unit/test_multiple_connections.py
+++ b/python/test/unit/test_multiple_connections.py
@@ -28,7 +28,6 @@ NOTE: In principle, a plasticity (STDP) mechanism is employed here to test if a
 
 
 class TestMultipleConnections(unittest.TestCase):
-
     # Constructor (overridden)
     def __init__(self, args):
         super(TestMultipleConnections, self).__init__(args)
diff --git a/python/test/unit_distributed/test_domain_decompositions.py b/python/test/unit_distributed/test_domain_decompositions.py
index 5535f02f..5f4db967 100644
--- a/python/test/unit_distributed/test_domain_decompositions.py
+++ b/python/test/unit_distributed/test_domain_decompositions.py
@@ -209,7 +209,6 @@ class TestDomain_Decompositions_Distributed(unittest.TestCase):
     # 1 node with 1 cpu core, 1 gpu; assumes all cells will be placed on gpu in a single cell group
     @unittest.skipIf(not gpu_enabled, "GPU not enabled")
     def test_domain_decomposition_homogenous_GPU(self):
-
         if mpi_enabled:
             comm = arb.mpi_comm()
             context = arb.context(threads=1, gpu_id=0, mpi=comm)
-- 
GitLab