Removed Model base class
This commit is contained in:
parent
b7ac2131f4
commit
0ecadd1bc7
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class AverageSpeed(Model):
|
class AverageSpeed():
|
||||||
"""
|
"""
|
||||||
Representation of a Drivers Average Speed
|
Representation of a Drivers Average Speed
|
||||||
|
|
||||||
@ -18,3 +16,7 @@ class AverageSpeed(Model):
|
|||||||
def __init__(self, units: str, speed: float) -> None:
|
def __init__(self, units: str, speed: float) -> None:
|
||||||
self.units = units
|
self.units = units
|
||||||
self.speed = speed
|
self.speed = speed
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.location import Location
|
from ergast_py.models.location import Location
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Circuit(Model):
|
class Circuit():
|
||||||
"""
|
"""
|
||||||
Representation of a Formula One Circuit
|
Representation of a Formula One Circuit
|
||||||
|
|
||||||
@ -23,3 +22,7 @@ class Circuit(Model):
|
|||||||
self.url = url
|
self.url = url
|
||||||
self.circuit_name = circuit_name
|
self.circuit_name = circuit_name
|
||||||
self.location = location
|
self.location = location
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Constructor(Model):
|
class Constructor():
|
||||||
"""
|
"""
|
||||||
Representation of a Formula One Team
|
Representation of a Formula One Team
|
||||||
|
|
||||||
@ -22,3 +20,7 @@ class Constructor(Model):
|
|||||||
self.url = url
|
self.url = url
|
||||||
self.name = name
|
self.name = name
|
||||||
self.nationality = nationality
|
self.nationality = nationality
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.constructor import Constructor
|
from ergast_py.models.constructor import Constructor
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ConstructorStanding(Model):
|
class ConstructorStanding():
|
||||||
"""
|
"""
|
||||||
Representation of a Formula One Constructor's standing in a Season
|
Representation of a Formula One Constructor's standing in a Season
|
||||||
|
|
||||||
@ -26,3 +25,7 @@ class ConstructorStanding(Model):
|
|||||||
self.points = points
|
self.points = points
|
||||||
self.wins = wins
|
self.wins = wins
|
||||||
self.constructor = constructor
|
self.constructor = constructor
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Driver(Model):
|
class Driver():
|
||||||
"""
|
"""
|
||||||
Representation of a Formula One driver
|
Representation of a Formula One driver
|
||||||
|
|
||||||
@ -32,3 +30,7 @@ class Driver(Model):
|
|||||||
self.family_name = family_name
|
self.family_name = family_name
|
||||||
self.date_of_birth = date_of_birth
|
self.date_of_birth = date_of_birth
|
||||||
self.nationality = nationality
|
self.nationality = nationality
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -4,11 +4,10 @@ from dataclasses import dataclass
|
|||||||
|
|
||||||
from ergast_py.models.constructor import Constructor
|
from ergast_py.models.constructor import Constructor
|
||||||
from ergast_py.models.driver import Driver
|
from ergast_py.models.driver import Driver
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class DriverStanding(Model):
|
class DriverStanding():
|
||||||
"""
|
"""
|
||||||
Representation of a Formula One Driver's standing in a Season
|
Representation of a Formula One Driver's standing in a Season
|
||||||
|
|
||||||
@ -29,3 +28,7 @@ class DriverStanding(Model):
|
|||||||
self.wins = wins
|
self.wins = wins
|
||||||
self.driver = driver
|
self.driver = driver
|
||||||
self.constructors = constructors
|
self.constructors = constructors
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -4,11 +4,10 @@ import datetime
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.average_speed import AverageSpeed
|
from ergast_py.models.average_speed import AverageSpeed
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class FastestLap(Model):
|
class FastestLap():
|
||||||
"""
|
"""
|
||||||
Representation of a Fastest Lap for a Formula One Driver
|
Representation of a Fastest Lap for a Formula One Driver
|
||||||
|
|
||||||
@ -25,3 +24,7 @@ class FastestLap(Model):
|
|||||||
self.lap = lap
|
self.lap = lap
|
||||||
self.time = time
|
self.time = time
|
||||||
self.average_speed = average_speed
|
self.average_speed = average_speed
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
from ergast_py.models.timing import Timing
|
from ergast_py.models.timing import Timing
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Lap(Model):
|
class Lap():
|
||||||
"""
|
"""
|
||||||
Representation of a single Lap from a Formula One race
|
Representation of a single Lap from a Formula One race
|
||||||
|
|
||||||
@ -19,3 +18,7 @@ class Lap(Model):
|
|||||||
def __init__(self, number: int, timings: list[Timing]) -> None:
|
def __init__(self, number: int, timings: list[Timing]) -> None:
|
||||||
self.number = number
|
self.number = number
|
||||||
self.timings = timings
|
self.timings = timings
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Location(Model):
|
class Location():
|
||||||
"""
|
"""
|
||||||
Representation of a Location for a Formula One Circuit
|
Representation of a Location for a Formula One Circuit
|
||||||
|
|
||||||
@ -22,3 +20,7 @@ class Location(Model):
|
|||||||
self.longitude = longitude
|
self.longitude = longitude
|
||||||
self.locality = locality
|
self.locality = locality
|
||||||
self.country = country
|
self.country = country
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
""" Model class """
|
|
||||||
|
|
||||||
class Model():
|
|
||||||
"""
|
|
||||||
Base class for Models within Ergast-py
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
|
||||||
return f"{type(self).__name__}({members})"
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
|
||||||
return f"{type(self).__name__}({members})"
|
|
@ -3,11 +3,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class PitStop(Model):
|
class PitStop():
|
||||||
"""
|
"""
|
||||||
Representation of a single Pit Stop from a Formula One race
|
Representation of a single Pit Stop from a Formula One race
|
||||||
|
|
||||||
@ -26,3 +24,7 @@ class PitStop(Model):
|
|||||||
self.stop = stop
|
self.stop = stop
|
||||||
self.local_time = local_time
|
self.local_time = local_time
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -5,13 +5,12 @@ from dataclasses import dataclass
|
|||||||
|
|
||||||
from ergast_py.models.circuit import Circuit
|
from ergast_py.models.circuit import Circuit
|
||||||
from ergast_py.models.lap import Lap
|
from ergast_py.models.lap import Lap
|
||||||
from ergast_py.models.model import Model
|
|
||||||
from ergast_py.models.pit_stop import PitStop
|
from ergast_py.models.pit_stop import PitStop
|
||||||
from ergast_py.models.result import Result
|
from ergast_py.models.result import Result
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Race(Model):
|
class Race():
|
||||||
"""
|
"""
|
||||||
Representation of a single Race from a Formula One season
|
Representation of a single Race from a Formula One season
|
||||||
|
|
||||||
@ -56,3 +55,7 @@ class Race(Model):
|
|||||||
self.qualifying_results = qualifying_results
|
self.qualifying_results = qualifying_results
|
||||||
self.pit_stops = pit_stops
|
self.pit_stops = pit_stops
|
||||||
self.laps = laps
|
self.laps = laps
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -6,11 +6,10 @@ from dataclasses import dataclass
|
|||||||
from ergast_py.models.constructor import Constructor
|
from ergast_py.models.constructor import Constructor
|
||||||
from ergast_py.models.driver import Driver
|
from ergast_py.models.driver import Driver
|
||||||
from ergast_py.models.fastest_lap import FastestLap
|
from ergast_py.models.fastest_lap import FastestLap
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Result(Model):
|
class Result():
|
||||||
"""
|
"""
|
||||||
Representation of a single Result from a Formula One race
|
Representation of a single Result from a Formula One race
|
||||||
|
|
||||||
@ -49,3 +48,7 @@ class Result(Model):
|
|||||||
self.qual_1 = qual_1
|
self.qual_1 = qual_1
|
||||||
self.qual_2 = qual_2
|
self.qual_2 = qual_2
|
||||||
self.qual_3 = qual_3
|
self.qual_3 = qual_3
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Season(Model):
|
class Season():
|
||||||
"""
|
"""
|
||||||
Representation of a single Season in Formula One
|
Representation of a single Season in Formula One
|
||||||
|
|
||||||
@ -18,3 +16,7 @@ class Season(Model):
|
|||||||
def __init__(self, season: int, url: str) -> None:
|
def __init__(self, season: int, url: str) -> None:
|
||||||
self.season = season
|
self.season = season
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -4,11 +4,10 @@ from dataclasses import dataclass
|
|||||||
|
|
||||||
from ergast_py.models.constructor_standing import ConstructorStanding
|
from ergast_py.models.constructor_standing import ConstructorStanding
|
||||||
from ergast_py.models.driver_standing import DriverStanding
|
from ergast_py.models.driver_standing import DriverStanding
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class StandingsList(Model):
|
class StandingsList():
|
||||||
"""
|
"""
|
||||||
Representation of a set of Standings from a time in Formula One
|
Representation of a set of Standings from a time in Formula One
|
||||||
|
|
||||||
@ -25,3 +24,7 @@ class StandingsList(Model):
|
|||||||
self.round_no = round_no
|
self.round_no = round_no
|
||||||
self.driver_standings = driver_standings
|
self.driver_standings = driver_standings
|
||||||
self.constructor_standings = constructor_standings
|
self.constructor_standings = constructor_standings
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Status(Model):
|
class Status():
|
||||||
"""
|
"""
|
||||||
Representation of the finishing status of a Driver in a Race
|
Representation of the finishing status of a Driver in a Race
|
||||||
|
|
||||||
@ -20,3 +18,7 @@ class Status(Model):
|
|||||||
self.status_id = status_id
|
self.status_id = status_id
|
||||||
self.count = count
|
self.count = count
|
||||||
self.status = status
|
self.status = status
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ergast_py.models.model import Model
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Timing(Model):
|
class Timing():
|
||||||
"""
|
"""
|
||||||
Representation of a single timing from a lap in Formula One
|
Representation of a single timing from a lap in Formula One
|
||||||
Timings may contain:
|
Timings may contain:
|
||||||
@ -20,3 +18,7 @@ class Timing(Model):
|
|||||||
self.driver_id = driver_id
|
self.driver_id = driver_id
|
||||||
self.position = position
|
self.position = position
|
||||||
self.time = time
|
self.time = time
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
members = ', '.join(f"{key}={value}" for key, value in self.__dict__.items())
|
||||||
|
return f"{type(self).__name__}({members})"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import ergast_py
|
import ergast_py
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import tests.test_constants as test_constants
|
import tests.test_constants as test_constants
|
||||||
|
|
||||||
|
|
||||||
class TestRequester():
|
class TestRequester():
|
||||||
"""
|
"""
|
||||||
Tests for the Requester class
|
Tests for the Requester class
|
||||||
|
Reference in New Issue
Block a user