Skip to content

Commit

Permalink
Extra: derive available scoring systems in Target init from literal l…
Browse files Browse the repository at this point in the history
…isting

Use typing.get_args to deduplicate list of allowable scoring systems
  • Loading branch information
TomHall2020 committed Feb 15, 2024
1 parent 0eabf8c commit 8aa7d52
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions archeryutils/targets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Class to represent a Target for archery applications."""
from typing import Union, TypeAlias, Literal
from typing import Union, TypeAlias, Literal, get_args

from archeryutils.constants import Length

Expand Down Expand Up @@ -53,20 +53,7 @@ def __init__(
distance: Union[float, tuple[float,str]],
indoor: bool = False,
) -> None:
systems = [
"5_zone",
"10_zone",
"10_zone_compound",
"10_zone_6_ring",
"10_zone_5_ring",
"10_zone_5_ring_compound",
"WA_field",
"IFAA_field",
"IFAA_field_expert",
"Beiter_hit_miss",
"Worcester",
"Worcester_2_ring",
]
systems = get_args(ScoringSystem)

if scoring_system not in systems:
raise ValueError(
Expand Down

0 comments on commit 8aa7d52

Please sign in to comment.