cleanup
This commit is contained in:
63
cah_ext/constructors.py
Normal file
63
cah_ext/constructors.py
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3.12
|
||||
|
||||
class CAHClient:
|
||||
"""CAH Client Constructor"""
|
||||
def __init__(self,
|
||||
resource: str,
|
||||
platform: str,
|
||||
csid: str,
|
||||
connected_at: int,
|
||||
players: list,
|
||||
games: list):
|
||||
self.resource: str = resource
|
||||
self.platform: str = platform
|
||||
self.csid: str = csid
|
||||
self.connected_at: int = connected_at
|
||||
self.players: list = players
|
||||
self.games: list = games
|
||||
|
||||
def __iter__(self):
|
||||
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()
|
||||
|
||||
class CAHGame:
|
||||
"""CAH Game Constructor"""
|
||||
def __init__(self,
|
||||
_id: str,
|
||||
rounds: int,
|
||||
resources: list[dict],
|
||||
players: list[dict],
|
||||
created_at: int,
|
||||
state: int,
|
||||
started_at: int,
|
||||
state_changed_at: int,
|
||||
):
|
||||
self.id: str = id
|
||||
self.rounds: int = rounds
|
||||
self.resources: list[dict] = resources
|
||||
self.players: list[dict] = players
|
||||
self.created_at: int = created_at
|
||||
self.state: int = state
|
||||
self.started_at: int = started_at
|
||||
self.state_changed_at: int = state_changed_at
|
||||
|
||||
def __iter__(self):
|
||||
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()
|
||||
|
||||
class CAHPlayer:
|
||||
"""CAH Player Constructor"""
|
||||
def __init__(self,
|
||||
_id: str,
|
||||
current_game: CAHGame,
|
||||
platform: str,
|
||||
related_resource: str,
|
||||
joined_at: str,
|
||||
handle: str):
|
||||
self.id = id
|
||||
self.current_game = current_game
|
||||
self.platform = platform
|
||||
self.related_resource = related_resource
|
||||
self.joined_at = joined_at
|
||||
self.handle = handle
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user