Add an explanation of what error mypy produces when importing from a module with a top-line comment # type: ignore
#14340
Labels
# type: ignore
#14340
Documentation
Ignoring a whole file explains the side effect of using
# type: ignore
at the top.However, it doesn't show what kind of errors mypy produces when importing from such a module.
As shown in the following example, mypy provides an error styled of
error: Module "{{MODULE_NAME}}" has no attribute "{{ATTRIBUTE_NAME}}" [attr-defined]
.Neither
has no attribute
nor[attr-defined]
appears in Ignoring a whole file nor in the whole page of Common issues and solutions.It took me an hour to find this cause, and I believe it's worth mentioning in the documentation.
foo.py:
bar.py:
Executing mypy on foo.py:
Environment:
The text was updated successfully, but these errors were encountered: