-
Notifications
You must be signed in to change notification settings - Fork 264
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 load_data #831
Add type hints to load_data #831
Conversation
This looks fine to me, but worth @marcharper who wrote this part of the library taking a look :) 👍 |
Filenames are tricky, they can actually be bytes. We don't use bytes filenames in this library but a user could, and the type checker doesn't like it. I suggest |
Here's the mypy output:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add this file to the type_tests.sh
script please: https://github.com/Axelrod-Python/Axelrod/blob/master/type_tests.sh
Actually perhaps easiest to ignore that until #843 is merged. :) |
@drvinceknight I am a little confused. Should I ignore this pull request for a while or should I not include this to the |
Sorry, the confusion is my fault. Ignore my request for adding the module to I've run mypy locally on this branch and getting no errors so it looks fine to me but perhaps I'm missing something from @marcharper's comment. |
No need to add this module to type_test.sh for now.
@drvinceknight Well, i am getting those errors too. As I pointed out in gitter, @marcharper wanted the option of |
Ah yes! My mistake, I had run mypy incorrectly just then. That change sounds good :) |
@drvinceknight The remaining errors also have something to do with |
@marcharper @drvinceknight The remaining errors that mypy produces:
These errors originate with the lines:
What is going on here? |
It's a str/bytes thing with what pkg_resources returns, binary data instead of string data as you might expect. We could try casting to a string: |
@marcharper I think you meant to say |
mypy is unhappy because we're overwriting a variable with a different type. This works:
|
Simple merge conflict here, in #852 I got rid of one of the functions in |
Fixes part of #808.