mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-07-03 11:13:04 +03:00
Fixed catching too broad exceptions
Also some flake8 cleanup in the lib dir.
This commit is contained in:
parent
fcc4cd6734
commit
8fec446789
|
@ -491,6 +491,7 @@ class NumberRangeAdapter(RangeAdapter):
|
||||||
return ("'%s%s,%s%s'" % (
|
return ("'%s%s,%s%s'" % (
|
||||||
r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
|
r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
|
||||||
|
|
||||||
|
|
||||||
# TODO: probably won't work with infs, nans and other tricky cases.
|
# TODO: probably won't work with infs, nans and other tricky cases.
|
||||||
register_adapter(NumericRange, NumberRangeAdapter)
|
register_adapter(NumericRange, NumberRangeAdapter)
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,7 @@ import sys as _sys
|
||||||
import time as _time
|
import time as _time
|
||||||
import re as _re
|
import re as _re
|
||||||
|
|
||||||
try:
|
|
||||||
import logging as _logging
|
import logging as _logging
|
||||||
except:
|
|
||||||
_logging = None
|
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
from psycopg2 import extensions as _ext
|
from psycopg2 import extensions as _ext
|
||||||
|
@ -189,7 +186,7 @@ class DictRow(list):
|
||||||
def get(self, x, default=None):
|
def get(self, x, default=None):
|
||||||
try:
|
try:
|
||||||
return self[x]
|
return self[x]
|
||||||
except:
|
except Exception:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
|
|
|
@ -138,7 +138,7 @@ class AbstractConnectionPool(object):
|
||||||
for conn in self._pool + list(self._used.values()):
|
for conn in self._pool + list(self._used.values()):
|
||||||
try:
|
try:
|
||||||
conn.close()
|
conn.close()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self.closed = True
|
self.closed = True
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ class LocalTimezone(datetime.tzinfo):
|
||||||
tt = time.localtime(stamp)
|
tt = time.localtime(stamp)
|
||||||
return tt.tm_isdst > 0
|
return tt.tm_isdst > 0
|
||||||
|
|
||||||
|
|
||||||
LOCAL = LocalTimezone()
|
LOCAL = LocalTimezone()
|
||||||
|
|
||||||
# TODO: pre-generate some interesting time zones?
|
# TODO: pre-generate some interesting time zones?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user