Improve dict key hashing
This commit is contained in:
1 parent
e65d992b43
commit
a310db8103
3 files changed
+10
-2
No files matched your search
@@ -52,6 +52,14 @@ class Channel:
|
|||||||
self.stream: Optional[Stream] = None
|
self.stream: Optional[Stream] = None
|
||||||
await self.get_stream()
|
await self.get_stream()
|
||||||
|
|
||||||
|
def __eq__(self, other: object):
|
||||||
|
if isinstance(other, self.__class__):
|
||||||
|
return self.id == other.id
|
||||||
|
return NotImplemented
|
||||||
|
|
||||||
|
def __hash__(self) -> int:
|
||||||
|
return hash((self.__class__.__name__, self.id))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def online(self) -> bool:
|
def online(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
+1
-1
@@ -120,7 +120,7 @@ class WebsocketTopic:
|
|||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
def __hash__(self) -> int:
|
def __hash__(self) -> int:
|
||||||
return hash(self.id)
|
return hash((self.__class__.__name__, self.id))
|
||||||
|
|
||||||
|
|
||||||
WEBSOCKET_TOPICS: Dict[str, str] = {
|
WEBSOCKET_TOPICS: Dict[str, str] = {
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ class Game:
|
|||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
def __hash__(self) -> int:
|
def __hash__(self) -> int:
|
||||||
return self.id
|
return hash((self.__class__.__name__, self.id))
|
||||||
|
|
||||||
|
|
||||||
class BaseDrop:
|
class BaseDrop:
|
||||||
|
|||||||
Reference in new issue
Block a user