Skip to content

Commit

Permalink
Get mypy working again
Browse files Browse the repository at this point in the history
  • Loading branch information
gaffney2010 committed Nov 16, 2024
1 parent 42ecb93 commit a2b8e0b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion axelrod/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Tuple, Union

import numpy as np
import numpy.typing as npt

from axelrod import Action

Expand All @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions axelrod/load_data_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
1 change: 0 additions & 1 deletion run_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a2b8e0b

Please sign in to comment.