Removed Model base class
This commit is contained in:
parent
b7ac2131f4
commit
0ecadd1bc7
@ -2,11 +2,9 @@
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class AverageSpeed(Model):
|
||||
class AverageSpeed():
|
||||
"""
|
||||
Representation of a Drivers Average Speed
|
||||
|
||||
@ -18,3 +16,7 @@ class AverageSpeed(Model):
|
||||
def __init__(self, units: str, speed: float) -> None:
|
||||
self.units = units
|
||||
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 ergast_py.models.location import Location
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Circuit(Model):
|
||||
class Circuit():
|
||||
"""
|
||||
Representation of a Formula One Circuit
|
||||
|
||||
@ -23,3 +22,7 @@ class Circuit(Model):
|
||||
self.url = url
|
||||
self.circuit_name = circuit_name
|
||||
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 ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Constructor(Model):
|
||||
class Constructor():
|
||||
"""
|
||||
Representation of a Formula One Team
|
||||
|
||||
@ -22,3 +20,7 @@ class Constructor(Model):
|
||||
self.url = url
|
||||
self.name = name
|
||||
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 ergast_py.models.constructor import Constructor
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class ConstructorStanding(Model):
|
||||
class ConstructorStanding():
|
||||
"""
|
||||
Representation of a Formula One Constructor's standing in a Season
|
||||
|
||||
@ -26,3 +25,7 @@ class ConstructorStanding(Model):
|
||||
self.points = points
|
||||
self.wins = wins
|
||||
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
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Driver(Model):
|
||||
class Driver():
|
||||
"""
|
||||
Representation of a Formula One driver
|
||||
|
||||
@ -32,3 +30,7 @@ class Driver(Model):
|
||||
self.family_name = family_name
|
||||
self.date_of_birth = date_of_birth
|
||||
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.driver import Driver
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class DriverStanding(Model):
|
||||
class DriverStanding():
|
||||
"""
|
||||
Representation of a Formula One Driver's standing in a Season
|
||||
|
||||
@ -29,3 +28,7 @@ class DriverStanding(Model):
|
||||
self.wins = wins
|
||||
self.driver = driver
|
||||
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 ergast_py.models.average_speed import AverageSpeed
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class FastestLap(Model):
|
||||
class FastestLap():
|
||||
"""
|
||||
Representation of a Fastest Lap for a Formula One Driver
|
||||
|
||||
@ -25,3 +24,7 @@ class FastestLap(Model):
|
||||
self.lap = lap
|
||||
self.time = time
|
||||
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 ergast_py.models.model import Model
|
||||
from ergast_py.models.timing import Timing
|
||||
|
||||
|
||||
@dataclass
|
||||
class Lap(Model):
|
||||
class Lap():
|
||||
"""
|
||||
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:
|
||||
self.number = number
|
||||
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 ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Location(Model):
|
||||
class Location():
|
||||
"""
|
||||
Representation of a Location for a Formula One Circuit
|
||||
|
||||
@ -22,3 +20,7 @@ class Location(Model):
|
||||
self.longitude = longitude
|
||||
self.locality = locality
|
||||
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
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class PitStop(Model):
|
||||
class PitStop():
|
||||
"""
|
||||
Representation of a single Pit Stop from a Formula One race
|
||||
|
||||
@ -26,3 +24,7 @@ class PitStop(Model):
|
||||
self.stop = stop
|
||||
self.local_time = local_time
|
||||
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.lap import Lap
|
||||
from ergast_py.models.model import Model
|
||||
from ergast_py.models.pit_stop import PitStop
|
||||
from ergast_py.models.result import Result
|
||||
|
||||
|
||||
@dataclass
|
||||
class Race(Model):
|
||||
class Race():
|
||||
"""
|
||||
Representation of a single Race from a Formula One season
|
||||
|
||||
@ -56,3 +55,7 @@ class Race(Model):
|
||||
self.qualifying_results = qualifying_results
|
||||
self.pit_stops = pit_stops
|
||||
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.driver import Driver
|
||||
from ergast_py.models.fastest_lap import FastestLap
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Result(Model):
|
||||
class Result():
|
||||
"""
|
||||
Representation of a single Result from a Formula One race
|
||||
|
||||
@ -49,3 +48,7 @@ class Result(Model):
|
||||
self.qual_1 = qual_1
|
||||
self.qual_2 = qual_2
|
||||
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 ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Season(Model):
|
||||
class Season():
|
||||
"""
|
||||
Representation of a single Season in Formula One
|
||||
|
||||
@ -18,3 +16,7 @@ class Season(Model):
|
||||
def __init__(self, season: int, url: str) -> None:
|
||||
self.season = season
|
||||
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.driver_standing import DriverStanding
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class StandingsList(Model):
|
||||
class StandingsList():
|
||||
"""
|
||||
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.driver_standings = driver_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 ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Status(Model):
|
||||
class Status():
|
||||
"""
|
||||
Representation of the finishing status of a Driver in a Race
|
||||
|
||||
@ -20,3 +18,7 @@ class Status(Model):
|
||||
self.status_id = status_id
|
||||
self.count = count
|
||||
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
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ergast_py.models.model import Model
|
||||
|
||||
|
||||
@dataclass
|
||||
class Timing(Model):
|
||||
class Timing():
|
||||
"""
|
||||
Representation of a single timing from a lap in Formula One
|
||||
Timings may contain:
|
||||
@ -20,3 +18,7 @@ class Timing(Model):
|
||||
self.driver_id = driver_id
|
||||
self.position = position
|
||||
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 pytest
|
||||
|
||||
import tests.test_constants as test_constants
|
||||
|
||||
|
||||
class TestRequester():
|
||||
"""
|
||||
Tests for the Requester class
|
||||
|
Reference in New Issue
Block a user