add __eq__ and __ne__ operator to idict
This commit is contained in:
parent
c9eb4e2d9b
commit
8ac3094cc2
|
@ -198,6 +198,22 @@ class idict(dict):
|
|||
"""A caselessDict version of __repr__ """
|
||||
return 'caselessDict(' + dict.__repr__(self) + ')'
|
||||
|
||||
def __eq__(self, other):
|
||||
for k in self:
|
||||
if k not in other:
|
||||
return False
|
||||
if self[k] != other[k]:
|
||||
return False
|
||||
for k in other:
|
||||
if k not in self:
|
||||
return False
|
||||
if self[k] != other[k]:
|
||||
return False
|
||||
return True
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
|
||||
|
||||
def batch_generator(gen, *batch_size):
|
||||
batch = []
|
||||
|
|
Loading…
Reference in New Issue