User super() throughout DictRow class

Avoid calling parent method directly.
This commit is contained in:
Jon Dufresne 2017-12-11 18:57:48 -08:00
parent 2cd9a78a97
commit 3a6a8e96fb

View File

@ -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())