From 79d986eb85b013ebedf4eb42a6a4c786375b89d1 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 29 Oct 2017 13:17:44 +0100 Subject: [PATCH] Placate new Flake8 --- pytools/__init__.py | 2 +- pytools/debug.py | 2 +- pytools/log.py | 2 +- pytools/persistent_dict.py | 18 +++++++++--------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pytools/__init__.py b/pytools/__init__.py index d5eba5e..7bc99bb 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -1466,7 +1466,7 @@ def string_histogram(iterable, min_value=None, max_value=None, bin_nr = bisect(bin_starts, value)-1 try: bins[bin_nr] += 1 - except: + except Exception: print(value, bin_nr, bin_starts) raise diff --git a/pytools/debug.py b/pytools/debug.py index 98b73de..d046844 100644 --- a/pytools/debug.py +++ b/pytools/debug.py @@ -122,7 +122,7 @@ def refdebug(obj, top_level=True, exclude=[]): expr_str = input() try: res = eval(expr_str, {"obj": r}) - except: + except Exception: from traceback import print_exc print_exc() print(res) diff --git a/pytools/log.py b/pytools/log.py index 13301fc..aa1dabf 100644 --- a/pytools/log.py +++ b/pytools/log.py @@ -558,7 +558,7 @@ class LogManager(object): try: self.db_conn.execute("insert into %s values (?,?,?)" % name, (self.tick_count, self.rank, float(value))) - except: + except Exception: print("while adding datapoint for '%s':" % name) raise diff --git a/pytools/persistent_dict.py b/pytools/persistent_dict.py index ae531c9..18057d5 100644 --- a/pytools/persistent_dict.py +++ b/pytools/persistent_dict.py @@ -601,7 +601,7 @@ class WriteOncePersistentDict(_PersistentDictBase): logger.debug("%s: disk cache store [key=%s]" % ( self.identifier, hexdigest_key)) - except: + except Exception: cleanup_m.error_clean_up() raise finally: @@ -649,7 +649,7 @@ class WriteOncePersistentDict(_PersistentDictBase): try: read_key = self._read(key_file) - except: + except Exception: self._warn("pytools.persistent_dict.WriteOncePersistentDict(%s) " "encountered an invalid " "key file for key %s. Remove the directory " @@ -668,7 +668,7 @@ class WriteOncePersistentDict(_PersistentDictBase): try: read_contents = self._read(contents_file) - except: + except Exception: self._warn("pytools.persistent_dict.WriteOncePersistentDict(%s) " "encountered an invalid " "key file for key %s. Remove the directory " @@ -729,7 +729,7 @@ class PersistentDict(_PersistentDictBase): logger.debug("%s: cache store [key=%s]" % ( self.identifier, hexdigest_key)) - except: + except Exception: cleanup_m.error_clean_up() raise finally: @@ -760,7 +760,7 @@ class PersistentDict(_PersistentDictBase): try: read_key = self._read(key_path) - except: + except Exception: item_dir_m.reset() self._warn("pytools.persistent_dict.PersistentDict(%s) " "encountered an invalid " @@ -779,7 +779,7 @@ class PersistentDict(_PersistentDictBase): try: read_contents = self._read(value_path) - except: + except Exception: item_dir_m.reset() self._warn("pytools.persistent_dict.PersistentDict(%s) " "encountered an invalid " @@ -791,7 +791,7 @@ class PersistentDict(_PersistentDictBase): # }}} - except: + except Exception: cleanup_m.error_clean_up() raise finally: @@ -818,7 +818,7 @@ class PersistentDict(_PersistentDictBase): try: read_key = self._read(key_file) - except: + except Exception: item_dir_m.reset() self._warn("pytools.persistent_dict.PersistentDict(%s) " "encountered an invalid " @@ -832,7 +832,7 @@ class PersistentDict(_PersistentDictBase): item_dir_m.reset() - except: + except Exception: cleanup_m.error_clean_up() raise finally: -- GitLab