mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-29 16:39:37 +00:00
Improve dict key hashing
This commit is contained in:
@@ -52,6 +52,14 @@ class Channel:
|
||||
self.stream: Optional[Stream] = None
|
||||
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
|
||||
def online(self) -> bool:
|
||||
"""
|
||||
|
||||
@@ -120,7 +120,7 @@ class WebsocketTopic:
|
||||
return NotImplemented
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.id)
|
||||
return hash((self.__class__.__name__, self.id))
|
||||
|
||||
|
||||
WEBSOCKET_TOPICS: Dict[str, str] = {
|
||||
|
||||
@@ -39,7 +39,7 @@ class Game:
|
||||
return NotImplemented
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return self.id
|
||||
return hash((self.__class__.__name__, self.id))
|
||||
|
||||
|
||||
class BaseDrop:
|
||||
|
||||
Reference in New Issue
Block a user