This repository has been archived on 2022-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
ergast-py/ergast_py/models/driver.py
2022-06-01 14:31:52 +01:00

37 lines
1.4 KiB
Python

from dataclasses import dataclass
from ergast_py.helpers import Helpers
import datetime
@dataclass
class Driver:
"""
Representation of a Formula One driver
Drivers may contain:
driverId: String
permanentNumber: Integer
code: String
url: String
givenName: String
familyName: String
dateOfBirth: datetime.date
nationality: String
"""
def __init__(self, driverId: str, code: str, url: str, givenName: str, familyName: str, dateOfBirth: datetime.date,
nationality: str, permanentNumber: int) -> None:
self.driverId = driverId
self.permanentNumber = permanentNumber
self.code = code
self.url = url
self.givenName = givenName
self.familyName = familyName
self.dateOfBirth = dateOfBirth
self.nationality = nationality
pass
def __str__(self):
return f"Driver(driverId={self.driverId}, permanentNumber={self.permanentNumber}, code={self.code}, url={self.url}, givenName={self.givenName}, familyName={self.familyName}, dateOfBirth={self.dateOfBirth}, nationality={self.nationality})"
def __repr__(self):
return f"Driver(driverId={self.driverId}, permanentNumber={self.permanentNumber}, code={self.code}, url={self.url}, givenName={self.givenName}, familyName={self.familyName}, dateOfBirth={self.dateOfBirth}, nationality={self.nationality})"