Skip to content
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

Whole file # type: ignore does not silence import errors #6852

Closed
gwk opened this issue May 16, 2019 · 1 comment · Fixed by #6853
Closed

Whole file # type: ignore does not silence import errors #6852

gwk opened this issue May 16, 2019 · 1 comment · Fixed by #6853

Comments

@gwk
Copy link

gwk commented May 16, 2019

I just discovered PR #6830 and tried it out in master. It seems to work for the most part, but Mypy still complains about missing stub files. For example:

# type: ignore
import boto3 # This does not get ignored.
n:List[int] = 'a' # This gets ignored.
x.py:2: error: No library stub file for module 'boto3'
x.py:2: note: (Stub files are from https://github.com/python/typeshed)

It seems missing a critical stub file is a good use case for ignoring an entire file, but perhaps I'm missing something. Hope this helps!

version: mypy 0.710+dev.7cef06bc65d416ed3a533bbc4c630bd9417adb06.dirty

@brandtbucher
Copy link
Member

I can reproduce this. It looks like the MypyFile.imports aren't being marked as unreachable.

I'll take a peek at this when I have the time. Thanks for the heads-up!

gvanrossum pushed a commit that referenced this issue May 20, 2019
Fixes #6852, and adds a regression test.
PattenR pushed a commit to PattenR/mypy that referenced this issue Jun 23, 2019
Fixes python#6852, and adds a regression test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants