Skip to content

Commit 2e0e663

Browse files
committed
Fix type annotations in hmm.py
1 parent 853b652 commit 2e0e663

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

axelrod/strategies/hmm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Any, Dict
12
from axelrod.action import Action
23
from axelrod.evolvable_player import (
34
EvolvablePlayer,
@@ -71,9 +72,11 @@ def __init__(
7172
self.transitions_D = transitions_D
7273
self.emission_probabilities = emission_probabilities
7374
self.state = initial_state
74-
self._cache_C = dict()
75-
self._cache_D = dict()
75+
self._cache_C = dict() # type: Dict[int, int]
76+
self._cache_D = dict() # type: Dict[int, int]
7677
self._cache_deterministic_transitions()
78+
# Random generator will be set by parent strategy
79+
self._random = None # type: Any
7780

7881
def _cache_deterministic_transitions(self):
7982
"""Cache deterministic transitions to avoid unnecessary random draws."""
@@ -217,6 +220,7 @@ def set_seed(self, seed=None):
217220
super().set_seed(seed=seed)
218221
# Share RNG with HMM
219222
# The evolvable version of the class needs to manually share the rng with the HMM.
223+
# after initialization.
220224
try:
221225
self.hmm._random = self._random
222226
except AttributeError:

0 commit comments

Comments
 (0)