-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
1/X Fix check_untyped_defs = True mypy errors #5673
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
Conversation
ddd265a
to
cd300cc
Compare
Updated to fix a couple CI failures. |
@bluetech |
Oh, it does not enabled |
cd300cc
to
64e551f
Compare
I rebased, it's ready from my side. I don't mind if it's squashed - I mostly split it for reviewing. Let me know if you want me to do it.
Yes, I didn't want to send too much in one PR. I will follow up with more. |
@bluetech |
This is nice for self-documentation, and is the type required by mypy for adding to sys.meta_path.
64e551f
to
7259c45
Compare
Codecov Report
@@ Coverage Diff @@
## features #5673 +/- ##
============================================
- Coverage 96.25% 96.21% -0.05%
============================================
Files 117 117
Lines 25948 25993 +45
Branches 2497 2497
============================================
+ Hits 24977 25008 +31
- Misses 667 677 +10
- Partials 304 308 +4
Continue to review full report at Codecov.
|
@blueyed I squashed all of the commits except for the first one. |
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.
I've quickly compared the old and new number of issues with --check-untyped-defs
: 219 before, 134 after.
I merged this, thanks everyone. Next parts will come soon. |
check_untyped_defs = True
instructs mypy to also check bodies of functions which are not annotated (doc).I would like to enable this option because it provides some internal dogfooding of the type annotations as they are added. For example, we added type annotations for
pytest.raises
, but since all of the tests are untyped, the tests weren't checked against it. Withcheck_untyped_defs = True
, there is at least some basic coverage (number of parameters, parameter names, etc.).There are a few hundred such errors, mostly mypy complaining that it can't infer the type of empty containers, but some other minor stuff as well. This PR fixes the error for a first batch of modules. Each commit handles a separate module.