diff --git a/archeryutils/__init__.py b/archeryutils/__init__.py index 4addec5..ab59061 100644 --- a/archeryutils/__init__.py +++ b/archeryutils/__init__.py @@ -6,11 +6,11 @@ from archeryutils.utils import versions __all__ = [ - "classifications", - "handicaps", "Pass", - "Round", "Quantity", + "Round", "Target", + "classifications", + "handicaps", "versions", ] diff --git a/archeryutils/classifications/__init__.py b/archeryutils/classifications/__init__.py index 83df750..a150593 100644 --- a/archeryutils/classifications/__init__.py +++ b/archeryutils/classifications/__init__.py @@ -22,14 +22,14 @@ ) __all__ = [ - "calculate_agb_outdoor_classification", - "agb_outdoor_classification_scores", - "calculate_agb_indoor_classification", + "agb_field_classification_scores", "agb_indoor_classification_scores", - "calculate_agb_old_indoor_classification", "agb_old_indoor_classification_scores", - "agb_field_classification_scores", + "agb_outdoor_classification_scores", "calculate_agb_field_classification", + "calculate_agb_indoor_classification", + "calculate_agb_old_indoor_classification", + "calculate_agb_outdoor_classification", "calculate_old_agb_field_classification", "old_agb_field_classification_scores", ] diff --git a/archeryutils/classifications/agb_old_field_classifications.py b/archeryutils/classifications/agb_old_field_classifications.py index e1a9f77..1e38126 100644 --- a/archeryutils/classifications/agb_old_field_classifications.py +++ b/archeryutils/classifications/agb_old_field_classifications.py @@ -210,11 +210,11 @@ def calculate_old_agb_field_classification( class_scores = dict( zip(group_data["classes"], group_data["class_scores"], strict=True) ) - for item in class_scores: - if class_scores[item] > score: + for classification, classification_score in class_scores.items(): + if classification_score > score: continue else: - return item + return classification # if lower than 3rd class score return "UC" return "unclassified" diff --git a/archeryutils/handicaps/__init__.py b/archeryutils/handicaps/__init__.py index ec018cd..9ef6bf4 100644 --- a/archeryutils/handicaps/__init__.py +++ b/archeryutils/handicaps/__init__.py @@ -14,15 +14,15 @@ __all__ = [ "FloatArray", + "HandicapAA", + "HandicapAA2", + "HandicapAGB", + "HandicapAGBold", + "HandicapScheme", "HandicapTable", - "handicap_scheme", "arrow_score", + "handicap_from_score", + "handicap_scheme", "score_for_passes", "score_for_round", - "handicap_from_score", - "HandicapScheme", - "HandicapAGB", - "HandicapAGBold", - "HandicapAA", - "HandicapAA2", ] diff --git a/archeryutils/handicaps/handicap_scheme.py b/archeryutils/handicaps/handicap_scheme.py index afb1ddf..e5c02ea 100644 --- a/archeryutils/handicaps/handicap_scheme.py +++ b/archeryutils/handicaps/handicap_scheme.py @@ -34,7 +34,7 @@ import itertools as itr import warnings from abc import ABC, abstractmethod -from typing import Optional, TypeVar, Union, overload +from typing import Optional, TypeVar, Union, cast, overload import numpy as np import numpy.typing as npt @@ -161,7 +161,9 @@ def sigma_r(self, handicap: FloatArray, dist: float) -> FloatArray: """ sig_t = self.sigma_t(handicap, dist) sig_r = dist * sig_t - return sig_r + + # Perform a cast to return to satisfy typechecker + return cast(FloatArray, sig_r) def arrow_score( self, diff --git a/archeryutils/handicaps/handicap_tables.py b/archeryutils/handicaps/handicap_tables.py index 8d919c7..45da2e9 100644 --- a/archeryutils/handicaps/handicap_tables.py +++ b/archeryutils/handicaps/handicap_tables.py @@ -301,7 +301,7 @@ def _clean_repeated( self.table = np.flip(self.table, axis=0) for irow, row in enumerate(self.table[:-1, :]): - for jscore in range(len(row)): + for jscore in range(len(np.asarray(row))): if self.table[irow, jscore] == self.table[irow + 1, jscore]: if self.int_prec: self.table[irow, jscore] = _FILL diff --git a/archeryutils/length.py b/archeryutils/length.py index b1c192d..c0ad310 100644 --- a/archeryutils/length.py +++ b/archeryutils/length.py @@ -8,7 +8,7 @@ from collections.abc import Collection, Set from typing import TypeVar, Union -__all__ = [ +__all__ = [ # noqa: RUF022 - Non-alphabetical sort is more logical here "yard", "metre", "inch",