Add support for xlsx files
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import Annotated, List
|
||||
from pathlib import Path
|
||||
from ...utils.sportspress import validate_keys
|
||||
from ...utils.normalize import normalize_header_key, load_config
|
||||
from ...utils.common import read_and_normalize_csv, is_visitor_home_order_reversed, import_gamebygame, parse_datetime, personalize_data_for_team
|
||||
from ...utils.common import read_and_normalize_csv_or_xlsx, is_visitor_home_order_reversed, import_gamebygame, parse_datetime, personalize_data_for_team
|
||||
from ...utils.sportspress import write_sportspress_csv
|
||||
from .calendar_utils import generate_calendar
|
||||
from collections import defaultdict
|
||||
@@ -14,10 +14,10 @@ app = typer.Typer()
|
||||
|
||||
@app.command(name="calendar")
|
||||
def generate_calendar_app(
|
||||
input_file: Annotated[List[typer.FileText], typer.Argument(..., help="Path(s) to the CSV file")],
|
||||
input_file: Annotated[List[Path], typer.Argument(..., help="Path(s) to the CSV file")],
|
||||
):
|
||||
# Read CSV data
|
||||
data = read_and_normalize_csv(input_file)
|
||||
data = read_and_normalize_csv_or_xlsx(input_file)
|
||||
data = personalize_data_for_team(data, "Hounds")
|
||||
# data = parse_datetime(data)
|
||||
|
||||
@@ -26,10 +26,10 @@ def generate_calendar_app(
|
||||
|
||||
@app.command(name="calendar-config")
|
||||
def generate_calendar_configs(
|
||||
input_file: Annotated[List[typer.FileText], typer.Argument(..., help="Path(s) to the CSV file")],
|
||||
input_file: Annotated[List[Path], typer.Argument(..., help="Path(s) to the CSV file")],
|
||||
output_file: Annotated[Path, typer.Argument(..., help="Path(s) to the output config file")]
|
||||
):
|
||||
data = read_and_normalize_csv(input_file)
|
||||
data = read_and_normalize_csv_or_xlsx(input_file)
|
||||
teams = {row.get('visitor') for row in data}
|
||||
teams.update({row.get('home') for row in data})
|
||||
fields = {row.get('field') for row in data}
|
||||
|
||||
Reference in New Issue
Block a user