type: ignore[import-untyped]
leaves a hard-to-suppress note
#16003
Labels
type: ignore[import-untyped]
leaves a hard-to-suppress note
#16003
Bug Report
type: ignore[import-untyped]
leaves a note that must be silenced withtype: ignore[import]
, but only for one of the locations.To Reproduce
Consider two files, a.py and b.py, both with this content:
Since sentencepiece is a third-party package without type information, mypy complains:
So, let's try to shut up mypy, since our project can't do anything to fix that issue internally. First, I tried using disabled_error_codes in mypy.ini, and was met with issue #16002. Then, I tried adding
type: ignore
comments, like this:This doesn't really work:
For one file only, mypy leaves a note providing a link to the documentation, with no associated error message.
This can be worked around by using
type: ignore[import]
on the line it complains about, but I don't know if that has to be done for just one of the files or all of them, and how mypy decides which one. I also don't want to hide other kinds of import errors, such as a package being missing entirely, or stubs that are available but not installed.Your Environment
mypy 1.7.0+dev.9a0aca14724eeef580eefcd3b340678313a1930a (compiled: no)
The text was updated successfully, but these errors were encountered: