-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
disallow_untyped_calls in module does not override global section #10757
Comments
disallow_untyped_calls
in module does not override global section
I am affected by the same problem, using these versions:
|
I am affected by the same problem. Any progress on this? |
As an additional data point: I have the same problem (with selenium). |
Same on my side, I have the issue with |
Same for me, I have the issue with |
Could anyone clarify why is this labelled as a "bug"? It may be a feature request, but certainly not a bug. You disable error code for module, where it is located. The posted error is not located in |
Let me start with apologising if any of the following sounds rude or is too verbose - my intention was to point out exactly why I would label this as a bug. It not my intention to criticise the project and am sorry if you think I unfairly did so.
(I assume) it is labeled as bug because it is counter-intuitive given how the rest of the configuration works and how the documentation explains that the configuration can be used (the docs suggest that any and all things can be overriden like the example provided by @icepython in the the initial report. As a user of mypy - and someone typically willing to recommend using it - I'd prefer if the mypy team
If I may provide another sample, from configuration I work with: [tool.mypy] # https://mypy.readthedocs.io/en/stable/
show_error_codes = true
show_column_numbers = true
[...]
[[tool.mypy.overrides]]
module = [
"docker.*",
"etcd3gw.client"
]
ignore_missing_imports = true Using this snippet and it's wording with Here's the specific section from the documentation that made me initially believe this is possible:
There's also the following
After reading it, I scroll to the section "Untyped definitions and calls", subsection "disallow_untyped_calls", read the content. No mention it's global. I read the section text itself, no mention either; therefor, I assume it is intended to work like the people in this thread want. Source: https://mypy.readthedocs.io/en/stable/config_file.html |
this would be a ubiquitously useful feature, as it would allow projects to maintain fully strict typing while excepting calls made out to third party libraries that are not fully typed. As it is now, any third party library on pypi that isn't fully typed itself is unusable with an application that wishes to maintain strict typing for its own calls. I agree that the "disallow_untyped_calls" refers to calls made in the target source file, however this use should be clarified in the documentation, as you can see a lot of people hit this and are confused by it. Also, the fact that mypy currently has no way for full "strict" use while using third party libraries that have functions untyped should be noted. |
Just started using mypy and ran into this issue in <48 hours. As other have said, some libraries have types and some don't so this is really obviously a bug. |
Fixes #10757 It is surprisingly one of the most upvoted issues. Also it looks quite easy to implement, so why not. Note I also try to improve docs for per-module logic for `disallow_untyped_calls`, as there is currently some confusion. --------- Co-authored-by: Ivan Levkivskyi <ilevkivskyi@hopper.com>
Bug Report
Since updating numpy from version "1.20.3" to version "1.21.0" we are getting the following errors:
error: Call to untyped function "load" in typed context
We want to suppress errors about untyped calls from numpy - but not globally.
To Reproduce
(Write your steps here:)
mypy.ini
:example.py
:mypy example.py --config-file mypy.ini
Expected Behavior
Expected to not see an error about:
Call to untyped function
Actual Behavior
Actual:
example.py:5: error: Call to untyped function "save" in typed context
Your Environment
mypy 0.812
--config-file mypy.ini
mypy.ini
(and other config files):Python 3.8.10
Ubuntu 20.04.2 LTS
1.21.0
Note: setting
disallow_untyped_calls
to False globally does work (but is undesired)The text was updated successfully, but these errors were encountered: