mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +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)
|
return self.__gt__(other)
|
||||||
|
|
||||||
def __getstate__(self):
|
def __getstate__(self):
|
||||||
return dict(
|
return {slot: getattr(self, slot)
|
||||||
(slot, getattr(self, slot))
|
for slot in self.__slots__ if hasattr(self, slot)}
|
||||||
for slot in self.__slots__
|
|
||||||
if hasattr(self, slot)
|
|
||||||
)
|
|
||||||
|
|
||||||
def __setstate__(self, state):
|
def __setstate__(self, state):
|
||||||
for slot, value in state.items():
|
for slot, value in state.items():
|
||||||
|
|
|
@ -163,7 +163,7 @@ def make_dsn(dsn=None, **kwargs):
|
||||||
kwargs['dbname'] = kwargs.pop('database')
|
kwargs['dbname'] = kwargs.pop('database')
|
||||||
|
|
||||||
# Drop the None arguments
|
# 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:
|
if dsn is not None:
|
||||||
tmp = parse_dsn(dsn)
|
tmp = parse_dsn(dsn)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user