├── tests ├── __init__.py ├── test_ergast_py.py ├── test_ergast.py ├── constants.py ├── test_requester.py └── test_type_constructor.py ├── ergast_py ├── models │ ├── __init__.py │ ├── season.py │ ├── average_speed.py │ ├── time.py │ ├── lap.py │ ├── status.py │ ├── timing.py │ ├── constructor.py │ ├── location.py │ ├── circuit.py │ ├── pit_stop.py │ ├── base_model.py │ ├── fastest_lap.py │ ├── constructor_standing.py │ ├── driver.py │ ├── driver_standing.py │ ├── standings_list.py │ ├── result.py │ └── race.py ├── constants │ ├── __init__.py │ ├── expected.py │ └── status_type.py ├── __init__.py ├── helpers.py ├── requester.py ├── ergast.py └── type_constructor.py ├── utils └── status-action │ ├── requirements.txt │ ├── check_statuses.py │ └── current_statuses.json ├── .gitignore ├── img └── carbon.png ├── .pylintrc ├── .github ├── workflows │ ├── pytest.yml │ ├── black.yml │ └── statuses.yml └── ISSUE_TEMPLATE │ ├── update-statuses.md │ ├── feature-request.md │ └── bug-report.md ├── pyproject.toml ├── .pre-commit-config.yaml ├── README.md ├── LICENSE.md └── poetry.lock /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ergast_py/models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ergast_py/constants/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utils/status-action/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.31.0 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | __pycache__ 3 | .pytest_cache 4 | dist 5 | .vscode 6 | -------------------------------------------------------------------------------- /img/carbon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Samuel-Roach/ergast-py/HEAD/img/carbon.png -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | disable=too-many-instance-attributes, 4 | too-many-arguments, 5 | too-many-locals 6 | -------------------------------------------------------------------------------- /ergast_py/models/season.py: -------------------------------------------------------------------------------- 1 | """ Season class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | 6 | 7 | @dataclass 8 | class Season(BaseModel): 9 | """ 10 | Representation of a single Season in Formula One 11 | 12 | Seasons may contain: 13 | season: Integer 14 | url: String 15 | """ 16 | 17 | season: int 18 | url: str 19 | -------------------------------------------------------------------------------- /tests/test_ergast_py.py: -------------------------------------------------------------------------------- 1 | """ Tests for Ergast Py """ 2 | from ergast_py import __version__ 3 | 4 | 5 | class TestErgastPy: 6 | """ 7 | Tests for the Ergast-py package 8 | """ 9 | 10 | def test_version(self): 11 | """Assert the version of the system""" 12 | assert __version__ == "0.7.0" 13 | 14 | def test_ergast(self): 15 | """Basic test to check Ergast functions""" 16 | pass 17 | -------------------------------------------------------------------------------- /ergast_py/models/average_speed.py: -------------------------------------------------------------------------------- 1 | """ AverageSpeed class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | 6 | 7 | @dataclass 8 | class AverageSpeed(BaseModel): 9 | """ 10 | Representation of a Drivers Average Speed 11 | 12 | Average Speeds may contain: 13 | units: String 14 | speed: Float 15 | """ 16 | 17 | units: str 18 | speed: float 19 | -------------------------------------------------------------------------------- /ergast_py/models/time.py: -------------------------------------------------------------------------------- 1 | """ Time class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | 7 | 8 | @dataclass 9 | class Time(BaseModel): 10 | """ 11 | Representation of a Finishing Time in a Race for a Formula One Driver 12 | 13 | Time may contain: 14 | millis: datetime.time 15 | time: String 16 | """ 17 | 18 | millis: datetime.time 19 | time: str 20 | -------------------------------------------------------------------------------- /ergast_py/models/lap.py: -------------------------------------------------------------------------------- 1 | """ Lap class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | from ergast_py.models.timing import Timing 6 | 7 | 8 | @dataclass 9 | class Lap(BaseModel): 10 | """ 11 | Representation of a single Lap from a Formula One race 12 | 13 | Laps may contain: 14 | number: Integer 15 | timings: Timing[] 16 | """ 17 | 18 | number: int 19 | timings: list[Timing] 20 | -------------------------------------------------------------------------------- /ergast_py/models/status.py: -------------------------------------------------------------------------------- 1 | """ Status class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | 6 | 7 | @dataclass 8 | class Status(BaseModel): 9 | """ 10 | Representation of the finishing status of a Driver in a Race 11 | 12 | Statuses may contain: 13 | status_id: Integer 14 | count: Integer 15 | status: String 16 | """ 17 | 18 | status_id: int 19 | count: int 20 | status: str 21 | -------------------------------------------------------------------------------- /.github/workflows/pytest.yml: -------------------------------------------------------------------------------- 1 | name: Pytest 2 | 3 | on: 4 | push: 5 | branches: [ master, develop ] 6 | pull_request: 7 | branches: [ master, develop ] 8 | jobs: 9 | pytest: 10 | name: Pytest 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-python@v4 16 | with: 17 | python-version: '3.9' 18 | - uses: snok/install-poetry@v1 19 | - run: | 20 | poetry install 21 | poetry run pytest 22 | -------------------------------------------------------------------------------- /.github/workflows/black.yml: -------------------------------------------------------------------------------- 1 | name: Black 2 | 3 | on: 4 | push: 5 | branches: [ master, develop ] 6 | pull_request: 7 | branches: [ master, develop ] 8 | jobs: 9 | black: 10 | name: Black 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-python@v4 16 | with: 17 | python-version: '3.9' 18 | - uses: snok/install-poetry@v1 19 | - run: | 20 | poetry install 21 | poetry run python -m black --check . 22 | -------------------------------------------------------------------------------- /ergast_py/models/timing.py: -------------------------------------------------------------------------------- 1 | """ Timing class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | 7 | 8 | @dataclass 9 | class Timing(BaseModel): 10 | """ 11 | Representation of a single timing from a lap in Formula One 12 | Timings may contain: 13 | driver_id: String 14 | position: Integer 15 | time: datetime.time 16 | """ 17 | 18 | driver_id: str 19 | position: int 20 | time: datetime.time 21 | -------------------------------------------------------------------------------- /ergast_py/models/constructor.py: -------------------------------------------------------------------------------- 1 | """ Constructor class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | 6 | 7 | @dataclass 8 | class Constructor(BaseModel): 9 | """ 10 | Representation of a Formula One Team 11 | 12 | Constructors may contain: 13 | constructor_id: String 14 | url: String 15 | name: String 16 | nationality: String 17 | """ 18 | 19 | constructor_id: str 20 | url: str 21 | name: str 22 | nationality: str 23 | -------------------------------------------------------------------------------- /ergast_py/models/location.py: -------------------------------------------------------------------------------- 1 | """ Location class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | 6 | 7 | @dataclass 8 | class Location(BaseModel): 9 | """ 10 | Representation of a Location for a Formula One Circuit 11 | 12 | Locations may contain: 13 | lat: Float 14 | long: Float 15 | locality: String 16 | country: String 17 | """ 18 | 19 | latitude: float 20 | longitude: float 21 | locality: str 22 | country: str 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/update-statuses.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Update Statuses 3 | about: Request that the statuses be updated within ergast-py 4 | title: "[ENHANCEMENT] Update finishing statuses" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Information** 11 | The following statuses have been identified as missing from Ergast-py and therefore need adding: 12 | {{ env.MISSING_STATUSES_FORMATTED }} 13 | 14 | Please ensure you update the following files: 15 | - `./ergast_py/constants/status_type.py` 16 | - `./utils/status-action/current_statuses.json` 17 | -------------------------------------------------------------------------------- /ergast_py/models/circuit.py: -------------------------------------------------------------------------------- 1 | """ Circuit class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | from ergast_py.models.location import Location 6 | 7 | 8 | @dataclass 9 | class Circuit(BaseModel): 10 | """ 11 | Representation of a Formula One Circuit 12 | 13 | Circuits may contain: 14 | circuit_id: String 15 | url: String 16 | circuit_name: String 17 | location: Location 18 | """ 19 | 20 | circuit_id: str 21 | url: str 22 | circuit_name: str 23 | location: Location 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for improving ergast-py 4 | title: "[FEATURE] Feature title" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe in detail the feature you want** 11 | A clear and concise description of what you want to be implemented within ergast-py 12 | 13 | **Reasoning** 14 | A small explanation as to why you think this feature would be useful for addition into the project. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /ergast_py/models/pit_stop.py: -------------------------------------------------------------------------------- 1 | """ PitStop class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | 7 | 8 | @dataclass 9 | class PitStop(BaseModel): 10 | """ 11 | Representation of a single Pit Stop from a Formula One race 12 | 13 | PitStops may contain: 14 | driver_id: String 15 | lap: Integer 16 | stop: Integer 17 | local_time: datetime.time 18 | duration: datetime.time 19 | """ 20 | 21 | driver_id: str 22 | lap: int 23 | stop: int 24 | local_time: datetime.time 25 | duration: datetime.time 26 | -------------------------------------------------------------------------------- /ergast_py/models/base_model.py: -------------------------------------------------------------------------------- 1 | """ Base model class """ 2 | 3 | 4 | class BaseModel: 5 | def __repr__(self) -> str: 6 | attrs = ", ".join(f"{key}={value}" for key, value in vars(self).items()) 7 | return f"{type(self).__name__}({attrs})" 8 | 9 | def __eq__(self, __o: object) -> bool: 10 | return isinstance(__o, type(self)) and all( 11 | getattr(self, key) == getattr(__o, key) for key in vars(self) 12 | ) 13 | 14 | def __str__(self) -> str: 15 | attrs = "\n\t".join(f"{key}: {value}" for key, value in vars(self).items()) 16 | return f"{type(self).__name__} (\n\t{attrs}\n)" 17 | -------------------------------------------------------------------------------- /ergast_py/models/fastest_lap.py: -------------------------------------------------------------------------------- 1 | """ FastestLap class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.average_speed import AverageSpeed 6 | from ergast_py.models.base_model import BaseModel 7 | 8 | 9 | @dataclass 10 | class FastestLap(BaseModel): 11 | """ 12 | Representation of a Fastest Lap for a Formula One Driver 13 | 14 | Fastest Laps may contain: 15 | rank: Integer 16 | lap: Integer 17 | time: datetime.time 18 | average_speed: AverageSpeed 19 | """ 20 | 21 | rank: int 22 | lap: int 23 | time: datetime.time 24 | average_speed: AverageSpeed 25 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "ergast-py" 3 | version = "1.1.0" 4 | description = "A comprehensive Python wrapper for the Ergast API." 5 | authors = ["Samuel Roach "] 6 | repository = "https://github.com/Samuel-Roach/ergast-py" 7 | license = "GPL-3.0-only" 8 | readme = "README.md" 9 | 10 | [tool.poetry.dependencies] 11 | python = "^3.9" 12 | requests = "^2.28.2" 13 | uritemplate = "^4.1.1" 14 | pytz = "^2022.5" 15 | 16 | [tool.poetry.group.dev.dependencies] 17 | pytest = "^7.2.1" 18 | black = "^23.1.0" 19 | reorder-python-imports = "^3.9.0" 20 | pre-commit = "^3.0.4" 21 | 22 | [build-system] 23 | requires = ["poetry-core>=1.2.0"] 24 | build-backend = "poetry.core.masonry.api" 25 | -------------------------------------------------------------------------------- /ergast_py/models/constructor_standing.py: -------------------------------------------------------------------------------- 1 | """ ConstructorStanding class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | from ergast_py.models.constructor import Constructor 6 | 7 | 8 | @dataclass 9 | class ConstructorStanding(BaseModel): 10 | """ 11 | Representation of a Formula One Constructor's standing in a Season 12 | 13 | Constructor Standings may contain: 14 | position: Integer 15 | position_text: String 16 | points: Float 17 | wins: Integer 18 | constructor: Constructor 19 | """ 20 | 21 | position: int 22 | position_text: str 23 | points: float 24 | wins: int 25 | constructor: Constructor 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report an issue to help improve ergast-py 4 | title: "[BUG] Bug title" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | ```python 16 | # Include an example snippet of code to reproduce where applicable 17 | ``` 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **Additional context** 26 | Any other info, such as the version of ergast-py this was seen on would be useful to help fix the bug. 27 | -------------------------------------------------------------------------------- /ergast_py/models/driver.py: -------------------------------------------------------------------------------- 1 | """ Driver class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | 7 | 8 | @dataclass 9 | class Driver(BaseModel): 10 | """ 11 | Representation of a Formula One driver 12 | 13 | Drivers may contain: 14 | driver_id: String 15 | permanent_number: Integer 16 | code: String 17 | url: String 18 | given_name: String 19 | family_name: String 20 | date_of_birth: datetime.date 21 | nationality: String 22 | """ 23 | 24 | driver_id: str 25 | code: str 26 | url: str 27 | given_name: str 28 | family_name: str 29 | date_of_birth: datetime.date 30 | nationality: str 31 | permanent_number: int 32 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.4.0 4 | hooks: 5 | - id: check-yaml 6 | - id: end-of-file-fixer 7 | - id: trailing-whitespace 8 | - id: check-merge-conflict 9 | - id: check-toml 10 | - id: mixed-line-ending 11 | - id: check-ast 12 | - id: check-added-large-files 13 | - id: check-case-conflict 14 | - id: detect-private-key 15 | - id: no-commit-to-branch 16 | - repo: https://github.com/psf/black 17 | rev: 23.1.0 18 | hooks: 19 | - id: black 20 | - repo: https://github.com/asottile/reorder_python_imports 21 | rev: v3.9.0 22 | hooks: 23 | - id: reorder-python-imports 24 | -------------------------------------------------------------------------------- /ergast_py/models/driver_standing.py: -------------------------------------------------------------------------------- 1 | """ DriverStanding class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | from ergast_py.models.constructor import Constructor 6 | from ergast_py.models.driver import Driver 7 | 8 | 9 | @dataclass 10 | class DriverStanding(BaseModel): 11 | """ 12 | Representation of a Formula One Driver's standing in a Season 13 | 14 | Driver Standings may contain: 15 | position: Integer 16 | position_text: String 17 | points: Float 18 | wins: Integer 19 | driver: Driver 20 | constructors: Constructor[] 21 | """ 22 | 23 | position: int 24 | position_text: str 25 | points: float 26 | wins: int 27 | driver: Driver 28 | constructors: list[Constructor] 29 | -------------------------------------------------------------------------------- /ergast_py/models/standings_list.py: -------------------------------------------------------------------------------- 1 | """ StandingsList class """ 2 | from dataclasses import dataclass 3 | 4 | from ergast_py.models.base_model import BaseModel 5 | from ergast_py.models.constructor_standing import ConstructorStanding 6 | from ergast_py.models.driver_standing import DriverStanding 7 | 8 | 9 | @dataclass 10 | class StandingsList(BaseModel): 11 | """ 12 | Representation of a set of Standings from a time in Formula One 13 | 14 | StandingsLists may contain: 15 | season: Integer 16 | round_no: Integer 17 | driver_standings: DriverStanding[] 18 | constructor_standings: ConstructorStanding[] 19 | """ 20 | 21 | season: int 22 | round_no: int 23 | driver_standings: list[DriverStanding] 24 | constructor_standings: list[ConstructorStanding] 25 | -------------------------------------------------------------------------------- /.github/workflows/statuses.yml: -------------------------------------------------------------------------------- 1 | name: Statuses 2 | 3 | on: 4 | schedule: 5 | - cron: '0 17 * * 0' 6 | workflow_dispatch: 7 | jobs: 8 | statuses: 9 | name: Statuses 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: actions/setup-python@v4 15 | with: 16 | python-version: '3.9' 17 | - id: install-requirements 18 | run: python -m pip install -r ./utils/status-action/requirements.txt 19 | - id: run-check-statuses 20 | run: python ./utils/status-action/check_statuses.py 21 | - uses: JasonEtco/create-an-issue@v2 22 | if: ${{ steps.run-check-statuses.outputs.MISSING_STATUSES_COUNT > 0 }} 23 | env: 24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 | with: 26 | filename: .github/ISSUE_TEMPLATE/update-statuses.md 27 | -------------------------------------------------------------------------------- /tests/test_ergast.py: -------------------------------------------------------------------------------- 1 | """ Tests for the Ergast class """ 2 | import ergast_py 3 | 4 | 5 | class TestErgast: 6 | """ 7 | Tests for the Ergast class 8 | """ 9 | 10 | e = ergast_py.Ergast() 11 | 12 | def test_paging(self): 13 | """Assert that paging changes the results pages""" 14 | hamilton = self.e.season(2021).limit(1).offset(1).get_driver_standings() 15 | assert hamilton[0].driver_standings[0].driver.driver_id == "hamilton" 16 | 17 | def test_reset(self): 18 | """Assert the function resetting works""" 19 | self.e.season(2021).limit(1).offset(1) 20 | self.e.reset() 21 | verstappen = self.e.season(2021).limit(1) 22 | assert ( 23 | verstappen.get_driver_standing().driver_standings[0].driver.driver_id 24 | == "max_verstappen" 25 | ) 26 | -------------------------------------------------------------------------------- /ergast_py/models/result.py: -------------------------------------------------------------------------------- 1 | """ Result class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | from ergast_py.models.constructor import Constructor 7 | from ergast_py.models.driver import Driver 8 | from ergast_py.models.fastest_lap import FastestLap 9 | 10 | 11 | @dataclass 12 | class Result(BaseModel): 13 | """ 14 | Representation of a single Result from a Formula One race 15 | 16 | Results may contain: 17 | number: Integer 18 | position: Integer 19 | position_text: String 20 | points: Integer 21 | driver: Driver 22 | constructor: Constructor 23 | grid: Integer 24 | laps: Integer 25 | status: Integer 26 | time: datetime.time 27 | fastest_lap: FastestLap 28 | qual_1: datetime.time 29 | qual_2: datetime.time 30 | qual_3: datetime.time 31 | """ 32 | 33 | number: int 34 | position: int 35 | position_text: str 36 | points: float 37 | driver: Driver 38 | constructor: Constructor 39 | grid: int 40 | laps: int 41 | status: int 42 | time: datetime.time 43 | fastest_lap: FastestLap 44 | qual_1: datetime.time 45 | qual_2: datetime.time 46 | qual_3: datetime.time 47 | -------------------------------------------------------------------------------- /ergast_py/models/race.py: -------------------------------------------------------------------------------- 1 | """ Race class """ 2 | import datetime 3 | from dataclasses import dataclass 4 | 5 | from ergast_py.models.base_model import BaseModel 6 | from ergast_py.models.circuit import Circuit 7 | from ergast_py.models.lap import Lap 8 | from ergast_py.models.pit_stop import PitStop 9 | from ergast_py.models.result import Result 10 | 11 | 12 | @dataclass 13 | class Race(BaseModel): 14 | """ 15 | Representation of a single Race from a Formula One season 16 | 17 | Races may contain: 18 | season: Integer 19 | round_no: Integer 20 | url: String 21 | race_name: String 22 | circuit: Circuit 23 | date: datetime.datetime 24 | results: Result[] 25 | first_practice: datetime.datetime 26 | second_practice: datetime.datetime 27 | third_practice: datetime.datetime 28 | sprint: datetime.datetime 29 | sprint_results: Result[] 30 | qualifying: datetime.datetime 31 | qualifying_results: Result[] 32 | pit_stops: PitStop[] 33 | laps: Lap[] 34 | """ 35 | 36 | season: int 37 | round_no: int 38 | url: str 39 | race_name: str 40 | circuit: Circuit 41 | date: datetime.datetime 42 | results: list[Result] 43 | first_practice: datetime.datetime 44 | second_practice: datetime.datetime 45 | third_practice: datetime.datetime 46 | sprint: datetime.datetime 47 | sprint_results: list[Result] 48 | qualifying: datetime.datetime 49 | qualifying_results: list[Result] 50 | pit_stops: list[PitStop] 51 | laps: list[Lap] 52 | -------------------------------------------------------------------------------- /utils/status-action/check_statuses.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import random 4 | import string 5 | 6 | import requests 7 | 8 | API_URL = "https://ergast.com/api/f1/status.json?limit=2000" 9 | CURRENT_STATUSES_PATH = "./utils/status-action/current_statuses.json" 10 | 11 | 12 | def generate_delimiter(): 13 | return "".join(random.choices(string.ascii_lowercase + string.digits, k=5)) 14 | 15 | 16 | def generate_output_string(status_list): 17 | output = "" 18 | for status in status_list: 19 | output += f'- { status["statusId"] } ({ status["status"] })\n' 20 | 21 | return output 22 | 23 | 24 | def main(): 25 | missing_statuses = [] 26 | response = requests.get(API_URL).json()["MRData"]["StatusTable"] 27 | 28 | with open(CURRENT_STATUSES_PATH, "r") as status_file: 29 | current = json.loads(status_file.read()) 30 | 31 | for status in response["Status"]: 32 | if status["statusId"] not in current: 33 | print( 34 | f'Missing status found: { status["statusId"] } - { status["status"] }' 35 | ) 36 | missing_statuses.append(status) 37 | 38 | if len(missing_statuses) > 0: 39 | delim = generate_delimiter() + "\n" 40 | with open(os.environ["GITHUB_ENV"], "a") as environment_file: 41 | environment_file.write(f"MISSING_STATUSES_FORMATTED<<{delim}") 42 | environment_file.write(generate_output_string(missing_statuses)) 43 | environment_file.write(delim) 44 | 45 | with open(os.environ["GITHUB_OUTPUT"], "a") as environment_file: 46 | environment_file.write(f"MISSING_STATUSES_COUNT={len(missing_statuses)}") 47 | 48 | 49 | if __name__ == "__main__": 50 | main() 51 | -------------------------------------------------------------------------------- /ergast_py/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Ergast API Python Wrapper 3 | ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | A comprehensive Python wrapper for the Ergast Formula One API 6 | 7 | Basic usage: 8 | 9 | >>> import ergast_py 10 | >>> e = ergast_py.Ergast() 11 | >>> e.driver("alonso").get_driver() 12 | Driver( 13 | driverId=alonso, 14 | permanentNumber=14, 15 | code=ALO, 16 | url=http://en.wikipedia.org/wiki/Fernando_Alonso, 17 | givenName=Fernando, 18 | familyName=Alonso, 19 | dateOfBirth=1981-07-29, 20 | nationality=Spanish) 21 | 22 | Full documentation can be found at https://github.com/Samuel-Roach/ergast-py. 23 | 24 | Ergast-py extends the publicly available and free Ergast API. For more information 25 | and a better understanding visit http://ergast.com/mrd/ 26 | 27 | """ 28 | from ergast_py.ergast import Ergast 29 | from ergast_py.models.average_speed import AverageSpeed 30 | from ergast_py.models.circuit import Circuit 31 | from ergast_py.models.constructor import Constructor 32 | from ergast_py.models.constructor_standing import ConstructorStanding 33 | from ergast_py.models.driver import Driver 34 | from ergast_py.models.driver_standing import DriverStanding 35 | from ergast_py.models.fastest_lap import FastestLap 36 | from ergast_py.models.lap import Lap 37 | from ergast_py.models.location import Location 38 | from ergast_py.models.pit_stop import PitStop 39 | from ergast_py.models.race import Race 40 | from ergast_py.models.result import Result 41 | from ergast_py.models.season import Season 42 | from ergast_py.models.standings_list import StandingsList 43 | from ergast_py.models.status import Status 44 | from ergast_py.models.time import Time 45 | from ergast_py.models.timing import Timing 46 | 47 | __version__ = "0.7.0" 48 | 49 | __all__ = [ 50 | "__version__", 51 | "Ergast", 52 | "AverageSpeed", 53 | "Circuit", 54 | "Constructor", 55 | "ConstructorStanding", 56 | "Driver", 57 | "DriverStanding", 58 | "FastestLap", 59 | "Lap", 60 | "Location", 61 | "PitStop", 62 | "Race", 63 | "Result", 64 | "Season", 65 | "StandingsList", 66 | "Status", 67 | "Timing", 68 | "Time", 69 | ] 70 | -------------------------------------------------------------------------------- /tests/constants.py: -------------------------------------------------------------------------------- 1 | """ List of constants for use in testing """ 2 | 3 | ALONSO = { 4 | "driverId": "alonso", 5 | "permanentNumber": "14", 6 | "code": "ALO", 7 | "url": "http://en.wikipedia.org/wiki/Fernando_Alonso", 8 | "givenName": "Fernando", 9 | "familyName": "Alonso", 10 | "dateOfBirth": "1981-07-29", 11 | "nationality": "Spanish", 12 | } 13 | 14 | ISTANBUL = { 15 | "circuitId": "istanbul", 16 | "url": "http://en.wikipedia.org/wiki/Istanbul_Park", 17 | "circuitName": "Istanbul Park", 18 | "Location": { 19 | "lat": "40.9517", 20 | "long": "29.405", 21 | "locality": "Istanbul", 22 | "country": "Turkey", 23 | }, 24 | } 25 | 26 | FERRARI = { 27 | "constructorId": "ferrari", 28 | "url": "http://en.wikipedia.org/wiki/Scuderia_Ferrari", 29 | "name": "Ferrari", 30 | "nationality": "Italian", 31 | } 32 | 33 | RENAULT = { 34 | "constructorId": "renault", 35 | "url": "http://en.wikipedia.org/wiki/Renault_in_Formula_One", 36 | "name": "Renault", 37 | "nationality": "French", 38 | } 39 | 40 | ALPINE = { 41 | "constructorId": "alpine", 42 | "url": "http://en.wikipedia.org/wiki/Alpine_F1_Team", 43 | "name": "Alpine F1 Team", 44 | "nationality": "French", 45 | } 46 | 47 | SILVERSTONE = { 48 | "circuitId": "silverstone", 49 | "url": "http://en.wikipedia.org/wiki/Silverstone_Circuit", 50 | "circuitName": "Silverstone Circuit", 51 | "Location": { 52 | "lat": "52.0786", 53 | "long": "-1.01694", 54 | "locality": "Silverstone", 55 | "country": "UK", 56 | }, 57 | } 58 | 59 | LECLERC = { 60 | "driverId": "leclerc", 61 | "permanentNumber": "16", 62 | "code": "LEC", 63 | "url": "http://en.wikipedia.org/wiki/Charles_Leclerc", 64 | "givenName": "Charles", 65 | "familyName": "Leclerc", 66 | "dateOfBirth": "1997-10-16", 67 | "nationality": "Monegasque", 68 | } 69 | 70 | BAHRAIN = { 71 | "circuitId": "bahrain", 72 | "url": "http://en.wikipedia.org/wiki/Bahrain_International_Circuit", 73 | "circuitName": "Bahrain International Circuit", 74 | "Location": { 75 | "lat": "26.0325", 76 | "long": "50.5106", 77 | "locality": "Sakhir", 78 | "country": "Bahrain", 79 | }, 80 | } 81 | -------------------------------------------------------------------------------- /utils/status-action/current_statuses.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": "", 3 | "1": "Finished", 4 | "2": "Disqualified", 5 | "3": "Accident", 6 | "4": "Collision", 7 | "5": "Engine", 8 | "6": "Gearbox", 9 | "7": "Transmission", 10 | "8": "Clutch", 11 | "9": "Hydraulics", 12 | "10": "Electrical", 13 | "11": "+1 Lap", 14 | "12": "+2 Laps", 15 | "13": "+3 Laps", 16 | "14": "+4 Laps", 17 | "15": "+5 Laps", 18 | "16": "+6 Laps", 19 | "17": "+7 Laps", 20 | "18": "+8 Laps", 21 | "19": "+9 Laps", 22 | "20": "Spun off", 23 | "21": "Radiator", 24 | "22": "Suspension", 25 | "23": "Brakes", 26 | "24": "Differential", 27 | "25": "Overheating", 28 | "26": "Mechanical", 29 | "27": "Tyre", 30 | "28": "Driver Seat", 31 | "29": "Puncture", 32 | "30": "Driveshaft", 33 | "31": "Retired", 34 | "32": "Fuel pressure", 35 | "33": "Front wing", 36 | "34": "Water pressure", 37 | "35": "Refuelling", 38 | "36": "Wheel", 39 | "37": "Throttle", 40 | "38": "Steering", 41 | "39": "Technical", 42 | "40": "Electronics", 43 | "41": "Broken wing", 44 | "42": "Heat shield fire", 45 | "43": "Exhaust", 46 | "44": "Oil leak", 47 | "45": "+11 Laps", 48 | "46": "Wheel rim", 49 | "47": "Water leak", 50 | "48": "Fuel pump", 51 | "49": "Track rod", 52 | "50": "+17 Laps", 53 | "51": "Oil pressure", 54 | "53": "+13 Laps", 55 | "54": "Withdrew", 56 | "55": "+12 Laps", 57 | "56": "Engine fire", 58 | "58": "+26 Laps", 59 | "59": "Tyre puncture", 60 | "60": "Out of fuel", 61 | "61": "Wheel nut", 62 | "62": "Not classified", 63 | "63": "Pneumatics", 64 | "64": "Handling", 65 | "65": "Rear wing", 66 | "66": "Fire", 67 | "67": "Wheel bearing", 68 | "68": "Physical", 69 | "69": "Fuel system", 70 | "70": "Oil line", 71 | "71": "Fuel rig", 72 | "72": "Launch control", 73 | "73": "Injured", 74 | "74": "Fuel", 75 | "75": "Power loss", 76 | "76": "Vibrations", 77 | "77": "107% Rule", 78 | "78": "Safety", 79 | "79": "Drivetrain", 80 | "80": "Ignition", 81 | "81": "Did not qualify", 82 | "82": "Injury", 83 | "83": "Chassis", 84 | "84": "Battery", 85 | "85": "Stalled", 86 | "86": "Halfshaft", 87 | "87": "Crankshaft", 88 | "88": "+10 Laps", 89 | "89": "Safety concerns", 90 | "90": "Not restarted", 91 | "91": "Alternator", 92 | "92": "Underweight", 93 | "93": "Safety belt", 94 | "94": "Oil pump", 95 | "95": "Fuel leak", 96 | "96": "Excluded", 97 | "97": "Did not prequalify", 98 | "98": "Injection", 99 | "99": "Distributor", 100 | "100": "Driver unwell", 101 | "101": "Turbo", 102 | "102": "CV joint", 103 | "103": "Water pump", 104 | "104": "Fatal accident", 105 | "105": "Spark plugs", 106 | "106": "Fuel pipe", 107 | "107": "Eye injury", 108 | "108": "Oil pipe", 109 | "109": "Axle", 110 | "110": "Water pipe", 111 | "111": "+14 Laps", 112 | "112": "+15 Laps", 113 | "113": "+25 Laps", 114 | "114": "+18 Laps", 115 | "115": "+22 Laps", 116 | "116": "+16 Laps", 117 | "117": "+24 Laps", 118 | "118": "+29 Laps", 119 | "119": "+23 Laps", 120 | "120": "+21 Laps", 121 | "121": "Magneto", 122 | "122": "+44 Laps", 123 | "123": "+30 Laps", 124 | "124": "+19 Laps", 125 | "125": "+46 Laps", 126 | "126": "Supercharger", 127 | "127": "+20 Laps", 128 | "128": "+42 Laps", 129 | "129": "Engine misfire", 130 | "130": "Collision damage", 131 | "131": "Power Unit", 132 | "132": "ERS", 133 | "135": "Brake duct", 134 | "136": "Seat", 135 | "137": "Damage", 136 | "138": "Debris", 137 | "139": "Illness", 138 | "140": "Undertray", 139 | "141": "Cooling system" 140 | } 141 | -------------------------------------------------------------------------------- /ergast_py/helpers.py: -------------------------------------------------------------------------------- 1 | """ Helpers class """ 2 | import datetime 3 | 4 | import pytz 5 | 6 | 7 | class Helpers: 8 | """ 9 | Helpers for the construction of models 10 | """ 11 | 12 | @staticmethod 13 | def construct_datetime_str(date: str, time: str) -> datetime.datetime: 14 | """ 15 | Construct a datetime.datetime from the date and time strings. 16 | 17 | Looking for the format of ``%Y-%m-%d %H:%M:%SZ`` 18 | """ 19 | if not time.strip(): 20 | time = "00:00:00Z" 21 | 22 | new_datetime = datetime.datetime.strptime( 23 | f"{date} {time}", "%Y-%m-%d %H:%M:%SZ" 24 | ) 25 | new_datetime = new_datetime.replace(tzinfo=datetime.timezone.utc) 26 | return new_datetime 27 | 28 | @staticmethod 29 | def construct_datetime_dict(datetime_dict: dict) -> datetime.datetime: 30 | """ 31 | Construct a datetime.datetime from a dictionary. 32 | 33 | Dictionary should contain the keys "date" and "time" 34 | """ 35 | if "date" not in datetime_dict or "time" not in datetime_dict: 36 | raise ValueError("Dictionary must contain keys 'date' and 'time'") 37 | 38 | return Helpers.construct_datetime_str( 39 | datetime_dict["date"], datetime_dict["time"] 40 | ) 41 | 42 | @staticmethod 43 | def construct_date(date: str) -> datetime.date: 44 | """ 45 | Construct a datetime.date from a date string 46 | """ 47 | elements = date.split("-") 48 | return datetime.date( 49 | year=int(elements[0]), month=int(elements[1]), day=int(elements[2]) 50 | ) 51 | 52 | @staticmethod 53 | def construct_lap_time_millis(millis: dict) -> datetime.time: 54 | """ 55 | Construct a datetime.time (lap time) from a dict containing the millis 56 | """ 57 | if "millis" not in millis: 58 | raise ValueError("Dictionary must contain key 'millis'") 59 | 60 | value = int(millis["millis"]) 61 | return datetime.datetime.fromtimestamp(value / 1000.0, pytz.utc).time() 62 | 63 | @staticmethod 64 | def format_lap_time(time: str) -> datetime.time: 65 | """ 66 | Construct a datetime.time (lap time) from a time string 67 | """ 68 | if time == "": 69 | raise ValueError("Time string cannot be empty") 70 | 71 | return datetime.datetime.strptime(time, "%M:%S.%f").time() 72 | 73 | @staticmethod 74 | def construct_lap_time(time: dict) -> datetime.time: 75 | """ 76 | Construct a datetime.time (lap time) from a time dictionary 77 | 78 | The dictionary should contain the key "time" 79 | """ 80 | if "time" not in time: 81 | raise ValueError("Dictionary must contain key 'time'") 82 | 83 | value = time["time"] 84 | return Helpers.format_lap_time(value) 85 | 86 | @staticmethod 87 | def construct_local_time(time: str) -> datetime.time: 88 | """ 89 | Construct a datetime.time from a time string 90 | 91 | Looking for the format of ``%H:%M:%S`` 92 | """ 93 | if time == "": 94 | raise ValueError("Time string cannot be empty") 95 | 96 | return datetime.datetime.strptime(f"{time}", "%H:%M:%S").time() 97 | 98 | @staticmethod 99 | def construct_pitstop_duration(time: str) -> datetime.time: 100 | """ 101 | Construct a datetime.time (pit stop duration) from a time string 102 | 103 | Looking for one of the following formats: 104 | ``%S.%f`` 105 | ``%M:%S.%f`` 106 | """ 107 | if time == "": 108 | raise ValueError("Time string cannot be empty") 109 | 110 | if len(time.split(":")) - 1: 111 | return datetime.datetime.strptime(f"{time}", "%M:%S.%f").time() 112 | 113 | return datetime.datetime.strptime(f"{time}", "%S.%f").time() 114 | -------------------------------------------------------------------------------- /ergast_py/constants/expected.py: -------------------------------------------------------------------------------- 1 | """ Expected class """ 2 | 3 | 4 | class Expected: 5 | """ 6 | Representations of the types expected to be found within a model. 7 | 8 | Each model has a set of keys, and the types expected. 9 | 10 | Types are stored as one of the following strings: 11 | * "int" 12 | * "float" 13 | * "string" 14 | * "dict" """ 15 | 16 | @property 17 | def location(self): 18 | """ 19 | Return the expected types of a Location 20 | """ 21 | return { 22 | "lat": "float", 23 | "long": "float", 24 | "locality": "string", 25 | "country": "string", 26 | } 27 | 28 | @property 29 | def circuit(self): 30 | """ 31 | Return the expected types of a Circuit 32 | """ 33 | return { 34 | "circuitId": "string", 35 | "url": "string", 36 | "circuitName": "string", 37 | "Location": "string", 38 | } 39 | 40 | @property 41 | def constructor(self): 42 | """ 43 | Return the expected types of a Constructor 44 | """ 45 | return { 46 | "constructorId": "string", 47 | "url": "string", 48 | "name": "string", 49 | "nationality": "string", 50 | } 51 | 52 | @property 53 | def driver(self): 54 | """ 55 | Return the expected types of a Driver 56 | """ 57 | return { 58 | "driverId": "string", 59 | "permanentNumber": "int", 60 | "code": "string", 61 | "url": "string", 62 | "givenName": "string", 63 | "familyName": "string", 64 | "dateOfBirth": "string", 65 | "nationality": "string", 66 | } 67 | 68 | @property 69 | def race(self): 70 | """ 71 | Return the expected types of a Race 72 | """ 73 | return { 74 | "season": "int", 75 | "round": "int", 76 | "url": "string", 77 | "raceName": "string", 78 | "Circuit": "dict", 79 | "date": "string", 80 | "time": "string", 81 | "Results": "dict", 82 | "FirstPractice": "dict", 83 | "SecondPractice": "dict", 84 | "ThirdPractice": "dict", 85 | "Sprint": "dict", 86 | "SprintResults": "dict", 87 | "Qualifying": "dict", 88 | "QualifyingResults": "dict", 89 | "PitStops": "dict", 90 | "Laps": "dict", 91 | } 92 | 93 | @property 94 | def result(self): 95 | """ 96 | Return the expected types of a Result 97 | """ 98 | return { 99 | "number": "int", 100 | "position": "int", 101 | "positionText": "string", 102 | "points": "float", 103 | "Driver": "dict", 104 | "Constructor": "dict", 105 | "grid": "int", 106 | "laps": "int", 107 | "status": "string", 108 | "Time": "dict", 109 | "FastestLap": "dict", 110 | "Q1": "string", 111 | "Q2": "string", 112 | "Q3": "string", 113 | } 114 | 115 | @property 116 | def fastest_lap(self): 117 | """ 118 | Return the expected types of a Fastest Lap 119 | """ 120 | return { 121 | "rank": "int", 122 | "lap": "int", 123 | "Time": "dict", 124 | "AverageSpeed": "dict", 125 | } 126 | 127 | @property 128 | def average_speed(self): 129 | """ 130 | Return the expected types of a Average Speed 131 | """ 132 | return { 133 | "units": "string", 134 | "speed": "float", 135 | } 136 | 137 | @property 138 | def pit_stop(self): 139 | """ 140 | Return the expected types of a Pit Stop 141 | """ 142 | return { 143 | "driverId": "string", 144 | "lap": "int", 145 | "stop": "int", 146 | "time": "string", 147 | "duration": "string", 148 | } 149 | 150 | @property 151 | def lap(self): 152 | """ 153 | Return the expected types of a Lap 154 | """ 155 | return { 156 | "number": "int", 157 | "Timings": "dict", 158 | } 159 | 160 | @property 161 | def timing(self): 162 | """ 163 | Return the expected types of a Timing 164 | """ 165 | return { 166 | "driverId": "string", 167 | "position": "int", 168 | "time": "string", 169 | } 170 | 171 | @property 172 | def season(self): 173 | """ 174 | Return the expected types of a Season 175 | """ 176 | return { 177 | "season": "int", 178 | "url": "string", 179 | } 180 | 181 | @property 182 | def status(self): 183 | """ 184 | Return the expected types of a Status 185 | """ 186 | return {"statusId": "int", "count": "int", "status": "string"} 187 | 188 | @property 189 | def driver_standing(self): 190 | """ 191 | Return the expected types of a Driver Standing 192 | """ 193 | return { 194 | "position": "int", 195 | "positionText": "string", 196 | "points": "float", 197 | "wins": "int", 198 | "Driver": "dict", 199 | "Constructors": "dict", 200 | } 201 | 202 | @property 203 | def constructor_standing(self): 204 | """ 205 | Return the expected types of a Constructor Standing 206 | """ 207 | return { 208 | "position": "int", 209 | "positionText": "string", 210 | "points": "float", 211 | "wins": "int", 212 | "Constructor": "dict", 213 | } 214 | 215 | @property 216 | def standings_list(self): 217 | """ 218 | Return the expected types of a Standings List 219 | """ 220 | return { 221 | "season": "int", 222 | "round": "int", 223 | "DriverStandings": "dict", 224 | "ConstructorStandings": "dict", 225 | } 226 | 227 | @property 228 | def time(self): 229 | """ 230 | Return the expected types of a Time 231 | """ 232 | return { 233 | "millis": "datetime.time", 234 | "time": "string", 235 | } 236 | -------------------------------------------------------------------------------- /ergast_py/constants/status_type.py: -------------------------------------------------------------------------------- 1 | """ StatusType class """ 2 | 3 | 4 | class StatusType: 5 | """ 6 | Mappings between ID and Strings for StatusType 7 | """ 8 | 9 | @property 10 | def string_to_id(self): 11 | """ 12 | Return the map of StatusType strings to ids 13 | """ 14 | return { 15 | "": 0, 16 | "Finished": 1, 17 | "Disqualified": 2, 18 | "Accident": 3, 19 | "Collision": 4, 20 | "Engine": 5, 21 | "Gearbox": 6, 22 | "Transmission": 7, 23 | "Clutch": 8, 24 | "Hydraulics": 9, 25 | "Electrical": 10, 26 | "+1 Lap": 11, 27 | "+2 Laps": 12, 28 | "+3 Laps": 13, 29 | "+4 Laps": 14, 30 | "+5 Laps": 15, 31 | "+6 Laps": 16, 32 | "+7 Laps": 17, 33 | "+8 Laps": 18, 34 | "+9 Laps": 19, 35 | "Spun off": 20, 36 | "Radiator": 21, 37 | "Suspension": 22, 38 | "Brakes": 23, 39 | "Differential": 24, 40 | "Overheating": 25, 41 | "Mechanical": 26, 42 | "Tyre": 27, 43 | "Driver Seat": 28, 44 | "Puncture": 29, 45 | "Driveshaft": 30, 46 | "Retired": 31, 47 | "Fuel pressure": 32, 48 | "Front wing": 33, 49 | "Water pressure": 34, 50 | "Refuelling": 35, 51 | "Wheel": 36, 52 | "Throttle": 37, 53 | "Steering": 38, 54 | "Technical": 39, 55 | "Electronics": 40, 56 | "Broken wing": 41, 57 | "Heat shield fire": 42, 58 | "Exhaust": 43, 59 | "Oil leak": 44, 60 | "+11 Laps": 45, 61 | "Wheel rim": 46, 62 | "Water leak": 47, 63 | "Fuel pump": 48, 64 | "Track rod": 49, 65 | "+17 Laps": 50, 66 | "Oil pressure": 51, 67 | "+13 Laps": 53, 68 | "Withdrew": 54, 69 | "+12 Laps": 55, 70 | "Engine fire": 56, 71 | "+26 Laps": 58, 72 | "Tyre puncture": 59, 73 | "Out of fuel": 60, 74 | "Wheel nut": 61, 75 | "Not classified": 62, 76 | "Pneumatics": 63, 77 | "Handling": 64, 78 | "Rear wing": 65, 79 | "Fire": 66, 80 | "Wheel bearing": 67, 81 | "Physical": 68, 82 | "Fuel system": 69, 83 | "Oil line": 70, 84 | "Fuel rig": 71, 85 | "Launch control": 72, 86 | "Injured": 73, 87 | "Fuel": 74, 88 | "Power loss": 75, 89 | "Vibrations": 76, 90 | "107% Rule": 77, 91 | "Safety": 78, 92 | "Drivetrain": 79, 93 | "Ignition": 80, 94 | "Did not qualify": 81, 95 | "Injury": 82, 96 | "Chassis": 83, 97 | "Battery": 84, 98 | "Stalled": 85, 99 | "Halfshaft": 86, 100 | "Crankshaft": 87, 101 | "+10 Laps": 88, 102 | "Safety concerns": 89, 103 | "Not restarted": 90, 104 | "Alternator": 91, 105 | "Underweight": 92, 106 | "Safety belt": 93, 107 | "Oil pump": 94, 108 | "Fuel leak": 95, 109 | "Excluded": 96, 110 | "Did not prequalify": 97, 111 | "Injection": 98, 112 | "Distributor": 99, 113 | "Driver unwell": 100, 114 | "Turbo": 101, 115 | "CV joint": 102, 116 | "Water pump": 103, 117 | "Fatal accident": 104, 118 | "Spark plugs": 105, 119 | "Fuel pipe": 106, 120 | "Eye injury": 107, 121 | "Oil pipe": 108, 122 | "Axle": 109, 123 | "Water pipe": 110, 124 | "+14 Laps": 111, 125 | "+15 Laps": 112, 126 | "+25 Laps": 113, 127 | "+18 Laps": 114, 128 | "+22 Laps": 115, 129 | "+16 Laps": 116, 130 | "+24 Laps": 117, 131 | "+29 Laps": 118, 132 | "+23 Laps": 119, 133 | "+21 Laps": 120, 134 | "Magneto": 121, 135 | "+44 Laps": 122, 136 | "+30 Laps": 123, 137 | "+19 Laps": 124, 138 | "+46 Laps": 125, 139 | "Supercharger": 126, 140 | "+20 Laps": 127, 141 | "+42 Laps": 128, 142 | "Engine misfire": 129, 143 | "Collision damage": 130, 144 | "Power Unit": 131, 145 | "ERS": 132, 146 | "Brake duct": 135, 147 | "Seat": 136, 148 | "Damage": 137, 149 | "Debris": 138, 150 | "Illness": 139, 151 | "Undertray": 140, 152 | "Cooling system": 141, 153 | } 154 | 155 | @property 156 | def id_to_string(self): 157 | """ 158 | Return the map of StatusType ids to strings 159 | """ 160 | return { 161 | 0: "", 162 | 1: "Finished", 163 | 2: "Disqualified", 164 | 3: "Accident", 165 | 4: "Collision", 166 | 5: "Engine", 167 | 6: "Gearbox", 168 | 7: "Transmission", 169 | 8: "Clutch", 170 | 9: "Hydraulics", 171 | 10: "Electrical", 172 | 11: "+1 Lap", 173 | 12: "+2 Laps", 174 | 13: "+3 Laps", 175 | 14: "+4 Laps", 176 | 15: "+5 Laps", 177 | 16: "+6 Laps", 178 | 17: "+7 Laps", 179 | 18: "+8 Laps", 180 | 19: "+9 Laps", 181 | 20: "Spun off", 182 | 21: "Radiator", 183 | 22: "Suspension", 184 | 23: "Brakes", 185 | 24: "Differential", 186 | 25: "Overheating", 187 | 26: "Mechanical", 188 | 27: "Tyre", 189 | 28: "Driver Seat", 190 | 29: "Puncture", 191 | 30: "Driveshaft", 192 | 31: "Retired", 193 | 32: "Fuel pressure", 194 | 33: "Front wing", 195 | 34: "Water pressure", 196 | 35: "Refuelling", 197 | 36: "Wheel", 198 | 37: "Throttle", 199 | 38: "Steering", 200 | 39: "Technical", 201 | 40: "Electronics", 202 | 41: "Broken wing", 203 | 42: "Heat shield fire", 204 | 43: "Exhaust", 205 | 44: "Oil leak", 206 | 45: "+11 Laps", 207 | 46: "Wheel rim", 208 | 47: "Water leak", 209 | 48: "Fuel pump", 210 | 49: "Track rod", 211 | 50: "+17 Laps", 212 | 51: "Oil pressure", 213 | 53: "+13 Laps", 214 | 54: "Withdrew", 215 | 55: "+12 Laps", 216 | 56: "Engine fire", 217 | 58: "+26 Laps", 218 | 59: "Tyre puncture", 219 | 60: "Out of fuel", 220 | 61: "Wheel nut", 221 | 62: "Not classified", 222 | 63: "Pneumatics", 223 | 64: "Handling", 224 | 65: "Rear wing", 225 | 66: "Fire", 226 | 67: "Wheel bearing", 227 | 68: "Physical", 228 | 69: "Fuel system", 229 | 70: "Oil line", 230 | 71: "Fuel rig", 231 | 72: "Launch control", 232 | 73: "Injured", 233 | 74: "Fuel", 234 | 75: "Power loss", 235 | 76: "Vibrations", 236 | 77: "107% Rule", 237 | 78: "Safety", 238 | 79: "Drivetrain", 239 | 80: "Ignition", 240 | 81: "Did not qualify", 241 | 82: "Injury", 242 | 83: "Chassis", 243 | 84: "Battery", 244 | 85: "Stalled", 245 | 86: "Halfshaft", 246 | 87: "Crankshaft", 247 | 88: "+10 Laps", 248 | 89: "Safety concerns", 249 | 90: "Not restarted", 250 | 91: "Alternator", 251 | 92: "Underweight", 252 | 93: "Safety belt", 253 | 94: "Oil pump", 254 | 95: "Fuel leak", 255 | 96: "Excluded", 256 | 97: "Did not prequalify", 257 | 98: "Injection", 258 | 99: "Distributor", 259 | 100: "Driver unwell", 260 | 101: "Turbo", 261 | 102: "CV joint", 262 | 103: "Water pump", 263 | 104: "Fatal accident", 264 | 105: "Spark plugs", 265 | 106: "Fuel pipe", 266 | 107: "Eye injury", 267 | 108: "Oil pipe", 268 | 109: "Axle", 269 | 110: "Water pipe", 270 | 111: "+14 Laps", 271 | 112: "+15 Laps", 272 | 113: "+25 Laps", 273 | 114: "+18 Laps", 274 | 115: "+22 Laps", 275 | 116: "+16 Laps", 276 | 117: "+24 Laps", 277 | 118: "+29 Laps", 278 | 119: "+23 Laps", 279 | 120: "+21 Laps", 280 | 121: "Magneto", 281 | 122: "+44 Laps", 282 | 123: "+30 Laps", 283 | 124: "+19 Laps", 284 | 125: "+46 Laps", 285 | 126: "Supercharger", 286 | 127: "+20 Laps", 287 | 128: "+42 Laps", 288 | 129: "Engine misfire", 289 | 130: "Collision damage", 290 | 131: "Power Unit", 291 | 132: "ERS", 292 | 135: "Brake duct", 293 | 136: "Seat", 294 | 137: "Damage", 295 | 138: "Debris", 296 | 139: "Illness", 297 | 140: "Undertray", 298 | 141: "Cooling system", 299 | } 300 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Ergast-Py

2 | 3 |

4 | 5 | 6 | 7 |
8 | 9 | GitHub 10 | Downloads 11 |

12 | 13 | A comprehensive Python wrapper for the Ergast API. Built for easy use and functionality, Ergast-py aims to bring the Ergast API into the Python network as seemlessly as possible. 14 | 15 | > NOTE: Ergast-py will continue development using a new publicly available API. 16 | [Jolpica](https://github.com/jolpica/jolpica-f1?tab=readme-ov-file) provides a drop-in replacement API for the Ergast API, and therefore development will continue with this new API in mind. 17 | 18 |

19 | Command prompt example of how to use Ergast 20 |

21 | 22 | # What is Ergast? 23 | 24 | [Ergast](http://ergast.com/mrd/) is a free, experimental API for accessing motor-racing data, dating back to the beginning of World Championships in 1950. The website provides plenty of detail into how effective the API can be, and the many options that are available for data gathering using it. 25 | 26 | # Why should I use Ergast-Py? 27 | 28 | Ergast-Py provides a clean, Python orientated wrapper for this API. It has been designed to remove the heavy lifting of handling the API formatting behind the scenes, allowing developers to easily access the data that is relevant to them. All the data is conformed into clean class code, allowing for users to keep a Python-centric mindset whilst developing. 29 | 30 | # How to install 31 | 32 | Ergast-py is a [pip package](https://pypi.org/project/ergast-py/), so can be installed with the pip command: 33 | 34 | ``` 35 | pip install ergast-py 36 | ``` 37 | 38 | # Usage 39 | 40 | Once ergast-py is installed on your system you can then begin using the library in querying the ergast API. To begin, initialise an instance of the ``Ergast()`` class. 41 | 42 | Note: Whilst the package is called ``ergast-py``, you need to import ``ergast_py`` 43 | 44 | ```python 45 | import ergast_py 46 | 47 | e = ergast_py.Ergast() 48 | ``` 49 | 50 | Queries can then be built up with function calls in a sequential manner. Once you've built up a query, finally define what data you wish to get using a ``get_xyz()`` function. 51 | 52 | ```python 53 | # http://ergast.com/api/f1/2008/5/results 54 | race_results = e.season(2008).round(5).get_results() 55 | 56 | # http://ergast.com/api/f1/drivers/massa 57 | felipe_massa = e.driver("massa").get_driver() 58 | 59 | # http://ergast.com/api/f1/current/constructorStandings/3 60 | constructor_standings = e.season().standing(3).get_constructor_standings() 61 | ``` 62 | 63 | # Structure and Types 64 | 65 | Ergast-py has many models which allow the user to more effectively use and manipulate the data available to them through Ergast. All models of data are available through ``.models.xyz``. 66 | 67 |
68 | Available models in ergast-py 69 |
70 | 71 | | Name | Description | 72 | |---------------------|--------------------------------------------------------| 73 | | AverageSpeed | The average speed achieved during a fastest lap | 74 | | Circuit | Details about a Formula One circuit | 75 | | ConstructorStanding | A single constructor's representation in the standings | 76 | | Constructor | A Formula One constructor | 77 | | DriverStanding | A single driver's representation in the standings | 78 | | Driver | A Formula One driver | 79 | | FastestLap | A fastest lap achieved by a driver | 80 | | Lap | Details about a drivers lap | 81 | | Location | The position of a circuit | 82 | | PitStop | Details about a driver's pit stop | 83 | | Race | Full representation of a Formula One race | 84 | | Result | Details about a driver's result | 85 | | Season | Details about a Formula One season | 86 | | StandingsList | A list of standings; constructors or drivers | 87 | | Status | Details about the final status of a driver in a race | 88 | | Timing | Details about the timings of a driver during a lap | 89 | 90 |
91 | 92 | # Query building 93 | 94 | There are 3 types of query available in the ``Ergast()`` class. FILTER functions build up the query, by filtering down the data that you will receive. PAGING functions control the flow of data if there is excessive amounts, limiting it to not overflow the API. RETURN functions detail what type of data you're expecting back from the query. 95 | 96 | The order of the builder functions is inconsequential, however the final function called should be a return function. 97 | ``` 98 | Ergast().{paging/filter}.{return} 99 | ``` 100 | 101 | More detail on the available functions within the ``Ergast()`` class is available below. 102 | 103 |
104 | FILTER functions 105 |
106 | 107 | | Name | Arguments | Notes | 108 | |-------------|--------------------------|----------------------------------------------------------------------------| 109 | | season | year: int | If you call season with no arguments it will default to the current season | 110 | | round | round_no: int | If you call round with no arguments it will default to the last round | 111 | | driver | driver: Driver | | 112 | | constructor | constructor: Constructor | | 113 | | qualifying | position: int | Position at the end of qualifying | 114 | | sprint | position: int | | 115 | | grid | position: int | Position lined up on the grid | 116 | | result | position: int | | 117 | | fastest | position: int | Ranking in list of each drivers fastest lap | 118 | | circuit | circuit: Circuit | | 119 | | status | status: int | Must use statusId or string representation | 120 | | standing | position: int | Position of Driver or Constructor in standing | 121 | | lap | lap_number: int | | 122 | | pit_stop | stop_number: int | | 123 | 124 |
125 | 126 |
127 | PAGING functions 128 |
129 | 130 | | Name | Arguments | 131 | |--------|-------------| 132 | | limit | amount: int | 133 | | offset | amount: int | 134 | 135 | 136 |
137 | 138 |
139 | RETURN functions 140 |
141 | 142 | > NOTE: All the functions that return a single object will raise an Exception if your query is returning more than one item. 143 | 144 | | Name | Return Type | 145 | |---------------------------|---------------------| 146 | | get_circuits | list[Circuit] | 147 | | get_circuit | Circuit | 148 | | get_constructors | list[Constructor] | 149 | | get_constructor | Constructor | 150 | | get_drivers | list[Driver] | 151 | | get_driver | Driver | 152 | | get_qualifyings | list[Race] | 153 | | get_qualifying | Race | 154 | | get_sprints | list[Race] | 155 | | get_sprint | Race | 156 | | get_results | list[Race] | 157 | | get_result | Race | 158 | | get_races | list[Race] | 159 | | get_race | Race | 160 | | get_seasons | list[Season] | 161 | | get_season | Season | 162 | | get_statuses | list[Status] | 163 | | get_status | Status | 164 | | get_driver_standings | list[StandingsList] | 165 | | get_driver_standing | StandingsList | 166 | | get_constructor_standings | list[StandingsList] | 167 | | get_constructor_standing | StandingsList | 168 | | get_laps | list[Race] | 169 | | get_lap | Race | 170 | | get_pit_stops | list[Race] | 171 | | get_pit_stop | Race | 172 | 173 |
174 | 175 | # Credits 176 | 177 | This library would not be possible without the freely available [Ergast](http://ergast.com/mrd/) API. For full information about the API and it's responsible use, please refer to their website. [Poetry](https://python-poetry.org/) was used for package building and releasing. 178 | -------------------------------------------------------------------------------- /ergast_py/requester.py: -------------------------------------------------------------------------------- 1 | """ Requester class """ 2 | import json 3 | from typing import Callable 4 | 5 | import requests 6 | from uritemplate import URITemplate 7 | 8 | SERIES = "f1" 9 | 10 | 11 | class Requester: 12 | """ 13 | Perform requests to the Ergast API 14 | """ 15 | 16 | @staticmethod 17 | def _get_race_results_params(param: dict) -> dict: 18 | return { 19 | "season": param["season"], 20 | "round": param["round"], 21 | "filters": { 22 | "drivers": param["driver"], 23 | "constructors": param["constructor"], 24 | "grid": param["grid"], 25 | "qualifying": param["qualifying"], 26 | "sprint": param["sprint"], 27 | "fastest": param["fastest"], 28 | "circuits": param["circuit"], 29 | "status": param["status"], 30 | "results": param["result"], 31 | "races": param["races"], 32 | "seasons": param["seasons"], 33 | }, 34 | "paging": { 35 | "limit": param["limit"], 36 | "offset": param["offset"], 37 | }, 38 | } 39 | 40 | @staticmethod 41 | def _get_race_results_criteria(params: dict, resource: str) -> dict: 42 | criteria = [] 43 | for key, value in params["filters"].items(): 44 | if key != resource and value is not None: 45 | criteria.append(key) 46 | criteria.append(value) 47 | 48 | value = params["filters"][resource] 49 | 50 | return {"resource": resource, "value": value, "criteria": criteria} 51 | 52 | @staticmethod 53 | def _get_standings_params(param: dict) -> dict: 54 | return { 55 | "season": param["season"], 56 | "round": param["round"], 57 | "filters": { 58 | "standing": param["standing"], 59 | "drivers": param["driver"], 60 | "constructors": param["constructor"], 61 | }, 62 | "paging": { 63 | "limit": param["limit"], 64 | "offset": param["offset"], 65 | }, 66 | } 67 | 68 | @staticmethod 69 | def _get_standings_criteria(params: dict, resource: str) -> dict: 70 | criteria = [] 71 | for key, value in params["filters"].items(): 72 | if key != "standing" and value is not None: 73 | criteria.append(key) 74 | criteria.append(value) 75 | 76 | value = params["filters"]["standing"] 77 | 78 | return {"resource": resource, "value": value, "criteria": criteria} 79 | 80 | @staticmethod 81 | def _get_laps_pit_stops_params(param: dict) -> dict: 82 | return { 83 | "season": param["season"], 84 | "round": param["round"], 85 | "filters": { 86 | "pitstops": param["pit_stop"], 87 | "laps": param["lap"], 88 | "drivers": param["driver"], 89 | }, 90 | "paging": { 91 | "limit": param["limit"], 92 | "offset": param["offset"], 93 | }, 94 | } 95 | 96 | @staticmethod 97 | def _get_laps_pit_stops_criteria(params: dict, resource: str) -> dict: 98 | criteria = [] 99 | for key, value in params["filters"].items(): 100 | if key != resource and value is not None: 101 | criteria.append(key) 102 | criteria.append(value) 103 | 104 | value = params["filters"][resource] 105 | 106 | return {"resource": resource, "value": value, "criteria": criteria} 107 | 108 | @staticmethod 109 | def run_request( 110 | season, round_no, criteria, resource, value=None, limit=None, offset=None 111 | ) -> dict: 112 | """ 113 | Run a request against the API and return the JSON dictionary result 114 | """ 115 | url_tmpl = URITemplate( 116 | "https://api.jolpi.ca/ergast{/series}{/season}{/round}" 117 | "{/criteria*}{/resource}{/value}.json{?limit,offset}" 118 | ) 119 | url = url_tmpl.expand( 120 | series=SERIES, 121 | season=season, 122 | round=round_no, 123 | criteria=criteria, 124 | resource=resource, 125 | value=value, 126 | limit=limit, 127 | offset=offset, 128 | ) 129 | 130 | response = requests.get(url) 131 | if response.status_code == 200: 132 | return json.loads(response.text) 133 | raise Exception( 134 | f"Failed with status code {response.status_code}. Error: {response.reason}" 135 | ) 136 | 137 | def _get_api_json( 138 | self, get_params: Callable, get_criteria: Callable, resource: str, param: dict 139 | ) -> dict: 140 | params = get_params(param) 141 | filters = get_criteria(params, resource) 142 | 143 | return self.run_request( 144 | season=params["season"], 145 | round_no=params["round"], 146 | criteria=filters["criteria"], 147 | resource=filters["resource"], 148 | value=filters["value"], 149 | limit=params["paging"]["limit"], 150 | offset=params["paging"]["offset"], 151 | ) 152 | 153 | # 154 | # Race and Results 155 | # 156 | 157 | def get_circuits(self, param: dict) -> dict: 158 | """ 159 | Get the Circuits JSON from the Ergast API 160 | """ 161 | api_json = self._get_api_json( 162 | self._get_race_results_params, 163 | self._get_race_results_criteria, 164 | "circuits", 165 | param, 166 | ) 167 | 168 | return api_json["MRData"]["CircuitTable"]["Circuits"] 169 | 170 | def get_constructors(self, param: dict) -> dict: 171 | """ 172 | Get the Constructors JSON from the Ergast API 173 | """ 174 | api_json = self._get_api_json( 175 | self._get_race_results_params, 176 | self._get_race_results_criteria, 177 | "constructors", 178 | param, 179 | ) 180 | 181 | return api_json["MRData"]["ConstructorTable"]["Constructors"] 182 | 183 | def get_drivers(self, param: dict) -> dict: 184 | """ 185 | Get the Drivers JSON from the Ergast API 186 | """ 187 | api_json = self._get_api_json( 188 | self._get_race_results_params, 189 | self._get_race_results_criteria, 190 | "drivers", 191 | param, 192 | ) 193 | 194 | return api_json["MRData"]["DriverTable"]["Drivers"] 195 | 196 | def get_qualifying(self, param: dict) -> dict: 197 | """ 198 | Get the Qualifying JSON from the Ergast API 199 | """ 200 | api_json = self._get_api_json( 201 | self._get_race_results_params, 202 | self._get_race_results_criteria, 203 | "qualifying", 204 | param, 205 | ) 206 | 207 | return api_json["MRData"]["RaceTable"]["Races"] 208 | 209 | def get_sprints(self, param: dict) -> dict: 210 | """ 211 | Get the Sprints JSON from the Ergast API 212 | """ 213 | api_json = self._get_api_json( 214 | self._get_race_results_params, 215 | self._get_race_results_criteria, 216 | "sprint", 217 | param, 218 | ) 219 | 220 | return api_json["MRData"]["RaceTable"]["Races"] 221 | 222 | def get_results(self, param: dict) -> dict: 223 | """ 224 | Get the Results JSON from the Ergast API 225 | """ 226 | api_json = self._get_api_json( 227 | self._get_race_results_params, 228 | self._get_race_results_criteria, 229 | "results", 230 | param, 231 | ) 232 | 233 | return api_json["MRData"]["RaceTable"]["Races"] 234 | 235 | def get_races(self, param: dict) -> dict: 236 | """ 237 | Get the Races JSON from the Ergast API 238 | """ 239 | api_json = self._get_api_json( 240 | self._get_race_results_params, 241 | self._get_race_results_criteria, 242 | "races", 243 | param, 244 | ) 245 | 246 | return api_json["MRData"]["RaceTable"]["Races"] 247 | 248 | def get_seasons(self, param: dict) -> dict: 249 | """ 250 | Get the Seasons JSON from the Ergast API 251 | """ 252 | api_json = self._get_api_json( 253 | self._get_race_results_params, 254 | self._get_race_results_criteria, 255 | "seasons", 256 | param, 257 | ) 258 | 259 | return api_json["MRData"]["SeasonTable"]["Seasons"] 260 | 261 | def get_statuses(self, param: dict) -> dict: 262 | """ 263 | Get the Statuses JSON from the Ergast API 264 | """ 265 | api_json = self._get_api_json( 266 | self._get_race_results_params, 267 | self._get_race_results_criteria, 268 | "status", 269 | param, 270 | ) 271 | 272 | return api_json["MRData"]["StatusTable"]["Status"] 273 | 274 | # 275 | # Standings 276 | # 277 | 278 | def get_driver_standings(self, param: dict) -> dict: 279 | """ 280 | Get the Driver Standings JSON from the Ergast API 281 | """ 282 | api_json = self._get_api_json( 283 | self._get_standings_params, 284 | self._get_standings_criteria, 285 | "driverStandings", 286 | param, 287 | ) 288 | 289 | return api_json["MRData"]["StandingsTable"]["StandingsLists"] 290 | 291 | def get_constructor_standings(self, param: dict) -> dict: 292 | """ 293 | Get the Constructor Standings JSON from the Ergast API 294 | """ 295 | api_json = self._get_api_json( 296 | self._get_standings_params, 297 | self._get_standings_criteria, 298 | "constructorStandings", 299 | param, 300 | ) 301 | 302 | return api_json["MRData"]["StandingsTable"]["StandingsLists"] 303 | 304 | # 305 | # Laps and Pit Stops 306 | # 307 | 308 | def get_laps(self, param: dict) -> dict: 309 | """ 310 | Get the Laps JSON from the Ergast API 311 | """ 312 | api_json = self._get_api_json( 313 | self._get_laps_pit_stops_params, 314 | self._get_laps_pit_stops_criteria, 315 | "laps", 316 | param, 317 | ) 318 | 319 | return api_json["MRData"]["RaceTable"]["Races"] 320 | 321 | def get_pit_stops(self, param: dict) -> dict: 322 | """ 323 | Get the Pit Stops JSON from the Ergast API 324 | """ 325 | api_json = self._get_api_json( 326 | self._get_laps_pit_stops_params, 327 | self._get_laps_pit_stops_criteria, 328 | "pitstops", 329 | param, 330 | ) 331 | 332 | return api_json["MRData"]["RaceTable"]["Races"] 333 | -------------------------------------------------------------------------------- /tests/test_requester.py: -------------------------------------------------------------------------------- 1 | """ Tests for the Requester class """ 2 | import pytest 3 | 4 | from ergast_py.requester import Requester 5 | from tests import constants 6 | 7 | 8 | class TestRequester: 9 | """ 10 | Tests for the Requester class 11 | ~~~ 12 | 13 | """ 14 | 15 | r = Requester() 16 | 17 | def _construct_test_params( 18 | self, 19 | season=None, 20 | seasons=None, 21 | round_no=None, 22 | driver=None, 23 | constructor=None, 24 | grid=None, 25 | qualifying=None, 26 | sprint=None, 27 | result=None, 28 | fastest=None, 29 | circuit=None, 30 | status=None, 31 | standing=None, 32 | races=None, 33 | limit=None, 34 | offset=None, 35 | lap=None, 36 | pit_stop=None, 37 | ): 38 | return { 39 | "season": season, 40 | "seasons": seasons, 41 | "round": round_no, 42 | "driver": driver, 43 | "constructor": constructor, 44 | "grid": grid, 45 | "qualifying": qualifying, 46 | "sprint": sprint, 47 | "result": result, 48 | "fastest": fastest, 49 | "circuit": circuit, 50 | "status": status, 51 | "standing": standing, 52 | "races": races, 53 | "limit": limit, 54 | "offset": offset, 55 | "lap": lap, 56 | "pit_stop": pit_stop, 57 | } 58 | 59 | def test_run_request_doesnt_fail(self): 60 | """Assert a valid request doesn't fail""" 61 | self.r.run_request( 62 | season=2008, 63 | round_no=5, 64 | criteria=["drivers", "alonso"], 65 | resource="driverStandings", 66 | ) 67 | 68 | def test_run_request_fails(self): 69 | """Assert an invalid request fails""" 70 | with pytest.raises(Exception): 71 | self.r.run_request( 72 | season=2008, 73 | round_no=5, 74 | criteria=["drivers", "alonso"], 75 | resource="bad request", 76 | ) 77 | 78 | def test_get_circuit(self): 79 | """Test the get_circuit function""" 80 | expected = [constants.ISTANBUL] 81 | 82 | params = self._construct_test_params(season=2008, round_no=5) 83 | 84 | assert self.r.get_circuits(params) == expected 85 | 86 | def test_get_constructors(self): 87 | """Test the get_constructors function""" 88 | expected = [constants.FERRARI] 89 | 90 | params = self._construct_test_params(constructor="ferrari") 91 | 92 | assert self.r.get_constructors(params) == expected 93 | 94 | def test_get_drivers(self): 95 | """Test the get_drivers function""" 96 | expected = [constants.ALONSO] 97 | 98 | params = self._construct_test_params(driver="alonso") 99 | 100 | assert self.r.get_drivers(params) == expected 101 | 102 | def test_get_qualifying(self): 103 | """Test the get_qualifying function""" 104 | expected = [ 105 | { 106 | "season": "2008", 107 | "round": "5", 108 | "url": "http://en.wikipedia.org/wiki/2008_Turkish_Grand_Prix", 109 | "raceName": "Turkish Grand Prix", 110 | "Circuit": constants.ISTANBUL, 111 | "date": "2008-05-11", 112 | "time": "12:00:00Z", 113 | "QualifyingResults": [ 114 | { 115 | "number": "5", 116 | "position": "7", 117 | "Driver": constants.ALONSO, 118 | "Constructor": constants.RENAULT, 119 | "Q1": "1:26.836", 120 | "Q2": "1:26.522", 121 | "Q3": "1:28.422", 122 | } 123 | ], 124 | } 125 | ] 126 | 127 | params = self._construct_test_params(season=2008, round_no=5, qualifying=7) 128 | 129 | assert self.r.get_qualifying(params) == expected 130 | 131 | def test_get_sprints(self): 132 | """Test the get_sprints function""" 133 | expected = [ 134 | { 135 | "season": "2021", 136 | "round": "10", 137 | "url": "http://en.wikipedia.org/wiki/2021_British_Grand_Prix", 138 | "raceName": "British Grand Prix", 139 | "Circuit": constants.SILVERSTONE, 140 | "date": "2021-07-18", 141 | "time": "14:00:00Z", 142 | "SprintResults": [ 143 | { 144 | "number": "14", 145 | "position": "7", 146 | "positionText": "7", 147 | "points": "0", 148 | "Driver": constants.ALONSO, 149 | "Constructor": constants.ALPINE, 150 | "grid": "11", 151 | "laps": "17", 152 | "status": "Finished", 153 | "Time": {"millis": "1581953", "time": "+43.527"}, 154 | "FastestLap": {"lap": "17", "Time": {"time": "1:31.773"}}, 155 | } 156 | ], 157 | } 158 | ] 159 | 160 | params = self._construct_test_params(season=2021, round_no=10, sprint=7) 161 | 162 | assert self.r.get_sprints(params) == expected 163 | 164 | def test_get_results(self): 165 | """Test the get_results function""" 166 | expected = [ 167 | { 168 | "season": "2021", 169 | "round": "16", 170 | "url": "http://en.wikipedia.org/wiki/2021_Turkish_Grand_Prix", 171 | "raceName": "Turkish Grand Prix", 172 | "Circuit": constants.ISTANBUL, 173 | "date": "2021-10-10", 174 | "time": "12:00:00Z", 175 | "Results": [ 176 | { 177 | "number": "14", 178 | "position": "16", 179 | "positionText": "16", 180 | "points": "0", 181 | "Driver": constants.ALONSO, 182 | "Constructor": constants.ALPINE, 183 | "grid": "5", 184 | "laps": "57", 185 | "status": "+1 Lap", 186 | "FastestLap": { 187 | "rank": "14", 188 | "lap": "55", 189 | "Time": {"time": "1:33.252"}, 190 | "AverageSpeed": {"units": "kph", "speed": "206.073"}, 191 | }, 192 | } 193 | ], 194 | } 195 | ] 196 | 197 | params = self._construct_test_params(season=2021, round_no=16, result=16) 198 | 199 | assert self.r.get_results(params) == expected 200 | 201 | def test_get_races(self): 202 | """Test the get_races function""" 203 | expected = [ 204 | { 205 | "season": "2021", 206 | "round": "16", 207 | "url": "http://en.wikipedia.org/wiki/2021_Turkish_Grand_Prix", 208 | "raceName": "Turkish Grand Prix", 209 | "Circuit": constants.ISTANBUL, 210 | "date": "2021-10-10", 211 | "time": "12:00:00Z", 212 | "FirstPractice": {"date": "2021-10-08"}, 213 | "SecondPractice": {"date": "2021-10-08"}, 214 | "ThirdPractice": {"date": "2021-10-09"}, 215 | "Qualifying": {"date": "2021-10-09"}, 216 | } 217 | ] 218 | 219 | params = self._construct_test_params(season=2021, round_no=16) 220 | 221 | assert self.r.get_races(params) == expected 222 | 223 | def test_get_seasons(self): 224 | """Test the get_seasons function""" 225 | expected = [ 226 | { 227 | "season": "2021", 228 | "url": "http://en.wikipedia.org/wiki/2021_Formula_One_World_Championship", 229 | } 230 | ] 231 | 232 | params = self._construct_test_params(season=2021) 233 | 234 | assert self.r.get_seasons(params) == expected 235 | 236 | def test_get_statuses(self): 237 | """Test the get_statuses function""" 238 | expected = [{"statusId": "11", "count": "1", "status": "+1 Lap"}] 239 | 240 | params = self._construct_test_params(season=2021, round_no=16, result=16) 241 | 242 | assert self.r.get_statuses(params) == expected 243 | 244 | def test_get_driver_standings(self): 245 | """Test the get_driver_standings function""" 246 | expected = [ 247 | { 248 | "season": "2021", 249 | "round": "16", 250 | "DriverStandings": [ 251 | { 252 | "position": "10", 253 | "positionText": "10", 254 | "points": "58", 255 | "wins": "0", 256 | "Driver": constants.ALONSO, 257 | "Constructors": [constants.ALPINE], 258 | } 259 | ], 260 | } 261 | ] 262 | 263 | params = self._construct_test_params(season=2021, round_no=16, driver="alonso") 264 | 265 | assert self.r.get_driver_standings(params) == expected 266 | 267 | def test_get_constructor_standings(self): 268 | """Test the get_constructor_standi function""" 269 | expected = [ 270 | { 271 | "season": "2021", 272 | "round": "16", 273 | "ConstructorStandings": [ 274 | { 275 | "position": "5", 276 | "positionText": "5", 277 | "points": "104", 278 | "wins": "1", 279 | "Constructor": constants.ALPINE, 280 | } 281 | ], 282 | } 283 | ] 284 | 285 | params = self._construct_test_params(season=2021, round_no=16, standing=5) 286 | 287 | assert self.r.get_constructor_standings(params) == expected 288 | 289 | def test_get_laps(self): 290 | """Test the get_laps function""" 291 | expected = [ 292 | { 293 | "season": "2008", 294 | "round": "5", 295 | "url": "http://en.wikipedia.org/wiki/2008_Turkish_Grand_Prix", 296 | "raceName": "Turkish Grand Prix", 297 | "Circuit": constants.ISTANBUL, 298 | "date": "2008-05-11", 299 | "time": "12:00:00Z", 300 | "Laps": [ 301 | { 302 | "number": "1", 303 | "Timings": [ 304 | {"driverId": "alonso", "position": "5", "time": "1:57.681"} 305 | ], 306 | } 307 | ], 308 | } 309 | ] 310 | 311 | params = self._construct_test_params( 312 | season=2008, round_no=5, driver="alonso", lap=1 313 | ) 314 | 315 | assert self.r.get_laps(params) == expected 316 | 317 | def test_get_pit_stops(self): 318 | """Test the get_pit_stops function""" 319 | expected = [ 320 | { 321 | "season": "2021", 322 | "round": "16", 323 | "url": "http://en.wikipedia.org/wiki/2021_Turkish_Grand_Prix", 324 | "raceName": "Turkish Grand Prix", 325 | "Circuit": constants.ISTANBUL, 326 | "date": "2021-10-10", 327 | "time": "12:00:00Z", 328 | "PitStops": [ 329 | { 330 | "driverId": "alonso", 331 | "lap": "30", 332 | "stop": "1", 333 | "time": "15:51:43", 334 | "duration": "29.116", 335 | } 336 | ], 337 | } 338 | ] 339 | 340 | params = self._construct_test_params( 341 | season=2021, round_no=16, driver="alonso", pit_stop=1 342 | ) 343 | 344 | assert self.r.get_pit_stops(params) == expected 345 | -------------------------------------------------------------------------------- /tests/test_type_constructor.py: -------------------------------------------------------------------------------- 1 | """ Tests for the Type Constructor class """ 2 | import datetime 3 | 4 | from ergast_py.models.average_speed import AverageSpeed 5 | from ergast_py.models.circuit import Circuit 6 | from ergast_py.models.constructor import Constructor 7 | from ergast_py.models.constructor_standing import ConstructorStanding 8 | from ergast_py.models.driver import Driver 9 | from ergast_py.models.driver_standing import DriverStanding 10 | from ergast_py.models.fastest_lap import FastestLap 11 | from ergast_py.models.lap import Lap 12 | from ergast_py.models.location import Location 13 | from ergast_py.models.pit_stop import PitStop 14 | from ergast_py.models.race import Race 15 | from ergast_py.models.result import Result 16 | from ergast_py.models.season import Season 17 | from ergast_py.models.standings_list import StandingsList 18 | from ergast_py.models.status import Status 19 | from ergast_py.models.time import Time 20 | from ergast_py.models.timing import Timing 21 | from ergast_py.requester import Requester 22 | from ergast_py.type_constructor import TypeConstructor 23 | from tests import constants 24 | 25 | 26 | class TestTypeConstructor: 27 | """ 28 | Tests for the Type Constructor class 29 | """ 30 | 31 | t = TypeConstructor() 32 | r = Requester() 33 | 34 | # 35 | # Tests 36 | # 37 | 38 | def test_construct_circuit(self): 39 | """Assert construct_circuit function works""" 40 | params = [constants.BAHRAIN] 41 | 42 | location = Location( 43 | latitude=26.0325, longitude=50.5106, locality="Sakhir", country="Bahrain" 44 | ) 45 | 46 | expected = [ 47 | Circuit( 48 | circuit_id="bahrain", 49 | url="http://en.wikipedia.org/wiki/Bahrain_International_Circuit", 50 | circuit_name="Bahrain International Circuit", 51 | location=location, 52 | ) 53 | ] 54 | 55 | assert expected == self.t.construct_circuits(params) 56 | 57 | def test_construct_constructor(self): 58 | """Assert construct_constructor function works""" 59 | params = [constants.ALPINE] 60 | 61 | expected = [ 62 | Constructor( 63 | constructor_id="alpine", 64 | url="http://en.wikipedia.org/wiki/Alpine_F1_Team", 65 | name="Alpine F1 Team", 66 | nationality="French", 67 | ) 68 | ] 69 | 70 | assert expected == self.t.construct_constructors(params) 71 | 72 | def test_construct_driver(self): 73 | """Assert construct_driver function works""" 74 | params = [constants.ALONSO] 75 | 76 | expected = [ 77 | Driver( 78 | driver_id="alonso", 79 | code="ALO", 80 | url="http://en.wikipedia.org/wiki/Fernando_Alonso", 81 | given_name="Fernando", 82 | family_name="Alonso", 83 | date_of_birth=datetime.date(year=1981, month=7, day=29), 84 | nationality="Spanish", 85 | permanent_number=14, 86 | ) 87 | ] 88 | 89 | assert expected == self.t.construct_drivers(params) 90 | 91 | def test_construct_races(self): 92 | """Assert construct_races function works""" 93 | params = [ 94 | { 95 | "season": "2022", 96 | "round": "1", 97 | "url": "http://en.wikipedia.org/wiki/2022_Bahrain_Grand_Prix", 98 | "raceName": "Bahrain Grand Prix", 99 | "Circuit": constants.BAHRAIN, 100 | "date": "2022-03-20", 101 | "time": "15:00:00Z", 102 | "FirstPractice": {"date": "2022-03-18", "time": "12:00:00Z"}, 103 | "SecondPractice": {"date": "2022-03-18", "time": "15:00:00Z"}, 104 | "ThirdPractice": {"date": "2022-03-19", "time": "12:00:00Z"}, 105 | "Qualifying": {"date": "2022-03-19", "time": "15:00:00Z"}, 106 | } 107 | ] 108 | 109 | location = Location( 110 | latitude=26.0325, longitude=50.5106, locality="Sakhir", country="Bahrain" 111 | ) 112 | bahrain = Circuit( 113 | circuit_id="bahrain", 114 | url="http://en.wikipedia.org/wiki/Bahrain_International_Circuit", 115 | circuit_name="Bahrain International Circuit", 116 | location=location, 117 | ) 118 | 119 | expected = [ 120 | Race( 121 | season=2022, 122 | round_no=1, 123 | url="http://en.wikipedia.org/wiki/2022_Bahrain_Grand_Prix", 124 | race_name="Bahrain Grand Prix", 125 | circuit=bahrain, 126 | date=datetime.datetime( 127 | year=2022, month=3, day=20, hour=15, tzinfo=datetime.timezone.utc 128 | ), 129 | results=[], 130 | first_practice=datetime.datetime( 131 | year=2022, month=3, day=18, hour=12, tzinfo=datetime.timezone.utc 132 | ), 133 | second_practice=datetime.datetime( 134 | year=2022, month=3, day=18, hour=15, tzinfo=datetime.timezone.utc 135 | ), 136 | third_practice=datetime.datetime( 137 | year=2022, month=3, day=19, hour=12, tzinfo=datetime.timezone.utc 138 | ), 139 | sprint=None, 140 | sprint_results=[], 141 | qualifying=datetime.datetime( 142 | year=2022, month=3, day=19, hour=15, tzinfo=datetime.timezone.utc 143 | ), 144 | qualifying_results=[], 145 | pit_stops=[], 146 | laps=[], 147 | ) 148 | ] 149 | 150 | assert expected == self.t.construct_races(params) 151 | 152 | def test_construct_time(self): 153 | """Assert construct_time function works""" 154 | params = {"millis": "5853584", "time": "1:37:33.584"} 155 | 156 | expected = Time( 157 | millis=datetime.time(hour=1, minute=37, second=33, microsecond=584000), 158 | time="1:37:33.584", 159 | ) 160 | 161 | assert expected == self.t.construct_time(params) 162 | 163 | def test_construct_results(self): 164 | """Assert construct_results function works""" 165 | params = [ 166 | { 167 | "number": "16", 168 | "position": "1", 169 | "positionText": "1", 170 | "points": "26", 171 | "Driver": constants.LECLERC, 172 | "Constructor": constants.FERRARI, 173 | "grid": "1", 174 | "laps": "57", 175 | "status": "Finished", 176 | "Time": {"millis": "5853584", "time": "1:37:33.584"}, 177 | "FastestLap": { 178 | "rank": "1", 179 | "lap": "51", 180 | "Time": {"time": "1:34.570"}, 181 | "AverageSpeed": {"units": "kph", "speed": "206.018"}, 182 | }, 183 | } 184 | ] 185 | 186 | avg_speed = AverageSpeed(units="kph", speed=206.018) 187 | fastest_lap = FastestLap( 188 | rank=1, 189 | lap=51, 190 | time=datetime.time(minute=1, second=34, microsecond=570000), 191 | average_speed=avg_speed, 192 | ) 193 | driver = Driver( 194 | driver_id="leclerc", 195 | code="LEC", 196 | url="http://en.wikipedia.org/wiki/Charles_Leclerc", 197 | given_name="Charles", 198 | family_name="Leclerc", 199 | date_of_birth=datetime.date(year=1997, month=10, day=16), 200 | nationality="Monegasque", 201 | permanent_number=16, 202 | ) 203 | constructor = Constructor( 204 | constructor_id="ferrari", 205 | url="http://en.wikipedia.org/wiki/Scuderia_Ferrari", 206 | name="Ferrari", 207 | nationality="Italian", 208 | ) 209 | 210 | expected = [ 211 | Result( 212 | number=16, 213 | position=1, 214 | position_text="1", 215 | points=26.0, 216 | driver=driver, 217 | constructor=constructor, 218 | grid=1, 219 | laps=57, 220 | status=1, 221 | time=Time( 222 | millis=datetime.time( 223 | hour=1, minute=37, second=33, microsecond=584000 224 | ), 225 | time="1:37:33.584", 226 | ), 227 | fastest_lap=fastest_lap, 228 | qual_1=None, 229 | qual_2=None, 230 | qual_3=None, 231 | ) 232 | ] 233 | 234 | assert expected == self.t.construct_results(params) 235 | 236 | def test_construct_pit_stops(self): 237 | """Assert construct_pit_stops function works""" 238 | params = [ 239 | { 240 | "driverId": "alonso", 241 | "lap": "11", 242 | "stop": "1", 243 | "time": "18:22:10", 244 | "duration": "25.365", 245 | } 246 | ] 247 | 248 | expected = [ 249 | PitStop( 250 | driver_id="alonso", 251 | lap=11, 252 | stop=1, 253 | local_time=datetime.time(hour=18, minute=22, second=10), 254 | duration=datetime.time(second=25, microsecond=365000), 255 | ) 256 | ] 257 | 258 | assert expected == self.t.construct_pit_stops(params) 259 | 260 | def test_construct_laps(self): 261 | """Assert construct_laps function works""" 262 | params = [ 263 | { 264 | "number": "1", 265 | "Timings": [ 266 | {"driverId": "leclerc", "position": "1", "time": "1:39.070"} 267 | ], 268 | } 269 | ] 270 | 271 | timing = Timing( 272 | driver_id="leclerc", 273 | position=1, 274 | time=datetime.time(minute=1, second=39, microsecond=70000), 275 | ) 276 | 277 | expected = [Lap(number=1, timings=[timing])] 278 | 279 | assert expected == self.t.construct_laps(params) 280 | 281 | def test_construct_seasons(self): 282 | """Assert construct_seasons function works""" 283 | params = [ 284 | { 285 | "season": "2022", 286 | "url": "http://en.wikipedia.org/wiki/2022_Formula_One_World_Championship", 287 | } 288 | ] 289 | 290 | expected = [ 291 | Season( 292 | season=2022, 293 | url="http://en.wikipedia.org/wiki/2022_Formula_One_World_Championship", 294 | ) 295 | ] 296 | 297 | assert expected == self.t.construct_seasons(params) 298 | 299 | def test_construct_statuses(self): 300 | """Assert construct_statuses function works""" 301 | params = [{"statusId": "1", "count": "1", "status": "Finished"}] 302 | 303 | expected = [Status(status_id=1, count=1, status="Finished")] 304 | 305 | assert expected == self.t.construct_statuses(params) 306 | 307 | def test_construct_standings_lists(self): 308 | """Assert construct_standings_lists function works""" 309 | # Check Driver Standings 310 | # Check constructor standings 311 | params = [ 312 | { 313 | "season": "2005", 314 | "round": "19", 315 | "DriverStandings": [ 316 | { 317 | "position": "1", 318 | "positionText": "1", 319 | "points": "133", 320 | "wins": "7", 321 | "Driver": constants.ALONSO, 322 | "Constructors": [constants.ALPINE], 323 | } 324 | ], 325 | "ConstructorStandings": [ 326 | { 327 | "position": "1", 328 | "positionText": "1", 329 | "points": "235", 330 | "wins": "5", 331 | "Constructor": constants.FERRARI, 332 | } 333 | ], 334 | } 335 | ] 336 | 337 | alpine = Constructor( 338 | constructor_id="alpine", 339 | url="http://en.wikipedia.org/wiki/Alpine_F1_Team", 340 | name="Alpine F1 Team", 341 | nationality="French", 342 | ) 343 | alonso = Driver( 344 | driver_id="alonso", 345 | code="ALO", 346 | url="http://en.wikipedia.org/wiki/Fernando_Alonso", 347 | given_name="Fernando", 348 | family_name="Alonso", 349 | date_of_birth=datetime.date(year=1981, month=7, day=29), 350 | nationality="Spanish", 351 | permanent_number=14, 352 | ) 353 | driver_standings = DriverStanding( 354 | position=1, 355 | position_text="1", 356 | points=133, 357 | wins=7, 358 | driver=alonso, 359 | constructors=[alpine], 360 | ) 361 | ferrari = Constructor( 362 | constructor_id="ferrari", 363 | url="http://en.wikipedia.org/wiki/Scuderia_Ferrari", 364 | name="Ferrari", 365 | nationality="Italian", 366 | ) 367 | constructor_standings = ConstructorStanding( 368 | position=1, position_text="1", points=235, wins=5, constructor=ferrari 369 | ) 370 | 371 | expected = [ 372 | StandingsList( 373 | season=2005, 374 | round_no=19, 375 | driver_standings=[driver_standings], 376 | constructor_standings=[constructor_standings], 377 | ) 378 | ] 379 | 380 | assert expected == self.t.construct_standings_lists(params) 381 | -------------------------------------------------------------------------------- /ergast_py/ergast.py: -------------------------------------------------------------------------------- 1 | """ Ergast class """ 2 | from __future__ import annotations 3 | 4 | from typing import Callable 5 | 6 | from ergast_py.constants.status_type import StatusType 7 | from ergast_py.models.circuit import Circuit 8 | from ergast_py.models.constructor import Constructor 9 | from ergast_py.models.driver import Driver 10 | from ergast_py.models.race import Race 11 | from ergast_py.models.season import Season 12 | from ergast_py.models.standings_list import StandingsList 13 | from ergast_py.models.status import Status 14 | from ergast_py.requester import Requester 15 | from ergast_py.type_constructor import TypeConstructor 16 | 17 | 18 | # pylint: disable=too-many-public-methods 19 | class Ergast: 20 | """ 21 | Ergast 22 | ~~~~~~ 23 | Class for querying the Ergast API. 24 | 25 | Build up the queries using the available functions. 26 | 27 | >>> e = ergast_py.Ergast() 28 | >>> e.season(2021).round(1).driver("alonso") 29 | 30 | Get the data using ``.get_xyz()`` functions. 31 | 32 | >>> print(e.get_result()) 33 | """ 34 | 35 | def __init__(self) -> None: 36 | self.params = {} 37 | self.reset() 38 | self.requester = Requester() 39 | self.type_constructor = TypeConstructor() 40 | 41 | def reset(self) -> None: 42 | """ 43 | Reset the Ergast query building. 44 | 45 | Should be called after a query is run to prevent forward interaction. 46 | """ 47 | self.params = { 48 | "season": None, 49 | "seasons": None, 50 | "round": None, 51 | "driver": None, 52 | "constructor": None, 53 | "grid": None, 54 | "qualifying": None, 55 | "sprint": None, 56 | "result": None, 57 | "fastest": None, 58 | "circuit": None, 59 | "status": None, 60 | "standing": None, 61 | "races": None, 62 | "limit": None, 63 | "offset": None, 64 | "lap": None, 65 | "pit_stop": None, 66 | } 67 | 68 | # 69 | # FILTER FUNCTIONS 70 | # 71 | 72 | def season(self, year: int = "current") -> Ergast: 73 | """ 74 | Add a season to the current query 75 | 76 | >>> e.season(2022).get_races() 77 | """ 78 | self.params["season"] = year 79 | return self 80 | 81 | def round(self, round_no: int = "last") -> Ergast: 82 | """ 83 | Add a round to the current query 84 | 85 | >>> e.season(1999).round(3).get_circuit() 86 | """ 87 | self.params["round"] = round_no 88 | return self 89 | 90 | def driver(self, driver) -> Ergast: 91 | """ 92 | Add a driver to the current query 93 | 94 | >>> alonso = e.driver("alonso").get_driver() 95 | >>> e.driver(alonso).get_results() 96 | """ 97 | if isinstance(driver, str): 98 | self.params["driver"] = driver 99 | elif isinstance(driver, Driver): 100 | self.params["driver"] = driver.driver_id 101 | else: 102 | raise TypeError("Function parameter must be of type Driver or str") 103 | return self 104 | 105 | def constructor(self, constructor: Constructor) -> Ergast: 106 | """ 107 | Add a constructor to the current query 108 | 109 | >>> mercedes = e.constructor("mercedes").get_constructor() 110 | >>> e.constructor(mercedes).get_constructor_standings() 111 | """ 112 | if isinstance(constructor, str): 113 | self.params["constructor"] = constructor 114 | elif isinstance(constructor, Constructor): 115 | self.params["constructor"] = constructor.constructor_id 116 | else: 117 | raise TypeError("Function parameter must be of type Constructor or str") 118 | return self 119 | 120 | def qualifying(self, position: int) -> Ergast: 121 | """ 122 | Add a qualifying position to the current query 123 | 124 | >>> e.season(2021).qualifying(1).get_drivers() 125 | """ 126 | self.params["qualifying"] = position 127 | return self 128 | 129 | def sprint(self, position: int) -> Ergast: 130 | """ 131 | Add a sprint result to the current query 132 | 133 | >>> e.season(2021).sprint(3).get_sprints() 134 | """ 135 | self.params["sprint"] = position 136 | return self 137 | 138 | def grid(self, position: int) -> Ergast: 139 | """ 140 | Add a starting grid position to the current query 141 | 142 | >>> e.season(2021).round(1).grid(1).get_result() 143 | """ 144 | self.params["grid"] = position 145 | return self 146 | 147 | def result(self, position: int) -> Ergast: 148 | """ 149 | Add a final result to the current query 150 | 151 | >>> e.season(2021).round(1).result(20).get_result() 152 | """ 153 | self.params["result"] = position 154 | return self 155 | 156 | def fastest(self, position: int) -> Ergast: 157 | """ 158 | Add a driver's fastest lap ranking to the current query 159 | 160 | >>> e.season(2021).round(1).fastest(1).get_driver() 161 | """ 162 | self.params["fastest"] = position 163 | return self 164 | 165 | def circuit(self, circuit) -> Ergast: 166 | """ 167 | Add a circuit to the current query 168 | 169 | >>> silverstone = e.circuit("silverstone").get_circuit() 170 | >>> e.circuit(silverstone) 171 | """ 172 | if isinstance(circuit, str): 173 | self.params["circuit"] = circuit 174 | elif isinstance(circuit, Circuit): 175 | self.params["circuit"] = circuit.circuit_id 176 | else: 177 | raise TypeError("Function parameter must be of type Circuit or str") 178 | return self 179 | 180 | def status(self, status) -> Ergast: 181 | """ 182 | Add a finishing status to the current query 183 | 184 | >>> e.driver("alonso").status(2) 185 | """ 186 | if isinstance(status, str): 187 | self.params["status"] = StatusType().string_to_id[status] 188 | elif isinstance(status, int): 189 | self.params["status"] = status 190 | else: 191 | raise TypeError("Function parameter must be of type int or str") 192 | return self 193 | 194 | def standing(self, position: int) -> Ergast: 195 | """ 196 | Add a position in the standings to the current query 197 | 198 | >>> e.standing(1).get_driver_standings() 199 | """ 200 | self.params["standing"] = position 201 | return self 202 | 203 | def lap(self, lap_number: int) -> Ergast: 204 | """ 205 | Add a certain lap to the current query 206 | 207 | >>> e.season(2021).round(1).lap(1).get_laps() 208 | """ 209 | self.params["lap"] = lap_number 210 | return self 211 | 212 | def pit_stop(self, stop_number: int) -> Ergast: 213 | """ 214 | Add a certain pit stop to the current query 215 | 216 | >>> e.season(2021).round(1).pit_stop(1).get_pit_stops() 217 | """ 218 | self.params["pit_stop"] = stop_number 219 | return self 220 | 221 | # 222 | # PAGING FUNCTIONS 223 | # 224 | 225 | def limit(self, amount: int) -> Ergast: 226 | """ 227 | Limit the results in the current query 228 | 229 | >>> e.season(2021).limit(2).get_drivers() 230 | """ 231 | self.params["limit"] = amount 232 | return self 233 | 234 | def offset(self, amount: int) -> Ergast: 235 | """ 236 | Offset the results in the current query 237 | 238 | >>> e.season(2021).limit(2).offset(4).get_drivers() 239 | """ 240 | self.params["offset"] = amount 241 | return self 242 | 243 | # 244 | # RETURN FUNCTIONS 245 | # 246 | 247 | # Lambda queries 248 | 249 | def _get_items(self, get_items: Callable, construct_items: Callable): 250 | items_json = get_items(self.params) 251 | items = construct_items(items_json) 252 | self.reset() 253 | return items 254 | 255 | def _get_item(self, get_items: Callable, construct_items: Callable): 256 | items = self._get_items(get_items, construct_items) 257 | if len(items) == 1: 258 | return items[0] 259 | raise Exception( 260 | f"Data loss will occur with this query. 1 item" 261 | f" requested but {len(items)} found." 262 | ) 263 | 264 | # Race and Results Queries 265 | 266 | def get_circuits(self) -> list[Circuit]: 267 | """ 268 | Get a list of circuits from the current query 269 | """ 270 | return self._get_items( 271 | self.requester.get_circuits, self.type_constructor.construct_circuits 272 | ) 273 | 274 | def get_circuit(self) -> Circuit: 275 | """ 276 | Get a circuit from the current query 277 | """ 278 | return self._get_item( 279 | self.requester.get_circuits, self.type_constructor.construct_circuits 280 | ) 281 | 282 | def get_constructors(self) -> list[Constructor]: 283 | """ 284 | Get a list of constructors from the current query 285 | """ 286 | return self._get_items( 287 | self.requester.get_constructors, 288 | self.type_constructor.construct_constructors, 289 | ) 290 | 291 | def get_constructor(self) -> Constructor: 292 | """ 293 | Get a constructor from the current query 294 | """ 295 | return self._get_item( 296 | self.requester.get_constructors, 297 | self.type_constructor.construct_constructors, 298 | ) 299 | 300 | def get_drivers(self) -> list[Driver]: 301 | """ 302 | Get a list of drivers from the current query 303 | """ 304 | return self._get_items( 305 | self.requester.get_drivers, self.type_constructor.construct_drivers 306 | ) 307 | 308 | def get_driver(self) -> Driver: 309 | """ 310 | Get a driver from the current query 311 | """ 312 | return self._get_item( 313 | self.requester.get_drivers, self.type_constructor.construct_drivers 314 | ) 315 | 316 | def get_qualifyings(self) -> list[Race]: 317 | """ 318 | Get a list of qualifyings from the current query 319 | """ 320 | return self._get_items( 321 | self.requester.get_qualifying, self.type_constructor.construct_races 322 | ) 323 | 324 | def get_qualifying(self) -> Race: 325 | """ 326 | Get a qualifying from the current query 327 | """ 328 | return self._get_item( 329 | self.requester.get_qualifying, self.type_constructor.construct_races 330 | ) 331 | 332 | def get_sprints(self) -> list[Race]: 333 | """ 334 | Get a list of sprints from the current query 335 | """ 336 | return self._get_items( 337 | self.requester.get_sprints, self.type_constructor.construct_races 338 | ) 339 | 340 | def get_sprint(self) -> Race: 341 | """ 342 | Get a sprint from the current query 343 | """ 344 | return self._get_item( 345 | self.requester.get_sprints, self.type_constructor.construct_races 346 | ) 347 | 348 | def get_results(self) -> list[Race]: 349 | """ 350 | Get a list of results from the current query 351 | """ 352 | return self._get_items( 353 | self.requester.get_results, self.type_constructor.construct_races 354 | ) 355 | 356 | def get_result(self) -> Race: 357 | """ 358 | Get a result from the current query 359 | """ 360 | return self._get_item( 361 | self.requester.get_results, self.type_constructor.construct_races 362 | ) 363 | 364 | def get_races(self) -> list[Race]: 365 | """ 366 | Get a list of races from the current query 367 | """ 368 | return self._get_items( 369 | self.requester.get_races, self.type_constructor.construct_races 370 | ) 371 | 372 | def get_race(self) -> Race: 373 | """ 374 | Get a race from the current query 375 | """ 376 | return self._get_item( 377 | self.requester.get_races, self.type_constructor.construct_races 378 | ) 379 | 380 | def get_seasons(self) -> list[Season]: 381 | """ 382 | Get a list of seasons from the current query 383 | """ 384 | return self._get_items( 385 | self.requester.get_seasons, self.type_constructor.construct_seasons 386 | ) 387 | 388 | def get_season(self) -> Season: 389 | """ 390 | Get a season from the current query 391 | """ 392 | return self._get_item( 393 | self.requester.get_seasons, self.type_constructor.construct_seasons 394 | ) 395 | 396 | def get_statuses(self) -> list[Status]: 397 | """ 398 | Get a list of statuses from the current query 399 | """ 400 | return self._get_items( 401 | self.requester.get_statuses, self.type_constructor.construct_statuses 402 | ) 403 | 404 | def get_status(self) -> Status: 405 | """ 406 | Get a status from the current query 407 | """ 408 | return self._get_item( 409 | self.requester.get_statuses, self.type_constructor.construct_statuses 410 | ) 411 | 412 | # Standings Queries 413 | 414 | def get_driver_standings(self) -> list[StandingsList]: 415 | """ 416 | Get a list of driver standings from the current query 417 | """ 418 | return self._get_items( 419 | self.requester.get_driver_standings, 420 | self.type_constructor.construct_standings_lists, 421 | ) 422 | 423 | def get_driver_standing(self) -> StandingsList: 424 | """ 425 | Get a driver standing from the current query 426 | """ 427 | return self._get_item( 428 | self.requester.get_driver_standings, 429 | self.type_constructor.construct_standings_lists, 430 | ) 431 | 432 | def get_constructor_standings(self) -> list[StandingsList]: 433 | """ 434 | Get a list of constructor standings from the current query 435 | """ 436 | return self._get_items( 437 | self.requester.get_constructor_standings, 438 | self.type_constructor.construct_standings_lists, 439 | ) 440 | 441 | def get_constructor_standing(self) -> StandingsList: 442 | """ 443 | Get a constructor standing from the current query 444 | """ 445 | return self._get_item( 446 | self.requester.get_constructor_standings, 447 | self.type_constructor.construct_standings_lists, 448 | ) 449 | 450 | # Laps and Pit Stops Queries 451 | 452 | def get_laps(self) -> list[Race]: 453 | """ 454 | Get a list of laps from the current query 455 | """ 456 | return self._get_items( 457 | self.requester.get_laps, self.type_constructor.construct_races 458 | ) 459 | 460 | def get_lap(self) -> Race: 461 | """ 462 | Get a lap from the current query 463 | """ 464 | return self._get_item( 465 | self.requester.get_laps, self.type_constructor.construct_races 466 | ) 467 | 468 | def get_pit_stops(self) -> list[Race]: 469 | """ 470 | Get a list of pit stops from the current query 471 | """ 472 | return self._get_items( 473 | self.requester.get_pit_stops, self.type_constructor.construct_races 474 | ) 475 | 476 | def get_pit_stop(self) -> Race: 477 | """ 478 | Get a pit stop from the current query 479 | """ 480 | return self._get_item( 481 | self.requester.get_pit_stops, self.type_constructor.construct_races 482 | ) 483 | -------------------------------------------------------------------------------- /ergast_py/type_constructor.py: -------------------------------------------------------------------------------- 1 | """ TypeConstructor class """ 2 | from ergast_py.constants.expected import Expected 3 | from ergast_py.constants.status_type import StatusType 4 | from ergast_py.helpers import Helpers 5 | from ergast_py.models.average_speed import AverageSpeed 6 | from ergast_py.models.circuit import Circuit 7 | from ergast_py.models.constructor import Constructor 8 | from ergast_py.models.constructor_standing import ConstructorStanding 9 | from ergast_py.models.driver import Driver 10 | from ergast_py.models.driver_standing import DriverStanding 11 | from ergast_py.models.fastest_lap import FastestLap 12 | from ergast_py.models.lap import Lap 13 | from ergast_py.models.location import Location 14 | from ergast_py.models.pit_stop import PitStop 15 | from ergast_py.models.race import Race 16 | from ergast_py.models.result import Result 17 | from ergast_py.models.season import Season 18 | from ergast_py.models.standings_list import StandingsList 19 | from ergast_py.models.status import Status 20 | from ergast_py.models.time import Time 21 | from ergast_py.models.timing import Timing 22 | 23 | 24 | # pylint: disable=too-many-public-methods 25 | class TypeConstructor: 26 | """ 27 | Class for constructing types out of dicts 28 | """ 29 | 30 | def __init__(self) -> None: 31 | pass 32 | 33 | # 34 | # PRIVATE METHODS 35 | # 36 | 37 | @staticmethod 38 | def _populate_missing(expected: dict, actual: dict) -> dict: 39 | for item in expected: 40 | if item not in actual: 41 | if expected[item] == "dict": 42 | actual[item] = {} 43 | elif expected[item] == "float": 44 | actual[item] = "0.0" 45 | elif expected[item] == "int": 46 | actual[item] = "0" 47 | else: 48 | actual[item] = "" 49 | return actual 50 | 51 | def _populate_missing_location(self, location: dict) -> dict: 52 | return self._populate_missing(expected=Expected().location, actual=location) 53 | 54 | def _populate_missing_circuit(self, circuit: dict) -> dict: 55 | return self._populate_missing(expected=Expected().circuit, actual=circuit) 56 | 57 | def _populate_missing_constructor(self, constructor: dict) -> dict: 58 | return self._populate_missing( 59 | expected=Expected().constructor, actual=constructor 60 | ) 61 | 62 | def _populate_missing_driver(self, driver: dict) -> dict: 63 | return self._populate_missing(expected=Expected().driver, actual=driver) 64 | 65 | def _populate_missing_race(self, race: dict) -> dict: 66 | return self._populate_missing(expected=Expected().race, actual=race) 67 | 68 | def _populate_missing_result(self, result: dict) -> dict: 69 | return self._populate_missing(expected=Expected().result, actual=result) 70 | 71 | def _populate_missing_fastest_lap(self, fastest_lap: dict) -> dict: 72 | return self._populate_missing( 73 | expected=Expected().fastest_lap, actual=fastest_lap 74 | ) 75 | 76 | def _populate_missing_average_speed(self, average_speed: dict) -> dict: 77 | return self._populate_missing( 78 | expected=Expected().average_speed, actual=average_speed 79 | ) 80 | 81 | def _populate_missing_pit_stop(self, pit_stop: dict) -> dict: 82 | return self._populate_missing(expected=Expected().pit_stop, actual=pit_stop) 83 | 84 | def _populate_missing_lap(self, lap: dict) -> dict: 85 | return self._populate_missing(expected=Expected().lap, actual=lap) 86 | 87 | def _populate_missing_timing(self, timing: dict) -> dict: 88 | return self._populate_missing(expected=Expected().timing, actual=timing) 89 | 90 | def _populate_missing_season(self, season: dict) -> dict: 91 | return self._populate_missing(expected=Expected().season, actual=season) 92 | 93 | def _populate_missing_status(self, status: dict) -> dict: 94 | return self._populate_missing(expected=Expected().status, actual=status) 95 | 96 | def _populate_missing_driver_standing(self, standing: dict) -> dict: 97 | return self._populate_missing( 98 | expected=Expected().driver_standing, actual=standing 99 | ) 100 | 101 | def _populate_missing_constructor_standing(self, standing: dict) -> dict: 102 | return self._populate_missing( 103 | expected=Expected().constructor_standing, actual=standing 104 | ) 105 | 106 | def _populate_missing_standings_list(self, standings_list: dict) -> dict: 107 | return self._populate_missing( 108 | expected=Expected().standings_list, actual=standings_list 109 | ) 110 | 111 | def _populate_missing_time(self, time: dict) -> dict: 112 | return self._populate_missing(expected=Expected().time, actual=time) 113 | 114 | # 115 | # PUBLIC METHODS 116 | # 117 | 118 | def construct_location(self, location: dict) -> Location: 119 | """ 120 | Construct a Location from a JSON dictionary 121 | """ 122 | location = self._populate_missing_location(location=location) 123 | return Location( 124 | latitude=float(location["lat"]), 125 | longitude=float(location["long"]), 126 | locality=location["locality"], 127 | country=location["country"], 128 | ) 129 | 130 | def construct_circuit(self, circuit: dict) -> Circuit: 131 | """ 132 | Construct a Circuit from a JSON dictionary 133 | """ 134 | circuit = self._populate_missing_circuit(circuit) 135 | return Circuit( 136 | circuit_id=circuit["circuitId"], 137 | url=circuit["url"], 138 | circuit_name=circuit["circuitName"], 139 | location=self.construct_location(circuit["Location"]), 140 | ) 141 | 142 | def construct_circuits(self, circuits: dict) -> list[Circuit]: 143 | """ 144 | Construct a list of Circuits from a JSON dictionary 145 | """ 146 | return [self.construct_circuit(circuit) for circuit in circuits] 147 | 148 | def construct_constructor(self, constructor: dict) -> Constructor: 149 | """ 150 | Construct a Constructor from a JSON dictionary 151 | """ 152 | constructor = self._populate_missing_constructor(constructor) 153 | return Constructor( 154 | constructor_id=constructor["constructorId"], 155 | url=constructor["url"], 156 | name=constructor["name"], 157 | nationality=constructor["nationality"], 158 | ) 159 | 160 | def construct_constructors(self, constructors: dict) -> list[Constructor]: 161 | """ 162 | Construct a list of Constructors from a JSON dictionary 163 | """ 164 | return [self.construct_constructor(constructor) for constructor in constructors] 165 | 166 | def construct_driver(self, driver: dict) -> Driver: 167 | """ 168 | Construct a Driver from a JSON dictionary 169 | """ 170 | driver = self._populate_missing_driver(driver) 171 | return Driver( 172 | driver_id=driver["driverId"], 173 | permanent_number=int(driver["permanentNumber"]), 174 | code=driver["code"], 175 | url=driver["url"], 176 | given_name=driver["givenName"], 177 | family_name=driver["familyName"], 178 | date_of_birth=Helpers().construct_date(driver["dateOfBirth"]), 179 | nationality=driver["nationality"], 180 | ) 181 | 182 | def construct_drivers(self, drivers: dict) -> list[Driver]: 183 | """ 184 | Construct a list of Drivers from a JSON dictionary 185 | """ 186 | return [self.construct_driver(driver) for driver in drivers] 187 | 188 | def construct_race(self, race: dict) -> Race: 189 | """ 190 | Construct a Race from a JSON dictionary 191 | """ 192 | race = self._populate_missing_race(race) 193 | 194 | try: 195 | sprint = Helpers().construct_datetime_dict(race["Sprint"]) 196 | except ValueError: 197 | sprint = None 198 | 199 | sessions = { 200 | "FirstPractice": None, 201 | "SecondPractice": None, 202 | "ThirdPractice": None, 203 | "Qualifying": None, 204 | } 205 | for key in sessions: 206 | try: 207 | sessions[key] = Helpers().construct_datetime_dict(race[key]) 208 | except ValueError: 209 | # Warn that the value isn't present 210 | continue 211 | 212 | return Race( 213 | season=int(race["season"]), 214 | round_no=int(race["round"]), 215 | url=race["url"], 216 | race_name=race["raceName"], 217 | circuit=self.construct_circuit(race["Circuit"]), 218 | date=Helpers().construct_datetime_str(date=race["date"], time=race["time"]), 219 | results=self.construct_results(race["Results"]), 220 | first_practice=sessions["FirstPractice"], 221 | second_practice=sessions["SecondPractice"], 222 | third_practice=sessions["ThirdPractice"], 223 | sprint=sprint, 224 | sprint_results=self.construct_results(race["SprintResults"]), 225 | qualifying=sessions["Qualifying"], 226 | qualifying_results=self.construct_results(race["QualifyingResults"]), 227 | pit_stops=self.construct_pit_stops(race["PitStops"]), 228 | laps=self.construct_laps(race["Laps"]), 229 | ) 230 | 231 | def construct_time(self, time: dict) -> Time: 232 | """ 233 | Construct a Time object from a JSON dictionary 234 | """ 235 | time = self._populate_missing_time(time) 236 | 237 | try: 238 | millis = Helpers().construct_lap_time_millis(millis=time) 239 | except ValueError: 240 | millis = None 241 | 242 | return Time(millis=millis, time=time["time"]) 243 | 244 | def construct_races(self, races: dict) -> list[Race]: 245 | """ 246 | Construct a list of Races from a JSON dictionary 247 | """ 248 | return [self.construct_race(race) for race in races] 249 | 250 | def construct_result(self, result: dict) -> Result: 251 | """ 252 | Construct a Result from a JSON dictionary 253 | """ 254 | result = self._populate_missing_result(result) 255 | 256 | qualifying = {"Q1": None, "Q2": None, "Q3": None} 257 | for key in qualifying: 258 | try: 259 | qualifying[key] = Helpers().format_lap_time(time=result[key]) 260 | except ValueError: 261 | # Warn that the value isn't present 262 | continue 263 | 264 | try: 265 | number = int(result["number"]) 266 | except ValueError: 267 | # Warn that the number isn't present 268 | number = None 269 | 270 | return Result( 271 | number=number, 272 | position=int(result["position"]), 273 | position_text=result["positionText"], 274 | points=float(result["points"]), 275 | driver=self.construct_driver(result["Driver"]), 276 | constructor=self.construct_constructor(result["Constructor"]), 277 | grid=int(result["grid"]), 278 | laps=int(result["laps"]), 279 | status=int(StatusType().string_to_id[result["status"]]), 280 | time=self.construct_time(result["Time"]), 281 | fastest_lap=self.construct_fastest_lap(result["FastestLap"]), 282 | qual_1=qualifying["Q1"], 283 | qual_2=qualifying["Q2"], 284 | qual_3=qualifying["Q3"], 285 | ) 286 | 287 | def construct_results(self, results: dict) -> list[Result]: 288 | """ 289 | Construct a list of Results from a JSON dictionary 290 | """ 291 | return [self.construct_result(result) for result in results] 292 | 293 | def construct_fastest_lap(self, fastest_lap: dict) -> FastestLap: 294 | """ 295 | Construct a FastestLap from a JSON dictionary 296 | """ 297 | fastest_lap = self._populate_missing_fastest_lap(fastest_lap) 298 | 299 | try: 300 | time = Helpers().construct_lap_time(time=fastest_lap["Time"]) 301 | except ValueError: 302 | # Warn that value doesnt exist 303 | time = None 304 | 305 | return FastestLap( 306 | rank=int(fastest_lap["rank"]), 307 | lap=int(fastest_lap["lap"]), 308 | time=time, 309 | average_speed=self.construct_average_speed(fastest_lap["AverageSpeed"]), 310 | ) 311 | 312 | def construct_average_speed(self, average_speed: dict) -> AverageSpeed: 313 | """ 314 | Construct an AverageSpeed from a JSON dictionary 315 | """ 316 | average_speed = self._populate_missing_average_speed(average_speed) 317 | return AverageSpeed( 318 | units=average_speed["units"], speed=float(average_speed["speed"]) 319 | ) 320 | 321 | def construct_pit_stop(self, pit_stop: dict) -> PitStop: 322 | """ 323 | Construct a PitStop from a JSON dictionary 324 | """ 325 | pit_stop = self._populate_missing_pit_stop(pit_stop) 326 | return PitStop( 327 | driver_id=pit_stop["driverId"], 328 | lap=int(pit_stop["lap"]), 329 | stop=int(pit_stop["stop"]), 330 | local_time=Helpers().construct_local_time(pit_stop["time"]), 331 | duration=Helpers().construct_pitstop_duration(pit_stop["duration"]), 332 | ) 333 | 334 | def construct_pit_stops(self, pit_stops: dict) -> list[PitStop]: 335 | """ 336 | Construct a list of PitStops from a JSON dictionary 337 | """ 338 | return [self.construct_pit_stop(pit_stop) for pit_stop in pit_stops] 339 | 340 | def construct_lap(self, lap: dict) -> Lap: 341 | """ 342 | Construct a Lap from a JSON dictionary 343 | """ 344 | lap = self._populate_missing_lap(lap) 345 | return Lap( 346 | number=int(lap["number"]), timings=self.construct_timings(lap["Timings"]) 347 | ) 348 | 349 | def construct_laps(self, laps: dict) -> list[Lap]: 350 | """ 351 | Construct a list of Laps from a JSON dictionary 352 | """ 353 | return [self.construct_lap(lap) for lap in laps] 354 | 355 | def construct_timing(self, timing: dict) -> Timing: 356 | """ 357 | Construct a Timing from a JSON dictionary 358 | """ 359 | timing = self._populate_missing_timing(timing) 360 | return Timing( 361 | driver_id=timing["driverId"], 362 | position=int(timing["position"]), 363 | time=Helpers().format_lap_time(time=timing["time"]), 364 | ) 365 | 366 | def construct_timings(self, timings: dict) -> list[Timing]: 367 | """ 368 | Construct a list of Timings from a JSON dictionary 369 | """ 370 | return [self.construct_timing(timing) for timing in timings] 371 | 372 | def construct_season(self, season: dict) -> Season: 373 | """ 374 | Construct a Season from a JSON dictionary 375 | """ 376 | season = self._populate_missing_season(season) 377 | return Season(season=int(season["season"]), url=season["url"]) 378 | 379 | def construct_seasons(self, seasons: dict) -> list[Season]: 380 | """ 381 | Construct a list of Seasons from a JSON dictionary 382 | """ 383 | return [self.construct_season(season) for season in seasons] 384 | 385 | def construct_status(self, status: dict) -> Status: 386 | """ 387 | Construct a Status from a JSON dictionary 388 | """ 389 | status = self._populate_missing_status(status) 390 | return Status( 391 | status_id=int(status["statusId"]), 392 | count=int(status["count"]), 393 | status=status["status"], 394 | ) 395 | 396 | def construct_statuses(self, statuses: dict) -> list[Status]: 397 | """ 398 | Construct a list of Statuses from a JSON dictionary 399 | """ 400 | return [self.construct_status(status) for status in statuses] 401 | 402 | def construct_driver_standing(self, standing: dict) -> DriverStanding: 403 | """ 404 | Construct a DriverStanding from a JSON dictionary 405 | """ 406 | standing = self._populate_missing_driver_standing(standing) 407 | return DriverStanding( 408 | position=int(standing["position"]), 409 | position_text=standing["positionText"], 410 | points=float(standing["points"]), 411 | wins=int(standing["wins"]), 412 | driver=self.construct_driver(standing["Driver"]), 413 | constructors=self.construct_constructors(standing["Constructors"]), 414 | ) 415 | 416 | def construct_driver_standings(self, standings: dict) -> list[DriverStanding]: 417 | """ 418 | Construct a list of DriverStandings from a JSON dictionary 419 | """ 420 | return [self.construct_driver_standing(standing) for standing in standings] 421 | 422 | def construct_constructor_standing(self, standing: dict) -> ConstructorStanding: 423 | """ 424 | Construct a ConstructorStanding from a JSON dictionary 425 | """ 426 | standing = self._populate_missing_constructor_standing(standing) 427 | return ConstructorStanding( 428 | position=int(standing["position"]), 429 | position_text=standing["positionText"], 430 | points=float(standing["points"]), 431 | wins=int(standing["wins"]), 432 | constructor=self.construct_constructor(standing["Constructor"]), 433 | ) 434 | 435 | def construct_constructor_standings( 436 | self, standings: dict 437 | ) -> list[ConstructorStanding]: 438 | """ 439 | Construct a list of ConstructorStandings from a JSON dictionary 440 | """ 441 | return [self.construct_constructor_standing(standing) for standing in standings] 442 | 443 | def construct_standings_list(self, standings_list: dict) -> StandingsList: 444 | """ 445 | Construct a StandingsList from a JSON dictionary 446 | """ 447 | standings_list = self._populate_missing_standings_list(standings_list) 448 | return StandingsList( 449 | season=int(standings_list["season"]), 450 | round_no=int(standings_list["round"]), 451 | driver_standings=self.construct_driver_standings( 452 | standings_list["DriverStandings"] 453 | ), 454 | constructor_standings=self.construct_constructor_standings( 455 | standings_list["ConstructorStandings"] 456 | ), 457 | ) 458 | 459 | def construct_standings_lists(self, standings_lists: dict) -> list[StandingsList]: 460 | """ 461 | Construct a list of StandingsLists from a JSON dictionary 462 | """ 463 | return [ 464 | self.construct_standings_list(standings_list) 465 | for standings_list in standings_lists 466 | ] 467 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Poetry and should not be changed by hand. 2 | 3 | [[package]] 4 | name = "attrs" 5 | version = "22.2.0" 6 | description = "Classes Without Boilerplate" 7 | category = "dev" 8 | optional = false 9 | python-versions = ">=3.6" 10 | files = [ 11 | {file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"}, 12 | {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, 13 | ] 14 | 15 | [package.extras] 16 | cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"] 17 | dev = ["attrs[docs,tests]"] 18 | docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope.interface"] 19 | tests = ["attrs[tests-no-zope]", "zope.interface"] 20 | tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"] 21 | 22 | [[package]] 23 | name = "black" 24 | version = "23.1.0" 25 | description = "The uncompromising code formatter." 26 | category = "dev" 27 | optional = false 28 | python-versions = ">=3.7" 29 | files = [ 30 | {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"}, 31 | {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"}, 32 | {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"}, 33 | {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"}, 34 | {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"}, 35 | {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"}, 36 | {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"}, 37 | {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"}, 38 | {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"}, 39 | {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"}, 40 | {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"}, 41 | {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"}, 42 | {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"}, 43 | {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"}, 44 | {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"}, 45 | {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"}, 46 | {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"}, 47 | {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"}, 48 | {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"}, 49 | {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"}, 50 | {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"}, 51 | {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"}, 52 | {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"}, 53 | {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"}, 54 | {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"}, 55 | ] 56 | 57 | [package.dependencies] 58 | click = ">=8.0.0" 59 | mypy-extensions = ">=0.4.3" 60 | packaging = ">=22.0" 61 | pathspec = ">=0.9.0" 62 | platformdirs = ">=2" 63 | tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} 64 | typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} 65 | 66 | [package.extras] 67 | colorama = ["colorama (>=0.4.3)"] 68 | d = ["aiohttp (>=3.7.4)"] 69 | jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] 70 | uvloop = ["uvloop (>=0.15.2)"] 71 | 72 | [[package]] 73 | name = "certifi" 74 | version = "2022.12.7" 75 | description = "Python package for providing Mozilla's CA Bundle." 76 | category = "main" 77 | optional = false 78 | python-versions = ">=3.6" 79 | files = [ 80 | {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, 81 | {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, 82 | ] 83 | 84 | [[package]] 85 | name = "cfgv" 86 | version = "3.3.1" 87 | description = "Validate configuration and produce human readable error messages." 88 | category = "dev" 89 | optional = false 90 | python-versions = ">=3.6.1" 91 | files = [ 92 | {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, 93 | {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, 94 | ] 95 | 96 | [[package]] 97 | name = "charset-normalizer" 98 | version = "3.0.1" 99 | description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." 100 | category = "main" 101 | optional = false 102 | python-versions = "*" 103 | files = [ 104 | {file = "charset-normalizer-3.0.1.tar.gz", hash = "sha256:ebea339af930f8ca5d7a699b921106c6e29c617fe9606fa7baa043c1cdae326f"}, 105 | {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:88600c72ef7587fe1708fd242b385b6ed4b8904976d5da0893e31df8b3480cb6"}, 106 | {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c75ffc45f25324e68ab238cb4b5c0a38cd1c3d7f1fb1f72b5541de469e2247db"}, 107 | {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:db72b07027db150f468fbada4d85b3b2729a3db39178abf5c543b784c1254539"}, 108 | {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62595ab75873d50d57323a91dd03e6966eb79c41fa834b7a1661ed043b2d404d"}, 109 | {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff6f3db31555657f3163b15a6b7c6938d08df7adbfc9dd13d9d19edad678f1e8"}, 110 | {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:772b87914ff1152b92a197ef4ea40efe27a378606c39446ded52c8f80f79702e"}, 111 | {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70990b9c51340e4044cfc394a81f614f3f90d41397104d226f21e66de668730d"}, 112 | {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:292d5e8ba896bbfd6334b096e34bffb56161c81408d6d036a7dfa6929cff8783"}, 113 | {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:2edb64ee7bf1ed524a1da60cdcd2e1f6e2b4f66ef7c077680739f1641f62f555"}, 114 | {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:31a9ddf4718d10ae04d9b18801bd776693487cbb57d74cc3458a7673f6f34639"}, 115 | {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:44ba614de5361b3e5278e1241fda3dc1838deed864b50a10d7ce92983797fa76"}, 116 | {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:12db3b2c533c23ab812c2b25934f60383361f8a376ae272665f8e48b88e8e1c6"}, 117 | {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c512accbd6ff0270939b9ac214b84fb5ada5f0409c44298361b2f5e13f9aed9e"}, 118 | {file = "charset_normalizer-3.0.1-cp310-cp310-win32.whl", hash = "sha256:502218f52498a36d6bf5ea77081844017bf7982cdbe521ad85e64cabee1b608b"}, 119 | {file = "charset_normalizer-3.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:601f36512f9e28f029d9481bdaf8e89e5148ac5d89cffd3b05cd533eeb423b59"}, 120 | {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0298eafff88c99982a4cf66ba2efa1128e4ddaca0b05eec4c456bbc7db691d8d"}, 121 | {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8d0fc946c784ff7f7c3742310cc8a57c5c6dc31631269876a88b809dbeff3d3"}, 122 | {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:87701167f2a5c930b403e9756fab1d31d4d4da52856143b609e30a1ce7160f3c"}, 123 | {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e76c0f23218b8f46c4d87018ca2e441535aed3632ca134b10239dfb6dadd6b"}, 124 | {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0a590235ccd933d9892c627dec5bc7511ce6ad6c1011fdf5b11363022746c1"}, 125 | {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c7fe7afa480e3e82eed58e0ca89f751cd14d767638e2550c77a92a9e749c317"}, 126 | {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79909e27e8e4fcc9db4addea88aa63f6423ebb171db091fb4373e3312cb6d603"}, 127 | {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ac7b6a045b814cf0c47f3623d21ebd88b3e8cf216a14790b455ea7ff0135d18"}, 128 | {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:72966d1b297c741541ca8cf1223ff262a6febe52481af742036a0b296e35fa5a"}, 129 | {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f9d0c5c045a3ca9bedfc35dca8526798eb91a07aa7a2c0fee134c6c6f321cbd7"}, 130 | {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:5995f0164fa7df59db4746112fec3f49c461dd6b31b841873443bdb077c13cfc"}, 131 | {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4a8fcf28c05c1f6d7e177a9a46a1c52798bfe2ad80681d275b10dcf317deaf0b"}, 132 | {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:761e8904c07ad053d285670f36dd94e1b6ab7f16ce62b9805c475b7aa1cffde6"}, 133 | {file = "charset_normalizer-3.0.1-cp311-cp311-win32.whl", hash = "sha256:71140351489970dfe5e60fc621ada3e0f41104a5eddaca47a7acb3c1b851d6d3"}, 134 | {file = "charset_normalizer-3.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:9ab77acb98eba3fd2a85cd160851816bfce6871d944d885febf012713f06659c"}, 135 | {file = "charset_normalizer-3.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:84c3990934bae40ea69a82034912ffe5a62c60bbf6ec5bc9691419641d7d5c9a"}, 136 | {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74292fc76c905c0ef095fe11e188a32ebd03bc38f3f3e9bcb85e4e6db177b7ea"}, 137 | {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c95a03c79bbe30eec3ec2b7f076074f4281526724c8685a42872974ef4d36b72"}, 138 | {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f4c39b0e3eac288fedc2b43055cfc2ca7a60362d0e5e87a637beac5d801ef478"}, 139 | {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2c707231459e8a4028eabcd3cfc827befd635b3ef72eada84ab13b52e1574d"}, 140 | {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93ad6d87ac18e2a90b0fe89df7c65263b9a99a0eb98f0a3d2e079f12a0735837"}, 141 | {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:59e5686dd847347e55dffcc191a96622f016bc0ad89105e24c14e0d6305acbc6"}, 142 | {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:cd6056167405314a4dc3c173943f11249fa0f1b204f8b51ed4bde1a9cd1834dc"}, 143 | {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:083c8d17153ecb403e5e1eb76a7ef4babfc2c48d58899c98fcaa04833e7a2f9a"}, 144 | {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:f5057856d21e7586765171eac8b9fc3f7d44ef39425f85dbcccb13b3ebea806c"}, 145 | {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:7eb33a30d75562222b64f569c642ff3dc6689e09adda43a082208397f016c39a"}, 146 | {file = "charset_normalizer-3.0.1-cp36-cp36m-win32.whl", hash = "sha256:95dea361dd73757c6f1c0a1480ac499952c16ac83f7f5f4f84f0658a01b8ef41"}, 147 | {file = "charset_normalizer-3.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:eaa379fcd227ca235d04152ca6704c7cb55564116f8bc52545ff357628e10602"}, 148 | {file = "charset_normalizer-3.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3e45867f1f2ab0711d60c6c71746ac53537f1684baa699f4f668d4c6f6ce8e14"}, 149 | {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cadaeaba78750d58d3cc6ac4d1fd867da6fc73c88156b7a3212a3cd4819d679d"}, 150 | {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:911d8a40b2bef5b8bbae2e36a0b103f142ac53557ab421dc16ac4aafee6f53dc"}, 151 | {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:503e65837c71b875ecdd733877d852adbc465bd82c768a067badd953bf1bc5a3"}, 152 | {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a60332922359f920193b1d4826953c507a877b523b2395ad7bc716ddd386d866"}, 153 | {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:16a8663d6e281208d78806dbe14ee9903715361cf81f6d4309944e4d1e59ac5b"}, 154 | {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:a16418ecf1329f71df119e8a65f3aa68004a3f9383821edcb20f0702934d8087"}, 155 | {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9d9153257a3f70d5f69edf2325357251ed20f772b12e593f3b3377b5f78e7ef8"}, 156 | {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:02a51034802cbf38db3f89c66fb5d2ec57e6fe7ef2f4a44d070a593c3688667b"}, 157 | {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:2e396d70bc4ef5325b72b593a72c8979999aa52fb8bcf03f701c1b03e1166918"}, 158 | {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:11b53acf2411c3b09e6af37e4b9005cba376c872503c8f28218c7243582df45d"}, 159 | {file = "charset_normalizer-3.0.1-cp37-cp37m-win32.whl", hash = "sha256:0bf2dae5291758b6f84cf923bfaa285632816007db0330002fa1de38bfcb7154"}, 160 | {file = "charset_normalizer-3.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2c03cc56021a4bd59be889c2b9257dae13bf55041a3372d3295416f86b295fb5"}, 161 | {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:024e606be3ed92216e2b6952ed859d86b4cfa52cd5bc5f050e7dc28f9b43ec42"}, 162 | {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4b0d02d7102dd0f997580b51edc4cebcf2ab6397a7edf89f1c73b586c614272c"}, 163 | {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:358a7c4cb8ba9b46c453b1dd8d9e431452d5249072e4f56cfda3149f6ab1405e"}, 164 | {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81d6741ab457d14fdedc215516665050f3822d3e56508921cc7239f8c8e66a58"}, 165 | {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8b8af03d2e37866d023ad0ddea594edefc31e827fee64f8de5611a1dbc373174"}, 166 | {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9cf4e8ad252f7c38dd1f676b46514f92dc0ebeb0db5552f5f403509705e24753"}, 167 | {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e696f0dd336161fca9adbb846875d40752e6eba585843c768935ba5c9960722b"}, 168 | {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c22d3fe05ce11d3671297dc8973267daa0f938b93ec716e12e0f6dee81591dc1"}, 169 | {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109487860ef6a328f3eec66f2bf78b0b72400280d8f8ea05f69c51644ba6521a"}, 170 | {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:37f8febc8ec50c14f3ec9637505f28e58d4f66752207ea177c1d67df25da5aed"}, 171 | {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:f97e83fa6c25693c7a35de154681fcc257c1c41b38beb0304b9c4d2d9e164479"}, 172 | {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:a152f5f33d64a6be73f1d30c9cc82dfc73cec6477ec268e7c6e4c7d23c2d2291"}, 173 | {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:39049da0ffb96c8cbb65cbf5c5f3ca3168990adf3551bd1dee10c48fce8ae820"}, 174 | {file = "charset_normalizer-3.0.1-cp38-cp38-win32.whl", hash = "sha256:4457ea6774b5611f4bed5eaa5df55f70abde42364d498c5134b7ef4c6958e20e"}, 175 | {file = "charset_normalizer-3.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:e62164b50f84e20601c1ff8eb55620d2ad25fb81b59e3cd776a1902527a788af"}, 176 | {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8eade758719add78ec36dc13201483f8e9b5d940329285edcd5f70c0a9edbd7f"}, 177 | {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8499ca8f4502af841f68135133d8258f7b32a53a1d594aa98cc52013fff55678"}, 178 | {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3fc1c4a2ffd64890aebdb3f97e1278b0cc72579a08ca4de8cd2c04799a3a22be"}, 179 | {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00d3ffdaafe92a5dc603cb9bd5111aaa36dfa187c8285c543be562e61b755f6b"}, 180 | {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c2ac1b08635a8cd4e0cbeaf6f5e922085908d48eb05d44c5ae9eabab148512ca"}, 181 | {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f6f45710b4459401609ebebdbcfb34515da4fc2aa886f95107f556ac69a9147e"}, 182 | {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ae1de54a77dc0d6d5fcf623290af4266412a7c4be0b1ff7444394f03f5c54e3"}, 183 | {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b590df687e3c5ee0deef9fc8c547d81986d9a1b56073d82de008744452d6541"}, 184 | {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab5de034a886f616a5668aa5d098af2b5385ed70142090e2a31bcbd0af0fdb3d"}, 185 | {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9cb3032517f1627cc012dbc80a8ec976ae76d93ea2b5feaa9d2a5b8882597579"}, 186 | {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:608862a7bf6957f2333fc54ab4399e405baad0163dc9f8d99cb236816db169d4"}, 187 | {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0f438ae3532723fb6ead77e7c604be7c8374094ef4ee2c5e03a3a17f1fca256c"}, 188 | {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:356541bf4381fa35856dafa6a965916e54bed415ad8a24ee6de6e37deccf2786"}, 189 | {file = "charset_normalizer-3.0.1-cp39-cp39-win32.whl", hash = "sha256:39cf9ed17fe3b1bc81f33c9ceb6ce67683ee7526e65fde1447c772afc54a1bb8"}, 190 | {file = "charset_normalizer-3.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:0a11e971ed097d24c534c037d298ad32c6ce81a45736d31e0ff0ad37ab437d59"}, 191 | {file = "charset_normalizer-3.0.1-py3-none-any.whl", hash = "sha256:7e189e2e1d3ed2f4aebabd2d5b0f931e883676e51c7624826e0a4e5fe8a0bf24"}, 192 | ] 193 | 194 | [[package]] 195 | name = "classify-imports" 196 | version = "4.2.0" 197 | description = "Utilities for refactoring imports in python-like syntax." 198 | category = "dev" 199 | optional = false 200 | python-versions = ">=3.7" 201 | files = [ 202 | {file = "classify_imports-4.2.0-py2.py3-none-any.whl", hash = "sha256:dbbc264b70a470ed8c6c95976a11dfb8b7f63df44ed1af87328bbed2663f5161"}, 203 | {file = "classify_imports-4.2.0.tar.gz", hash = "sha256:7abfb7ea92149b29d046bd34573d247ba6e68cc28100c801eba4af17964fc40e"}, 204 | ] 205 | 206 | [[package]] 207 | name = "click" 208 | version = "8.1.3" 209 | description = "Composable command line interface toolkit" 210 | category = "dev" 211 | optional = false 212 | python-versions = ">=3.7" 213 | files = [ 214 | {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, 215 | {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, 216 | ] 217 | 218 | [package.dependencies] 219 | colorama = {version = "*", markers = "platform_system == \"Windows\""} 220 | 221 | [[package]] 222 | name = "colorama" 223 | version = "0.4.6" 224 | description = "Cross-platform colored terminal text." 225 | category = "dev" 226 | optional = false 227 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" 228 | files = [ 229 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, 230 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, 231 | ] 232 | 233 | [[package]] 234 | name = "distlib" 235 | version = "0.3.6" 236 | description = "Distribution utilities" 237 | category = "dev" 238 | optional = false 239 | python-versions = "*" 240 | files = [ 241 | {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, 242 | {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, 243 | ] 244 | 245 | [[package]] 246 | name = "exceptiongroup" 247 | version = "1.1.0" 248 | description = "Backport of PEP 654 (exception groups)" 249 | category = "dev" 250 | optional = false 251 | python-versions = ">=3.7" 252 | files = [ 253 | {file = "exceptiongroup-1.1.0-py3-none-any.whl", hash = "sha256:327cbda3da756e2de031a3107b81ab7b3770a602c4d16ca618298c526f4bec1e"}, 254 | {file = "exceptiongroup-1.1.0.tar.gz", hash = "sha256:bcb67d800a4497e1b404c2dd44fca47d3b7a5e5433dbab67f96c1a685cdfdf23"}, 255 | ] 256 | 257 | [package.extras] 258 | test = ["pytest (>=6)"] 259 | 260 | [[package]] 261 | name = "filelock" 262 | version = "3.9.0" 263 | description = "A platform independent file lock." 264 | category = "dev" 265 | optional = false 266 | python-versions = ">=3.7" 267 | files = [ 268 | {file = "filelock-3.9.0-py3-none-any.whl", hash = "sha256:f58d535af89bb9ad5cd4df046f741f8553a418c01a7856bf0d173bbc9f6bd16d"}, 269 | {file = "filelock-3.9.0.tar.gz", hash = "sha256:7b319f24340b51f55a2bf7a12ac0755a9b03e718311dac567a0f4f7fabd2f5de"}, 270 | ] 271 | 272 | [package.extras] 273 | docs = ["furo (>=2022.12.7)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] 274 | testing = ["covdefaults (>=2.2.2)", "coverage (>=7.0.1)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-timeout (>=2.1)"] 275 | 276 | [[package]] 277 | name = "identify" 278 | version = "2.5.18" 279 | description = "File identification library for Python" 280 | category = "dev" 281 | optional = false 282 | python-versions = ">=3.7" 283 | files = [ 284 | {file = "identify-2.5.18-py2.py3-none-any.whl", hash = "sha256:93aac7ecf2f6abf879b8f29a8002d3c6de7086b8c28d88e1ad15045a15ab63f9"}, 285 | {file = "identify-2.5.18.tar.gz", hash = "sha256:89e144fa560cc4cffb6ef2ab5e9fb18ed9f9b3cb054384bab4b95c12f6c309fe"}, 286 | ] 287 | 288 | [package.extras] 289 | license = ["ukkonen"] 290 | 291 | [[package]] 292 | name = "idna" 293 | version = "3.4" 294 | description = "Internationalized Domain Names in Applications (IDNA)" 295 | category = "main" 296 | optional = false 297 | python-versions = ">=3.5" 298 | files = [ 299 | {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, 300 | {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, 301 | ] 302 | 303 | [[package]] 304 | name = "iniconfig" 305 | version = "2.0.0" 306 | description = "brain-dead simple config-ini parsing" 307 | category = "dev" 308 | optional = false 309 | python-versions = ">=3.7" 310 | files = [ 311 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, 312 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, 313 | ] 314 | 315 | [[package]] 316 | name = "mypy-extensions" 317 | version = "1.0.0" 318 | description = "Type system extensions for programs checked with the mypy type checker." 319 | category = "dev" 320 | optional = false 321 | python-versions = ">=3.5" 322 | files = [ 323 | {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, 324 | {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, 325 | ] 326 | 327 | [[package]] 328 | name = "nodeenv" 329 | version = "1.7.0" 330 | description = "Node.js virtual environment builder" 331 | category = "dev" 332 | optional = false 333 | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" 334 | files = [ 335 | {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, 336 | {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, 337 | ] 338 | 339 | [package.dependencies] 340 | setuptools = "*" 341 | 342 | [[package]] 343 | name = "packaging" 344 | version = "23.0" 345 | description = "Core utilities for Python packages" 346 | category = "dev" 347 | optional = false 348 | python-versions = ">=3.7" 349 | files = [ 350 | {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, 351 | {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, 352 | ] 353 | 354 | [[package]] 355 | name = "pathspec" 356 | version = "0.11.0" 357 | description = "Utility library for gitignore style pattern matching of file paths." 358 | category = "dev" 359 | optional = false 360 | python-versions = ">=3.7" 361 | files = [ 362 | {file = "pathspec-0.11.0-py3-none-any.whl", hash = "sha256:3a66eb970cbac598f9e5ccb5b2cf58930cd8e3ed86d393d541eaf2d8b1705229"}, 363 | {file = "pathspec-0.11.0.tar.gz", hash = "sha256:64d338d4e0914e91c1792321e6907b5a593f1ab1851de7fc269557a21b30ebbc"}, 364 | ] 365 | 366 | [[package]] 367 | name = "platformdirs" 368 | version = "3.0.0" 369 | description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." 370 | category = "dev" 371 | optional = false 372 | python-versions = ">=3.7" 373 | files = [ 374 | {file = "platformdirs-3.0.0-py3-none-any.whl", hash = "sha256:b1d5eb14f221506f50d6604a561f4c5786d9e80355219694a1b244bcd96f4567"}, 375 | {file = "platformdirs-3.0.0.tar.gz", hash = "sha256:8a1228abb1ef82d788f74139988b137e78692984ec7b08eaa6c65f1723af28f9"}, 376 | ] 377 | 378 | [package.extras] 379 | docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] 380 | test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] 381 | 382 | [[package]] 383 | name = "pluggy" 384 | version = "1.0.0" 385 | description = "plugin and hook calling mechanisms for python" 386 | category = "dev" 387 | optional = false 388 | python-versions = ">=3.6" 389 | files = [ 390 | {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, 391 | {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, 392 | ] 393 | 394 | [package.extras] 395 | dev = ["pre-commit", "tox"] 396 | testing = ["pytest", "pytest-benchmark"] 397 | 398 | [[package]] 399 | name = "pre-commit" 400 | version = "3.0.4" 401 | description = "A framework for managing and maintaining multi-language pre-commit hooks." 402 | category = "dev" 403 | optional = false 404 | python-versions = ">=3.8" 405 | files = [ 406 | {file = "pre_commit-3.0.4-py2.py3-none-any.whl", hash = "sha256:9e3255edb0c9e7fe9b4f328cb3dc86069f8fdc38026f1bf521018a05eaf4d67b"}, 407 | {file = "pre_commit-3.0.4.tar.gz", hash = "sha256:bc4687478d55578c4ac37272fe96df66f73d9b5cf81be6f28627d4e712e752d5"}, 408 | ] 409 | 410 | [package.dependencies] 411 | cfgv = ">=2.0.0" 412 | identify = ">=1.0.0" 413 | nodeenv = ">=0.11.1" 414 | pyyaml = ">=5.1" 415 | virtualenv = ">=20.10.0" 416 | 417 | [[package]] 418 | name = "pytest" 419 | version = "7.2.1" 420 | description = "pytest: simple powerful testing with Python" 421 | category = "dev" 422 | optional = false 423 | python-versions = ">=3.7" 424 | files = [ 425 | {file = "pytest-7.2.1-py3-none-any.whl", hash = "sha256:c7c6ca206e93355074ae32f7403e8ea12163b1163c976fee7d4d84027c162be5"}, 426 | {file = "pytest-7.2.1.tar.gz", hash = "sha256:d45e0952f3727241918b8fd0f376f5ff6b301cc0777c6f9a556935c92d8a7d42"}, 427 | ] 428 | 429 | [package.dependencies] 430 | attrs = ">=19.2.0" 431 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 432 | exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} 433 | iniconfig = "*" 434 | packaging = "*" 435 | pluggy = ">=0.12,<2.0" 436 | tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} 437 | 438 | [package.extras] 439 | testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] 440 | 441 | [[package]] 442 | name = "pytz" 443 | version = "2022.7.1" 444 | description = "World timezone definitions, modern and historical" 445 | category = "main" 446 | optional = false 447 | python-versions = "*" 448 | files = [ 449 | {file = "pytz-2022.7.1-py2.py3-none-any.whl", hash = "sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a"}, 450 | {file = "pytz-2022.7.1.tar.gz", hash = "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0"}, 451 | ] 452 | 453 | [[package]] 454 | name = "pyyaml" 455 | version = "6.0" 456 | description = "YAML parser and emitter for Python" 457 | category = "dev" 458 | optional = false 459 | python-versions = ">=3.6" 460 | files = [ 461 | {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, 462 | {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, 463 | {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, 464 | {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, 465 | {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, 466 | {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, 467 | {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, 468 | {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"}, 469 | {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"}, 470 | {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"}, 471 | {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"}, 472 | {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"}, 473 | {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"}, 474 | {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"}, 475 | {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, 476 | {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, 477 | {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, 478 | {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, 479 | {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, 480 | {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, 481 | {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, 482 | {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, 483 | {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, 484 | {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, 485 | {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, 486 | {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, 487 | {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, 488 | {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, 489 | {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, 490 | {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, 491 | {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, 492 | {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, 493 | {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, 494 | {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, 495 | {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, 496 | {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, 497 | {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, 498 | {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, 499 | {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, 500 | {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, 501 | ] 502 | 503 | [[package]] 504 | name = "reorder-python-imports" 505 | version = "3.9.0" 506 | description = "Tool for reordering python imports" 507 | category = "dev" 508 | optional = false 509 | python-versions = ">=3.7" 510 | files = [ 511 | {file = "reorder_python_imports-3.9.0-py2.py3-none-any.whl", hash = "sha256:3f9c16e8781f54c944756d0d1eb34a8c863554f7a4eb3693f574fe19b1a29b56"}, 512 | {file = "reorder_python_imports-3.9.0.tar.gz", hash = "sha256:49292ed537829a6bece9fb3746fc1bbe98f52643be5de01a4e13680268a5b0ec"}, 513 | ] 514 | 515 | [package.dependencies] 516 | classify-imports = ">=4.1" 517 | 518 | [[package]] 519 | name = "requests" 520 | version = "2.28.2" 521 | description = "Python HTTP for Humans." 522 | category = "main" 523 | optional = false 524 | python-versions = ">=3.7, <4" 525 | files = [ 526 | {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, 527 | {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, 528 | ] 529 | 530 | [package.dependencies] 531 | certifi = ">=2017.4.17" 532 | charset-normalizer = ">=2,<4" 533 | idna = ">=2.5,<4" 534 | urllib3 = ">=1.21.1,<1.27" 535 | 536 | [package.extras] 537 | socks = ["PySocks (>=1.5.6,!=1.5.7)"] 538 | use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] 539 | 540 | [[package]] 541 | name = "setuptools" 542 | version = "67.3.3" 543 | description = "Easily download, build, install, upgrade, and uninstall Python packages" 544 | category = "dev" 545 | optional = false 546 | python-versions = ">=3.7" 547 | files = [ 548 | {file = "setuptools-67.3.3-py3-none-any.whl", hash = "sha256:9d3de8591bd6f6522594406fa46a6418eabd0562dacb267f8556675762801514"}, 549 | {file = "setuptools-67.3.3.tar.gz", hash = "sha256:ed4e75fafe103c79b692f217158ba87edf38d31004b9dbc1913debb48793c828"}, 550 | ] 551 | 552 | [package.extras] 553 | docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] 554 | testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] 555 | testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] 556 | 557 | [[package]] 558 | name = "tomli" 559 | version = "2.0.1" 560 | description = "A lil' TOML parser" 561 | category = "dev" 562 | optional = false 563 | python-versions = ">=3.7" 564 | files = [ 565 | {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, 566 | {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, 567 | ] 568 | 569 | [[package]] 570 | name = "typing-extensions" 571 | version = "4.5.0" 572 | description = "Backported and Experimental Type Hints for Python 3.7+" 573 | category = "dev" 574 | optional = false 575 | python-versions = ">=3.7" 576 | files = [ 577 | {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, 578 | {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, 579 | ] 580 | 581 | [[package]] 582 | name = "uritemplate" 583 | version = "4.1.1" 584 | description = "Implementation of RFC 6570 URI Templates" 585 | category = "main" 586 | optional = false 587 | python-versions = ">=3.6" 588 | files = [ 589 | {file = "uritemplate-4.1.1-py2.py3-none-any.whl", hash = "sha256:830c08b8d99bdd312ea4ead05994a38e8936266f84b9a7878232db50b044e02e"}, 590 | {file = "uritemplate-4.1.1.tar.gz", hash = "sha256:4346edfc5c3b79f694bccd6d6099a322bbeb628dbf2cd86eea55a456ce5124f0"}, 591 | ] 592 | 593 | [[package]] 594 | name = "urllib3" 595 | version = "1.26.14" 596 | description = "HTTP library with thread-safe connection pooling, file post, and more." 597 | category = "main" 598 | optional = false 599 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" 600 | files = [ 601 | {file = "urllib3-1.26.14-py2.py3-none-any.whl", hash = "sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"}, 602 | {file = "urllib3-1.26.14.tar.gz", hash = "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"}, 603 | ] 604 | 605 | [package.extras] 606 | brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] 607 | secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] 608 | socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] 609 | 610 | [[package]] 611 | name = "virtualenv" 612 | version = "20.19.0" 613 | description = "Virtual Python Environment builder" 614 | category = "dev" 615 | optional = false 616 | python-versions = ">=3.7" 617 | files = [ 618 | {file = "virtualenv-20.19.0-py3-none-any.whl", hash = "sha256:54eb59e7352b573aa04d53f80fc9736ed0ad5143af445a1e539aada6eb947dd1"}, 619 | {file = "virtualenv-20.19.0.tar.gz", hash = "sha256:37a640ba82ed40b226599c522d411e4be5edb339a0c0de030c0dc7b646d61590"}, 620 | ] 621 | 622 | [package.dependencies] 623 | distlib = ">=0.3.6,<1" 624 | filelock = ">=3.4.1,<4" 625 | platformdirs = ">=2.4,<4" 626 | 627 | [package.extras] 628 | docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] 629 | test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] 630 | 631 | [metadata] 632 | lock-version = "2.0" 633 | python-versions = "^3.9" 634 | content-hash = "0af0097413be2e545d13e5a4d3ab75ee6fce5287eae3aaaf34a195b4e52bc7d4" 635 | --------------------------------------------------------------------------------