-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Module ... has no attribute ... when #type: ignore[misc] is set at the top of a module #9318
Comments
Yeah, this looks like a bug. |
I've got the exact same issue happening with file-wide |
I had the same error message when importing from an auto-generated protobuf |
Yeps, same problem here. |
The workaround at the description is a pain when "type: ignore" needs to be placed in hundreds of lines. |
Maybe a per module https://mypy.readthedocs.io/en/stable/config_file.html#confval-ignore_errors works for your use case? |
Fwiw, I replaced |
Per-module error codes were added in python#13502, let's recommend using them. The existing type ignore behaviour is pretty unintuitive; I think most people actually want `# mypy: ignore-errors`. There are probably people depending on the current behaviour though. Fixes python#13435, fixes python#12076, fixes python#11999, fixes python#11027, fixes python#9318, fixes python#7839
Per-module error codes were added in #13502, let's recommend using them. The existing type ignore behaviour is pretty unintuitive; I think most people actually want `# mypy: ignore-errors`. There are probably people depending on the current behaviour though. Fixes #13435, fixes #12076, fixes #11999, fixes #11027, fixes #9318, fixes #7839
In our mypy config file we do not allow
Any
to be used. Because this cannot be avoided all the time we use#type: ignore[misc]
at the top of a module.We created a module called
typing.py
.This is imported in another module.
Actual result
Expected result
How did we solve it?
When we change
typing.py
so it ignoresAny
on each line we don't have any issues.Configuration
.mypy.ini
The text was updated successfully, but these errors were encountered: