fix(PLRsearch): fix some pylint violations 88/40188/4
authorVratko Polak <vrpolak@cisco.com>
Fri, 12 Jan 2024 13:51:43 +0000 (14:51 +0100)
committerVratko Polak <vrpolak@cisco.com>
Wed, 24 Jan 2024 11:28:58 +0000 (12:28 +0100)
- Complexity and logging would require a larger change.

Change-Id: I69f8e47b1806c880cd626bc5a8f5ae6290246093
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/libraries/python/PLRsearch/Integrator.py
resources/libraries/python/PLRsearch/PLRsearch.py
resources/libraries/python/PLRsearch/stat_trackers.py

index f80110c..cc8f838 100644 (file)
@@ -189,8 +189,8 @@ def estimate_nd(communication_pipe, scale_coeff=8.0, trace_enabled=False):
     :raises numpy.linalg.LinAlgError: If the focus shape gets singular
         (due to rounding errors). Try changing scale_coeff.
     """
-    debug_list = list()
-    trace_list = list()
+    debug_list = []
+    trace_list = []
     # Block until input object appears.
     (
         dimension,
index e0eea23..8d6e1ff 100644 (file)
@@ -182,7 +182,7 @@ class PLRsearch:
             f"Started search with min_rate {min_rate!r}, "
             f"max_rate {max_rate!r}"
         )
-        trial_result_list = list()
+        trial_result_list = []
         trial_number = self.trial_number_offset
         focus_trackers = (None, None)
         transmit_rate = (min_rate + max_rate) / 2.0
@@ -694,11 +694,11 @@ class PLRsearch:
                     trace_list,
                     sampls,
                 ) = result_or_traceback
-            except ValueError:
+            except ValueError as exc:
                 raise RuntimeError(
                     f"Worker {name} failed with the following traceback:\n"
                     f"{result_or_traceback}"
-                )
+                ) from exc
             logging.info(f"Logs from worker {name!r}:")
             for message in debug_list:
                 logging.info(message)
index d19eebe..e598fd8 100644 (file)
@@ -209,7 +209,7 @@ class ScalarDualStatTracker(ScalarStatTracker):
         """
         # Using super() as copy() and add() are not expected to change
         # signature, so this way diamond inheritance will be supported.
-        primary = super(ScalarDualStatTracker, self)
+        primary = super()
         if self.max_log_weight is None or log_weight >= self.max_log_weight:
             self.max_log_weight = log_weight
             self.secondary = primary.copy()