mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-11 03:26:37 +03:00
User super() throughout DictRow class
Avoid calling parent method directly.
This commit is contained in:
parent
2cd9a78a97
commit
3a6a8e96fb
|
@ -168,12 +168,12 @@ class DictRow(list):
|
||||||
def __getitem__(self, x):
|
def __getitem__(self, x):
|
||||||
if not isinstance(x, (int, slice)):
|
if not isinstance(x, (int, slice)):
|
||||||
x = self._index[x]
|
x = self._index[x]
|
||||||
return list.__getitem__(self, x)
|
return super(DictRow, self).__getitem__(x)
|
||||||
|
|
||||||
def __setitem__(self, x, v):
|
def __setitem__(self, x, v):
|
||||||
if not isinstance(x, (int, slice)):
|
if not isinstance(x, (int, slice)):
|
||||||
x = self._index[x]
|
x = self._index[x]
|
||||||
list.__setitem__(self, x, v)
|
super(DictRow, self).__setitem__(x, v)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
return list(self.iteritems())
|
return list(self.iteritems())
|
||||||
|
@ -195,13 +195,13 @@ class DictRow(list):
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
for n, v in self._index.iteritems():
|
for n, v in self._index.iteritems():
|
||||||
yield n, list.__getitem__(self, v)
|
yield n, super(DictRow, self).__getitem__(v)
|
||||||
|
|
||||||
def iterkeys(self):
|
def iterkeys(self):
|
||||||
return self._index.iterkeys()
|
return self._index.iterkeys()
|
||||||
|
|
||||||
def itervalues(self):
|
def itervalues(self):
|
||||||
return list.__iter__(self)
|
return super(DictRow, self).__iter__()
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
return dict(self.iteritems())
|
return dict(self.iteritems())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user