Skip to content

Commit a2b8e0b

Browse files
committed
Get mypy working again
1 parent 42ecb93 commit a2b8e0b

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

axelrod/game.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Tuple, Union
33

44
import numpy as np
5+
import numpy.typing as npt
56

67
from axelrod import Action
78

@@ -20,7 +21,7 @@ class AsymmetricGame(object):
2021
"""
2122

2223
# pylint: disable=invalid-name
23-
def __init__(self, A: np.array, B: np.array) -> None:
24+
def __init__(self, A: npt.NDArray, B: npt.NDArray) -> None:
2425
"""
2526
Creates an asymmetric game from two matrices.
2627

axelrod/load_data_.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def load_file(filename: str, directory: str) -> List[List[str]]:
2626

2727
path = str(pathlib.Path(directory) / filename)
2828
data_bytes = pkgutil.get_data(__name__, path)
29+
if data_bytes is None:
30+
raise FileNotFoundError(path)
2931
data = data_bytes.decode("UTF-8", "replace")
3032

3133
rows = []

run_mypy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"axelrod/strategies/rand.py",
5050
"axelrod/strategies/titfortat.py",
5151
"axelrod/strategies/hmm.py",
52-
"axelrod/strategies/human.py",
5352
"axelrod/strategies/finite_state_machines.py",
5453
"axelrod/strategies/worse_and_worse.py",
5554
]

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ deps =
2828
isort
2929
black
3030
numpy==1.26.4
31+
mypy
32+
types-setuptools
3133
commands =
3234
python -m pytest --cov-report term-missing --cov=axelrod --cov-fail-under=100 . --doctest-glob="*.md" --doctest-glob="*.rst"
3335
python -m black -l 80 . --check
3436
python -m isort --check-only axelrod/.
37+
python run_mypy.py
3538
python run_strategy_indexer.py

0 commit comments

Comments
 (0)