core: Implement Dead.__ne__ & Dead.__hash__

Both these addtions are to address warnings in
https://lgtm.com/projects/g/dw/mitogen/alerts/?mode=list. Namely that if
a class defines an equality method then it should also define an
inequality and a hash method.

Refs #61
This commit is contained in:
Alex Willmer 2018-02-25 21:23:29 +00:00 committed by David Wilson
parent 4b373c421b
commit a1aab30e63
1 changed files with 6 additions and 0 deletions

View File

@ -121,9 +121,15 @@ class TimeoutError(Error):
class Dead(object):
def __hash__(self):
return hash(Dead)
def __eq__(self, other):
return type(other) is Dead
def __ne__(self, other):
return type(other) is not Dead
def __reduce__(self):
return (_unpickle_dead, ())