diff --git a/axelrod/game.py b/axelrod/game.py index 0d8f94380..c2b4ffc44 100644 --- a/axelrod/game.py +++ b/axelrod/game.py @@ -2,6 +2,7 @@ from typing import Tuple, Union import numpy as np +import numpy.typing as npt from axelrod import Action @@ -20,7 +21,7 @@ class AsymmetricGame(object): """ # pylint: disable=invalid-name - def __init__(self, A: np.array, B: np.array) -> None: + def __init__(self, A: npt.NDArray, B: npt.NDArray) -> None: """ Creates an asymmetric game from two matrices. diff --git a/axelrod/load_data_.py b/axelrod/load_data_.py index e55f5f395..ebf464975 100644 --- a/axelrod/load_data_.py +++ b/axelrod/load_data_.py @@ -26,6 +26,8 @@ def load_file(filename: str, directory: str) -> List[List[str]]: path = str(pathlib.Path(directory) / filename) data_bytes = pkgutil.get_data(__name__, path) + if data_bytes is None: + raise FileNotFoundError(path) data = data_bytes.decode("UTF-8", "replace") rows = [] diff --git a/run_mypy.py b/run_mypy.py index 94e3d669e..c0952e7e7 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -49,7 +49,6 @@ "axelrod/strategies/rand.py", "axelrod/strategies/titfortat.py", "axelrod/strategies/hmm.py", - "axelrod/strategies/human.py", "axelrod/strategies/finite_state_machines.py", "axelrod/strategies/worse_and_worse.py", ] diff --git a/tox.ini b/tox.ini index e40c8375b..7afca6c9d 100644 --- a/tox.ini +++ b/tox.ini @@ -28,8 +28,11 @@ deps = isort black numpy==1.26.4 + mypy + types-setuptools commands = python -m pytest --cov-report term-missing --cov=axelrod --cov-fail-under=100 . --doctest-glob="*.md" --doctest-glob="*.rst" python -m black -l 80 . --check python -m isort --check-only axelrod/. + python run_mypy.py python run_strategy_indexer.py