Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hints to alternator #836

Merged
merged 2 commits into from
Feb 1, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion axelrod/strategies/alternator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from axelrod import Actions, Player
import axelrod

C, D = Actions.C, Actions.D

Expand All @@ -17,7 +18,7 @@ class Alternator(Player):
'manipulates_state': False
}

def strategy(self, opponent):
def strategy(self, opponent: axelrod.player.Player) -> axelrod.actions.Action:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just Player is fine here since you imported it; you can import Action from axelrod.actions and then there's no need to import axelrod in line 2.

if len(self.history) == 0:
return C
if self.history[-1] == C:
Expand Down