Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterHoburg committed Mar 4, 2024
1 parent bb8e273 commit 0d5cac6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
30 changes: 14 additions & 16 deletions src/f1_fantasy/__main__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import shutil
import time
from datetime import datetime
from pathlib import Path

import typer

from f1_fantasy.consts import ROOT_DIR, CURRENT_DIR
from f1_fantasy.main import drivers_prices_from_csv, constructors_prices_from_csv, finishing_positions_from_csv, \
special_points_from_csv, set_chips_from_csv, calculations, main
from f1_fantasy.consts import CURRENT_DIR, ROOT_DIR
from f1_fantasy.main import main

app = typer.Typer()

Expand Down Expand Up @@ -42,23 +40,23 @@ def run():
typer.echo("No input data found. Run setup command first: f1-fantasy setup")
return

main(chips_path=Path(CURRENT_DIR / "data" / "input" / "chips.csv"), finishing_positions_qualifying_path=Path(
CURRENT_DIR / "data" / "input" / "finishing_positions_qualifying.csv"),
finishing_positions_race_path=Path(CURRENT_DIR / "data" / "input" / "finishing_positions_race.csv"),
ignore_constructors_path=Path(CURRENT_DIR / "data" / "input" / "ignore_constructors.csv"),
ignore_drivers_path=Path(CURRENT_DIR / "data" / "input" / "ignore_drivers.csv"),
price_constructors_path=Path(CURRENT_DIR / "data" / "input" / "price_constructors.csv"),
price_drivers_path=Path(CURRENT_DIR / "data" / "input" / "price_drivers.csv"),
special_points_path=Path(CURRENT_DIR / "data" / "input" / "special_points.csv"),
output_file_path=Path(CURRENT_DIR / "data" / "output" / f"{time.time()}"))


main(
chips_path=Path(CURRENT_DIR / "data" / "input" / "chips.csv"),
finishing_positions_qualifying_path=Path(CURRENT_DIR / "data" / "input" / "finishing_positions_qualifying.csv"),
finishing_positions_race_path=Path(CURRENT_DIR / "data" / "input" / "finishing_positions_race.csv"),
ignore_constructors_path=Path(CURRENT_DIR / "data" / "input" / "ignore_constructors.csv"),
ignore_drivers_path=Path(CURRENT_DIR / "data" / "input" / "ignore_drivers.csv"),
price_constructors_path=Path(CURRENT_DIR / "data" / "input" / "price_constructors.csv"),
price_drivers_path=Path(CURRENT_DIR / "data" / "input" / "price_drivers.csv"),
special_points_path=Path(CURRENT_DIR / "data" / "input" / "special_points.csv"),
output_file_path=Path(CURRENT_DIR / "data" / "output" / f"{time.time()}"),
)


def version_callback(value: bool):
import pkg_resources

my_version = pkg_resources.get_distribution('f1-fantasy').version
my_version = pkg_resources.get_distribution("f1-fantasy").version
if value:
typer.echo(f"{my_version}")
raise typer.Exit()
Expand Down
8 changes: 5 additions & 3 deletions src/f1_fantasy/game_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ def __repr__(self):
"Team:\n"
+ f"Total points: {self.points}"
+ "\n\n"
+ f"Drivers: " + driver_str
+ "\n\n" +
f"Constructors: " + constructor_str
+ "Drivers: "
+ driver_str
+ "\n\n"
+ "Constructors: "
+ constructor_str
)


Expand Down
33 changes: 20 additions & 13 deletions src/f1_fantasy/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import csv
import datetime
import itertools
import time
from copy import deepcopy
Expand All @@ -16,8 +15,14 @@
Drivers,
Team,
)
from f1_fantasy.models import ConstructorPriceModel, DriverPriceModel, FinishingPositionModel, SpecialPoints, \
DriversEnum, ConstructorsEnum
from f1_fantasy.models import (
ConstructorPriceModel,
ConstructorsEnum,
DriverPriceModel,
DriversEnum,
FinishingPositionModel,
SpecialPoints,
)
from f1_fantasy.settings import SETTINGS


Expand Down Expand Up @@ -210,6 +215,7 @@ def write_csv_to_output(f: TextIO, csv_path: Path):
for row in reader:
f.write(str(row) + "\n")


def main(
chips_path: Path,
finishing_positions_qualifying_path: Path,
Expand Down Expand Up @@ -260,14 +266,15 @@ def main(
print(f"Output written to {output_file_path}")



if __name__ == "__main__":
main(chips_path=Path(ROOT_DIR / "data" / "input" / "chips.csv"),
finishing_positions_qualifying_path=Path(ROOT_DIR / "data" / "input" / "finishing_positions_qualifying.csv"),
finishing_positions_race_path=Path(ROOT_DIR / "data" / "input" / "finishing_positions_race.csv"),
ignore_constructors_path=Path(ROOT_DIR / "data" / "input" / "ignore_constructors.csv"),
ignore_drivers_path=Path(ROOT_DIR / "data" / "input" / "ignore_drivers.csv"),
price_constructors_path=Path(ROOT_DIR / "data" / "input" / "price_constructors.csv"),
price_drivers_path=Path(ROOT_DIR / "data" / "input" / "price_drivers.csv"),
special_points_path=Path(ROOT_DIR / "data" / "input" / "special_points.csv"),
output_file_path=Path(ROOT_DIR / "data" / "output" / f"{time.time()}"))
main(
chips_path=Path(ROOT_DIR / "data" / "input" / "chips.csv"),
finishing_positions_qualifying_path=Path(ROOT_DIR / "data" / "input" / "finishing_positions_qualifying.csv"),
finishing_positions_race_path=Path(ROOT_DIR / "data" / "input" / "finishing_positions_race.csv"),
ignore_constructors_path=Path(ROOT_DIR / "data" / "input" / "ignore_constructors.csv"),
ignore_drivers_path=Path(ROOT_DIR / "data" / "input" / "ignore_drivers.csv"),
price_constructors_path=Path(ROOT_DIR / "data" / "input" / "price_constructors.csv"),
price_drivers_path=Path(ROOT_DIR / "data" / "input" / "price_drivers.csv"),
special_points_path=Path(ROOT_DIR / "data" / "input" / "special_points.csv"),
output_file_path=Path(ROOT_DIR / "data" / "output" / f"{time.time()}"),
)

0 comments on commit 0d5cac6

Please sign in to comment.