From 3fd63f8b673cee773cb35dd70629fc077d3bdf40 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 13 Dec 2021 14:47:57 +0000 Subject: [PATCH] refactor: bare excepts removed. --- pyerrors/correlators.py | 2 +- pyerrors/fits.py | 6 +++--- pyerrors/input/bdio.py | 2 +- pyerrors/obs.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index cdf4a339..90dcf193 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -536,7 +536,7 @@ class Corr: y_min = min([(x[0].value - x[0].dvalue) for x in self.content[x_range[0]: x_range[1] + 1] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)]) y_max = max([(x[0].value + x[0].dvalue) for x in self.content[x_range[0]: x_range[1] + 1] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)]) ax1.set_ylim([y_min - 0.1 * (y_max - y_min), y_max + 0.1 * (y_max - y_min)]) - except: + except Exception: pass else: ax1.set_ylim(y_range) diff --git a/pyerrors/fits.py b/pyerrors/fits.py index 023aaf53..d446e72e 100644 --- a/pyerrors/fits.py +++ b/pyerrors/fits.py @@ -187,7 +187,7 @@ def total_least_squares(x, y, func, silent=False, **kwargs): for i in range(25): try: func(np.arange(i), x.T[0]) - except: + except Exception: pass else: break @@ -328,7 +328,7 @@ def _prior_fit(x, y, func, priors, silent=False, **kwargs): for i in range(100): try: func(np.arange(i), 0) - except: + except Exception: pass else: break @@ -469,7 +469,7 @@ def _standard_fit(x, y, func, silent=False, **kwargs): for i in range(25): try: func(np.arange(i), x.T[0]) - except: + except Exception: pass else: break diff --git a/pyerrors/input/bdio.py b/pyerrors/input/bdio.py index 3e29924b..0a15cceb 100644 --- a/pyerrors/input/bdio.py +++ b/pyerrors/input/bdio.py @@ -226,7 +226,7 @@ def write_ADerrors(obs_list, file_path, bdio_path='./libbdio.so', **kwargs): for key in keys: try: # Try to convert key to integer ids.append(int(key)) - except: # If not possible construct a hash + except Exception: # If not possible construct a hash ids.append(int(hashlib.sha256(key.encode('utf-8')).hexdigest(), 16) % 10 ** 8) print('ids', ids) nt = [] diff --git a/pyerrors/obs.py b/pyerrors/obs.py index 411fe278..34bbf46d 100644 --- a/pyerrors/obs.py +++ b/pyerrors/obs.py @@ -946,7 +946,7 @@ def _merge_idx(idl): g = groupby(idl) if next(g, True) and not next(g, False): return idl[0] - except: + except Exception: pass if np.all([type(idx) is range for idx in idl]):