Skip to content

Commit

Permalink
Merge pull request #846 from janga1997/typeHint-apavlov
Browse files Browse the repository at this point in the history
Add type hints to apavlov
  • Loading branch information
drvinceknight authored Feb 10, 2017
2 parents bce4f70 + b0fa87f commit d278a6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions axelrod/strategies/apavlov.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from axelrod.actions import Actions

from axelrod.actions import Actions, Action
from axelrod.player import Player

C, D = Actions.C, Actions.D
Expand Down Expand Up @@ -26,11 +27,11 @@ class APavlov2006(Player):
'manipulates_state': False
}

def __init__(self):
def __init__(self) -> None:
super().__init__()
self.opponent_class = None
self.opponent_class = ""

def strategy(self, opponent):
def strategy(self, opponent: Player) -> Action:
# TFT for six rounds
if len(self.history) < 6:
return D if opponent.history[-1:] == [D] else C
Expand Down Expand Up @@ -93,11 +94,11 @@ class APavlov2011(Player):
'manipulates_state': False
}

def __init__(self):
def __init__(self) -> None:
super().__init__()
self.opponent_class = None
self.opponent_class = ""

def strategy(self, opponent):
def strategy(self, opponent: Player) -> Action:
# TFT for six rounds
if len(self.history) < 6:
return D if opponent.history[-1:] == [D] else C
Expand Down
1 change: 1 addition & 0 deletions type_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/alternato
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/ann.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/appeaser.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/averagecopier.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/apavlov.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/axelrod_second.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/backstabber.py
mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/better_and_better.py
Expand Down

0 comments on commit d278a6e

Please sign in to comment.