mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Use dict comprehensions
This commit is contained in:
parent
c3ee9cac41
commit
f939f39580
|
@ -181,11 +181,8 @@ class Range(object):
|
|||
return self.__gt__(other)
|
||||
|
||||
def __getstate__(self):
|
||||
return dict(
|
||||
(slot, getattr(self, slot))
|
||||
for slot in self.__slots__
|
||||
if hasattr(self, slot)
|
||||
)
|
||||
return {slot: getattr(self, slot)
|
||||
for slot in self.__slots__ if hasattr(self, slot)}
|
||||
|
||||
def __setstate__(self, state):
|
||||
for slot, value in state.items():
|
||||
|
|
|
@ -163,7 +163,7 @@ def make_dsn(dsn=None, **kwargs):
|
|||
kwargs['dbname'] = kwargs.pop('database')
|
||||
|
||||
# Drop the None arguments
|
||||
kwargs = dict((k, v) for (k, v) in kwargs.iteritems() if v is not None)
|
||||
kwargs = {k: v for (k, v) in kwargs.iteritems() if v is not None}
|
||||
|
||||
if dsn is not None:
|
||||
tmp = parse_dsn(dsn)
|
||||
|
|
Loading…
Reference in New Issue
Block a user