mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-06-08 05:14:35 +00:00
Use slots where possible for a marginal memory save
This commit is contained in:
@@ -21,6 +21,8 @@ logger = logging.getLogger("TwitchDrops")
|
||||
|
||||
|
||||
class Stream:
|
||||
__slots__ = ("channel", "broadcast_id", "viewers", "drops_enabled", "game", "title")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
channel: Channel,
|
||||
@@ -180,7 +182,7 @@ class Channel:
|
||||
|
||||
@property
|
||||
def game(self) -> Game | None:
|
||||
if self._stream is not None and self._stream.game is not None:
|
||||
if self._stream is not None:
|
||||
return self._stream.game
|
||||
return None
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ def remove_dimensions(url: URLType) -> URLType:
|
||||
|
||||
|
||||
class Benefit:
|
||||
__slots__ = ("id", "name", "image_url")
|
||||
|
||||
def __init__(self, data: JsonType):
|
||||
benefit_data: JsonType = data["benefit"]
|
||||
self.id: str = benefit_data["id"]
|
||||
|
||||
Reference in New Issue
Block a user