From 3691ece73cbce1cf874d0b3cf9cbaf45a4f08a78 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Fri, 12 Jan 2024 14:51:43 +0100 Subject: [PATCH] fix(PLRsearch): fix some pylint violations - Complexity and logging would require a larger change. Change-Id: I69f8e47b1806c880cd626bc5a8f5ae6290246093 Signed-off-by: Vratko Polak --- resources/libraries/python/PLRsearch/Integrator.py | 4 ++-- resources/libraries/python/PLRsearch/PLRsearch.py | 6 +++--- resources/libraries/python/PLRsearch/stat_trackers.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/libraries/python/PLRsearch/Integrator.py b/resources/libraries/python/PLRsearch/Integrator.py index f80110ce29..cc8f838fe6 100644 --- a/resources/libraries/python/PLRsearch/Integrator.py +++ b/resources/libraries/python/PLRsearch/Integrator.py @@ -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, diff --git a/resources/libraries/python/PLRsearch/PLRsearch.py b/resources/libraries/python/PLRsearch/PLRsearch.py index e0eea233ba..8d6e1ffe71 100644 --- a/resources/libraries/python/PLRsearch/PLRsearch.py +++ b/resources/libraries/python/PLRsearch/PLRsearch.py @@ -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) diff --git a/resources/libraries/python/PLRsearch/stat_trackers.py b/resources/libraries/python/PLRsearch/stat_trackers.py index d19eebedb7..e598fd840e 100644 --- a/resources/libraries/python/PLRsearch/stat_trackers.py +++ b/resources/libraries/python/PLRsearch/stat_trackers.py @@ -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() -- 2.16.6