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 for action script #815

Merged
merged 4 commits into from
Jan 15, 2017
Merged

Add type hints for action script #815

merged 4 commits into from
Jan 15, 2017

Conversation

souravsingh
Copy link
Contributor

No description provided.

@@ -1,10 +1,14 @@
from typing import NewType

C = NewType('Action', str)
Copy link
Member

Choose a reason for hiding this comment

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

I think you probably want Action = NewType('Action', str) and to declare C and D as actions. Unfortunately it's not easy to do so without the Py3.6 additions to type hints. But I think this would still work for flip_action.

@marcharper
Copy link
Member

marcharper commented Jan 14, 2017

@souravsingh This is a tough one actually -- I'm not sure of the best way to annotate this file since we'd like to use the Py3.6 method that I linked in the issue, and Actions should probably be an enum now.

By the way, you can run the tests with ./test in the axelrod directory to see the output locally before you push the PR, it's a bit faster than waiting on travis.

@souravsingh
Copy link
Contributor Author

@marcharper I have made some fixes. Is the Patch ready for merging?

from typing import NewType

Action = NewType('Action', str)
Action = NewType('Action', str)
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove the duplicate line.

@marcharper
Copy link
Member

marcharper commented Jan 14, 2017

I think so once the duplicate is removed, let's wait for another review and squash the commits on merge.

@drvinceknight drvinceknight merged commit 2a83208 into Axelrod-Python:master Jan 15, 2017
@souravsingh souravsingh deleted the add-types branch January 16, 2017 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants