From 58656e8099f7b4454366ac95ecdc9d8c6c608125 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Fri, 15 Mar 2019 10:18:18 +0100
Subject: [PATCH] [experiment] Code cleanup

---
 beat/core/experiment.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/beat/core/experiment.py b/beat/core/experiment.py
index 1f6690c2..f8bbc377 100644
--- a/beat/core/experiment.py
+++ b/beat/core/experiment.py
@@ -231,9 +231,9 @@ class Experiment(object):
         if data is None:  # loads prototype and validates it
 
             experiment_data, self.errors = prototypes.load("experiment")
-            assert not self.errors, "\n  * %s" % "\n  *".join(self.errors)
+            assert not self.errors, "\n  * %s" % "\n  *".join(self.errors)  # nosec
             toolchain_data, self.errors = prototypes.load("toolchain")
-            assert not self.errors, "\n  * %s" % "\n  *".join(self.errors)
+            assert not self.errors, "\n  * %s" % "\n  *".join(self.errors)  # nosec
 
         elif isinstance(data, (tuple, list)):  # the user has passed a tuple
 
@@ -477,7 +477,7 @@ class Experiment(object):
                 self.errors.append(
                     "/loop/%s/nb_slots: you have set the number "
                     "of slots for algorithm `%s' to %d, but it is not "
-                    "splittable" % (analyzername, thisalgo.name, loop["nb_slots"])
+                    "splittable" % (algoname, thisalgo.name, loop["nb_slots"])
                 )
 
             # check parameter consistence
@@ -740,7 +740,7 @@ class Experiment(object):
                 from_dtype = self.algorithms[block["algorithm"]].output_map[algout]
                 from_name = "block"
             else:
-                self.errors.append("Unknown endpoint %s" % to_endpt[0])
+                self.errors.append("Unknown endpoint %s" % from_endpt[0])
                 continue
 
             to_endpt = connection["to"].split(".", 1)
@@ -869,7 +869,7 @@ class Experiment(object):
             # for the grouping properties for the inputs
 
             # create channel groups
-            chain_in = collections.Counter(input_connections)
+            chain_groups = collections.Counter(input_connections)
 
             # now check the algorithm for conformance
             algo_groups = self.algorithms[self.analyzers[name]["algorithm"]].groups
@@ -926,7 +926,7 @@ class Experiment(object):
         )
 
         # makes sure we don't have multiple incomming connections
-        assert len(_connections) == len(connections), (
+        assert len(_connections) == len(connections), (  # nosec
             "detected multiple input "
             "connections for block `%s' on experiment `%s'" % (name, self.label)
         )
@@ -975,7 +975,6 @@ class Experiment(object):
                 # then go one by one generating the input **and** output hashes
                 # until all is done.
 
-                block_config = self.blocks[block]
                 retval[algo_endpt] = {
                     "from": "%s.%s" % (block, output),
                     "channel": channel,
@@ -1181,8 +1180,6 @@ class Experiment(object):
     def dot_diagram(self):
         """Returns a dot diagram representation of the experiment"""
 
-        from .drawing import create_port_table
-
         title = "Experiment: %s" % self.label
 
         def __label_callback(type, name):
-- 
GitLab