-
Notifications
You must be signed in to change notification settings - Fork 4
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
use type hinting #674
Merged
use type hinting #674
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #674 +/- ##
==========================================
+ Coverage 92.53% 93.21% +0.67%
==========================================
Files 38 39 +1
Lines 3927 4330 +403
==========================================
+ Hits 3634 4036 +402
- Misses 293 294 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#612
the mypy support is very very complicated as everything needs to be typed to not raise an error. On my local machine there are still 237 errors to take care of but I think it's not very meaningful to adress them all here. I would prefer to run it once in a while and reduce them step by step.
Using pre-commit was not possible as the imports are not available without install and pre-commit don't do that: https://github.com/pre-commit/mirrors-mypy#mypy-mirror
I tried my best to keep the previously set values (
None
,""
,False
) and the tests are not complaining so it seems ok.Note that it's impossible to do something like:
And document it as a is not set before the call to
__init__
. That's why I decided to keep all theNone
initialized variables and set them toOptional[xx]
type.For readability, I moved the definition of a class into the
__init__
method to get the hint in the parameters. I don't know yet if I keep the public constructor in the doc or not thoughedit
Cannot go any further as mypy is not supporting
Self
hint yet. python/mypy#14041 will be merged in v0.992