Fixed catching too broad exceptions

Also some flake8 cleanup in the lib dir.
This commit is contained in:
Daniele Varrazzo 2018-11-08 12:32:57 +00:00
parent fcc4cd6734
commit 8fec446789
4 changed files with 5 additions and 6 deletions

View File

@ -491,6 +491,7 @@ class NumberRangeAdapter(RangeAdapter):
return ("'%s%s,%s%s'" % (
r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
# TODO: probably won't work with infs, nans and other tricky cases.
register_adapter(NumericRange, NumberRangeAdapter)

View File

@ -30,10 +30,7 @@ import sys as _sys
import time as _time
import re as _re
try:
import logging as _logging
except:
_logging = None
import logging as _logging
import psycopg2
from psycopg2 import extensions as _ext
@ -189,7 +186,7 @@ class DictRow(list):
def get(self, x, default=None):
try:
return self[x]
except:
except Exception:
return default
def iteritems(self):

View File

@ -138,7 +138,7 @@ class AbstractConnectionPool(object):
for conn in self._pool + list(self._used.values()):
try:
conn.close()
except:
except Exception:
pass
self.closed = True

View File

@ -132,6 +132,7 @@ class LocalTimezone(datetime.tzinfo):
tt = time.localtime(stamp)
return tt.tm_isdst > 0
LOCAL = LocalTimezone()
# TODO: pre-generate some interesting time zones?