mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Whitespace cleanup.
This commit is contained in:
parent
3076046b3f
commit
1aed516938
|
@ -82,40 +82,38 @@ class DictRow(list):
|
||||||
return list.__getitem__(self, x)
|
return list.__getitem__(self, x)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
res = []
|
res = []
|
||||||
for n, v in self._index.items():
|
for n, v in self._index.items():
|
||||||
res.append((n, list.__getitem__(self, v)))
|
res.append((n, list.__getitem__(self, v)))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return self._index.keys()
|
return self._index.keys()
|
||||||
|
|
||||||
def values(self):
|
def values(self):
|
||||||
return tuple(self[:])
|
return tuple(self[:])
|
||||||
|
|
||||||
def has_key(self, x):
|
def has_key(self, x):
|
||||||
return self._index.has_key(x)
|
return self._index.has_key(x)
|
||||||
|
|
||||||
def get(self, x, default=None):
|
def get(self, x, default=None):
|
||||||
try:
|
try:
|
||||||
return self[x]
|
return self[x]
|
||||||
except:
|
except:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SQL_IN(object):
|
class SQL_IN(object):
|
||||||
"""Adapt any iterable to an SQL quotable object."""
|
"""Adapt any iterable to an SQL quotable object."""
|
||||||
|
|
||||||
def __init__(self, seq):
|
def __init__(self, seq):
|
||||||
self._seq = seq
|
self._seq = seq
|
||||||
|
|
||||||
def getquoted(self):
|
def getquoted(self):
|
||||||
# this is the important line: note how every object in the
|
# this is the important line: note how every object in the
|
||||||
# list is adapted and then how getquoted() is called on it
|
# list is adapted and then how getquoted() is called on it
|
||||||
qobjs = [str(_A(o).getquoted()) for o in self._seq]
|
qobjs = [str(_A(o).getquoted()) for o in self._seq]
|
||||||
|
return '(' + ', '.join(qobjs) + ')'
|
||||||
return '(' + ', '.join(qobjs) + ')'
|
|
||||||
|
|
||||||
__str__ = getquoted
|
__str__ = getquoted
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user