Skip to content

Commit d278a6e

Browse files
Merge pull request #846 from janga1997/typeHint-apavlov
Add type hints to apavlov
2 parents bce4f70 + b0fa87f commit d278a6e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

axelrod/strategies/apavlov.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from axelrod.actions import Actions
1+
2+
from axelrod.actions import Actions, Action
23
from axelrod.player import Player
34

45
C, D = Actions.C, Actions.D
@@ -26,11 +27,11 @@ class APavlov2006(Player):
2627
'manipulates_state': False
2728
}
2829

29-
def __init__(self):
30+
def __init__(self) -> None:
3031
super().__init__()
31-
self.opponent_class = None
32+
self.opponent_class = ""
3233

33-
def strategy(self, opponent):
34+
def strategy(self, opponent: Player) -> Action:
3435
# TFT for six rounds
3536
if len(self.history) < 6:
3637
return D if opponent.history[-1:] == [D] else C
@@ -93,11 +94,11 @@ class APavlov2011(Player):
9394
'manipulates_state': False
9495
}
9596

96-
def __init__(self):
97+
def __init__(self) -> None:
9798
super().__init__()
98-
self.opponent_class = None
99+
self.opponent_class = ""
99100

100-
def strategy(self, opponent):
101+
def strategy(self, opponent: Player) -> Action:
101102
# TFT for six rounds
102103
if len(self.history) < 6:
103104
return D if opponent.history[-1:] == [D] else C

type_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/alternato
1111
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/ann.py
1212
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/appeaser.py
1313
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/averagecopier.py
14+
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/apavlov.py
1415
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/axelrod_second.py
1516
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/backstabber.py
1617
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/better_and_better.py

0 commit comments

Comments
 (0)