Skip to content

Commit

Permalink
Remove warnings and set defaults to match those of the Round class.
Browse files Browse the repository at this point in the history
  • Loading branch information
jatkinson1000 committed Feb 25, 2024
1 parent 63c8b0a commit ccadeb1
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions archeryutils/load_rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import json
from pathlib import Path
import warnings
from typing import Union, Any

from archeryutils.rounds import Pass, Round
Expand Down Expand Up @@ -43,9 +42,7 @@
}


def read_json_to_round_dict(
json_filelist: Union[str, list[str]], verbose: bool = False
) -> dict[str, Round]:
def read_json_to_round_dict(json_filelist: Union[str, list[str]]) -> dict[str, Round]:
"""
Read round information from a json file into a dictionary of rounds.
Expand Down Expand Up @@ -79,11 +76,6 @@ def read_json_to_round_dict(
for round_i in data:
# Assign location
if "location" not in round_i:
if verbose:
warnings.warn(
f"No location provided for round {round_i['name']}. "
"Defaulting to None."
)
round_i["location"] = None
round_i["indoor"] = False

Expand All @@ -100,31 +92,16 @@ def read_json_to_round_dict(
round_i["location"] = "field"

else:
if verbose:
warnings.warn(
f"Location not recognised for round {round_i['name']}. "
"Defaulting to None"
)
round_i["indoor"] = False
round_i["location"] = None

# Assign governing body
if "body" not in round_i:
if verbose:
warnings.warn(
f"No body provided for round {round_i['name']}. "
"Defaulting to 'custom'."
)
round_i["body"] = "custom"
round_i["body"] = None

Check warning on line 100 in archeryutils/load_rounds.py

View check run for this annotation

Codecov / codecov/patch

archeryutils/load_rounds.py#L100

Added line #L100 was not covered by tests

# Assign round family
if "family" not in round_i:
if verbose:
warnings.warn(
f"No family provided for round {round_i['name']}. "
"Defaulting to ''."
)
round_i["family"] = ""
round_i["family"] = None

# Assign passes
passes = [
Expand Down

0 comments on commit ccadeb1

Please sign in to comment.