Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update old field classification naming #107

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions archeryutils/classifications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
calculate_agb_indoor_classification,
)
from .agb_old_field_classifications import (
calculate_old_agb_field_classification,
old_agb_field_classification_scores,
agb_old_field_classification_scores,
calculate_agb_old_field_classification,
)
from .agb_old_indoor_classifications import (
agb_old_indoor_classification_scores,
Expand All @@ -24,12 +24,12 @@
__all__ = [
"agb_field_classification_scores",
"agb_indoor_classification_scores",
"agb_old_field_classification_scores",
"agb_old_indoor_classification_scores",
"agb_outdoor_classification_scores",
"calculate_agb_field_classification",
"calculate_agb_indoor_classification",
"calculate_agb_old_field_classification",
"calculate_agb_old_indoor_classification",
"calculate_agb_outdoor_classification",
"calculate_old_agb_field_classification",
"old_agb_field_classification_scores",
]
20 changes: 10 additions & 10 deletions archeryutils/classifications/agb_old_field_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class GroupData(TypedDict):
class_scores: list[int]


def _make_old_agb_field_classification_dict() -> dict[str, GroupData]:
def _make_agb_old_field_classification_dict() -> dict[str, GroupData]:
"""
Generate AGB outdoor classification data.
Generate old (pre-2025) AGB field classification data.

Generate a dictionary of dictionaries providing handicaps for
each classification band.
Expand Down Expand Up @@ -112,16 +112,16 @@ def _make_old_agb_field_classification_dict() -> dict[str, GroupData]:
return classification_dict


old_agb_field_classifications = _make_old_agb_field_classification_dict()
old_agb_field_classifications = _make_agb_old_field_classification_dict()

del _make_old_agb_field_classification_dict
del _make_agb_old_field_classification_dict


def calculate_old_agb_field_classification(
def calculate_agb_old_field_classification(
roundname: str, score: float, bowstyle: str, gender: str, age_group: str
) -> str:
"""
Calculate AGB field classification from score.
Calculate old (pre-2025) AGB field classification from score.

Subroutine to calculate a classification from a score given suitable inputs.

Expand Down Expand Up @@ -156,7 +156,7 @@ def calculate_old_agb_field_classification(
Examples
--------
>>> from archeryutils import classifications as class_func
>>> class_func.calculate_agb_field_classification(
>>> class_func.calculate_agb_old_field_classification(
... 247,
... "wa_field_24_red_marked",
... "recurve",
Expand Down Expand Up @@ -220,14 +220,14 @@ def calculate_old_agb_field_classification(
return "unclassified"


def old_agb_field_classification_scores(
def agb_old_field_classification_scores(
roundname: str, # noqa: ARG001 - Unused argument for consistency with other classification schemes
bowstyle: str,
gender: str,
age_group: str,
) -> list[int]:
"""
Calculate AGB field classification scores for category.
Calculate old (pre-2025) AGB field classification scores for category.

Subroutine to calculate classification scores for a specific category and round.
Appropriate ArcheryGB age groups and classifications.
Expand Down Expand Up @@ -256,7 +256,7 @@ def old_agb_field_classification_scores(
Examples
--------
>>> from archeryutils import classifications as class_func
>>> class_func.agb_field_classification_scores(
>>> class_func.agb_old_field_classification_scores(
... "wa_field_24_red_marked",
... "recurve",
... "male",
Expand Down
2 changes: 1 addition & 1 deletion archeryutils/classifications/tests/test_agb_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for old field classification functions."""
"""Tests for field classification functions."""

import pytest

Expand Down
32 changes: 16 additions & 16 deletions archeryutils/classifications/tests/test_agb_old_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for old agb field classification functions."""
"""Tests for old (pre-2025) agb field classification functions."""

import pytest

Expand All @@ -12,7 +12,7 @@
)


class TestOldAgbFieldClassificationScores:
class TestAgbOldFieldClassificationScores:
"""Tests for the field classification scores function."""

@pytest.mark.parametrize(
Expand Down Expand Up @@ -45,14 +45,14 @@ class TestOldAgbFieldClassificationScores:
),
],
)
def test_old_agb_field_classification_scores_ages(
def test_agb_old_field_classification_scores_ages(
self,
roundname: str,
age_group: str,
scores_expected: list[int],
) -> None:
"""Check that field classification returns expected value for a case."""
scores = class_funcs.old_agb_field_classification_scores(
scores = class_funcs.agb_old_field_classification_scores(
roundname=roundname,
bowstyle="barebow",
gender="male",
Expand Down Expand Up @@ -90,15 +90,15 @@ def test_old_agb_field_classification_scores_ages(
),
],
)
def test_old_agb_field_classification_scores_genders(
def test_agb_old_field_classification_scores_genders(
self,
roundname: str,
gender: str,
age_group: str,
scores_expected: list[int],
) -> None:
"""Check that field classification returns expected value for a case."""
scores = class_funcs.old_agb_field_classification_scores(
scores = class_funcs.agb_old_field_classification_scores(
roundname=roundname,
bowstyle="barebow",
gender=gender,
Expand Down Expand Up @@ -148,14 +148,14 @@ def test_old_agb_field_classification_scores_genders(
),
],
)
def test_old_agb_field_classification_scores_bowstyles(
def test_agb_old_field_classification_scores_bowstyles(
self,
roundname: str,
bowstyle: str,
scores_expected: list[int],
) -> None:
"""Check that field classification returns expected value for a case."""
scores = class_funcs.old_agb_field_classification_scores(
scores = class_funcs.agb_old_field_classification_scores(
roundname=roundname,
bowstyle=bowstyle,
gender="male",
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_old_agb_field_classification_scores_bowstyles(
),
],
)
def test_old_agb_field_classification_scores_invalid(
def test_agb_old_field_classification_scores_invalid(
self,
roundname: str,
bowstyle: str,
Expand All @@ -203,7 +203,7 @@ def test_old_agb_field_classification_scores_invalid(
f"{gender.lower()}_{bowstyle.lower()}"
),
):
_ = class_funcs.old_agb_field_classification_scores(
_ = class_funcs.agb_old_field_classification_scores(
roundname=roundname,
bowstyle=bowstyle,
gender=gender,
Expand Down Expand Up @@ -275,7 +275,7 @@ class TestCalculateOldAgbFieldClassification:
),
],
)
def test_calculate_old_agb_field_classification(
def test_calculate_agb_old_field_classification(
self,
roundname: str,
score: float,
Expand All @@ -285,7 +285,7 @@ def test_calculate_old_agb_field_classification(
) -> None:
"""Check that field classification returns expected value for a few cases."""
# pylint: disable=too-many-arguments
class_returned = class_funcs.calculate_old_agb_field_classification(
class_returned = class_funcs.calculate_agb_old_field_classification(
roundname=roundname,
score=score,
bowstyle=bowstyle,
Expand All @@ -312,15 +312,15 @@ def test_calculate_old_agb_field_classification(
),
],
)
def test_calculate_old_agb_field_classification_invalid_rounds(
def test_calculate_agb_old_field_classification_invalid_rounds(
self,
roundname: str,
score: float,
bowstyle: str,
class_expected: str,
) -> None:
"""Check field classification returns unclassified for inappropriate rounds."""
class_returned = class_funcs.calculate_old_agb_field_classification(
class_returned = class_funcs.calculate_agb_old_field_classification(
roundname=roundname,
score=score,
bowstyle=bowstyle,
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_calculate_old_agb_field_classification_invalid_rounds(
),
],
)
def test_calculate_old_agb_field_classification_invalid_scores(
def test_calculate_agb_old_field_classification_invalid_scores(
self,
roundname: str,
score: float,
Expand All @@ -364,7 +364,7 @@ def test_calculate_old_agb_field_classification_invalid_scores(
f"Should be in range 0-{ALL_AGBFIELD_ROUNDS[roundname].max_score()}."
),
):
_ = class_funcs.calculate_old_agb_field_classification(
_ = class_funcs.calculate_agb_old_field_classification(
score=score,
roundname=roundname,
bowstyle="barebow",
Expand Down
Loading