2022-06-06 02:58:53 +02:00
|
|
|
""" StandingsList class """
|
|
|
|
|
2022-06-01 15:31:52 +02:00
|
|
|
from dataclasses import dataclass
|
2022-06-06 02:58:53 +02:00
|
|
|
|
2022-06-01 15:31:52 +02:00
|
|
|
from ergast_py.models.constructor_standing import ConstructorStanding
|
2022-06-06 02:58:53 +02:00
|
|
|
from ergast_py.models.driver_standing import DriverStanding
|
|
|
|
|
2022-06-01 15:31:52 +02:00
|
|
|
|
|
|
|
@dataclass
|
2022-06-06 13:20:48 +02:00
|
|
|
class StandingsList():
|
2022-06-01 15:31:52 +02:00
|
|
|
"""
|
|
|
|
Representation of a set of Standings from a time in Formula One
|
2022-06-06 02:58:53 +02:00
|
|
|
|
2022-06-01 15:31:52 +02:00
|
|
|
StandingsLists may contain:
|
|
|
|
season: Integer
|
2022-06-06 02:58:53 +02:00
|
|
|
round_no: Integer
|
|
|
|
driver_standings: DriverStanding[]
|
|
|
|
constructor_standings: ConstructorStanding[]
|
2022-06-01 15:31:52 +02:00
|
|
|
"""
|
|
|
|
|
2022-06-06 02:58:53 +02:00
|
|
|
def __init__(self, season: int, round_no: int, driver_standings: list[DriverStanding],
|
|
|
|
constructor_standings: list[ConstructorStanding]) -> None:
|
2022-06-01 15:31:52 +02:00
|
|
|
self.season = season
|
2022-06-06 02:58:53 +02:00
|
|
|
self.round_no = round_no
|
|
|
|
self.driver_standings = driver_standings
|
|
|
|
self.constructor_standings = constructor_standings
|
2022-06-06 13:20:48 +02:00
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
|
|
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
|
|
|
return f"{type(self).__name__}({members})"
|
2022-06-10 00:19:28 +02:00
|
|
|
|
|
|
|
def __eq__(self, __o: object) -> bool:
|
|
|
|
return isinstance(__o, StandingsList) and (
|
|
|
|
self.season == __o.season and
|
|
|
|
self.round_no == __o.round_no and
|
|
|
|
self.driver_standings == __o.driver_standings and
|
|
|
|
self.constructor_standings == __o.constructor_standings
|
|
|
|
)
|