better handling of eq/ne/hash in receiver and device objects
This commit is contained in:
parent
674ee9ac9e
commit
6f0b61e6d8
|
@ -181,10 +181,10 @@ class PairedDevice(object):
|
|||
__int__ = __index__
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.serial == other.serial
|
||||
return other is not None and self.kind == other.kind and self.serial == other.serial
|
||||
|
||||
def __ne__(self, other):
|
||||
return self.serial != other.serial
|
||||
return other is None or self.kind != other.kind or self.serial != other.serial
|
||||
|
||||
def __hash__(self):
|
||||
return self.serial.__hash__()
|
||||
|
@ -359,6 +359,15 @@ class Receiver(object):
|
|||
|
||||
return self.__contains__(dev.number)
|
||||
|
||||
def __eq__(self, other):
|
||||
return other is not None and self.kind == other.kind and self.path == other.path
|
||||
|
||||
def __ne__(self, other):
|
||||
return other is None or self.kind != other.kind or self.path != other.path
|
||||
|
||||
def __hash__(self):
|
||||
return self.path.__hash__()
|
||||
|
||||
def __str__(self):
|
||||
return self._str
|
||||
__unicode__ = __repr__ = __str__
|
||||
|
|
Loading…
Reference in New Issue