Codebase list python-procrunner / e29fd9c
Override few magic functions in return object define equality, mark object as unhashable again as it is mutable. Markus Gerstel 4 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
362362 self.stdout = self["stdout"]
363363 self.stderr = self["stderr"]
364364
365 def __eq__(self, other):
366 """Override equality operator to account for added fields"""
367 if type(other) is type(self):
368 return self.__dict__ == other.__dict__
369 return False
370
371 def __hash__(self):
372 """This object is not immutable, so mark it as unhashable"""
373 return None
374
375 def __ne__(self, other):
376 """Overrides the default implementation (unnecessary in Python 3)"""
377 return not self.__eq__(other)
378
365379
366380 def run(
367381 command,