Skip to content

Don't ignore imports with a '# type: ignore' comment #1737

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions mypy/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,7 @@ def parse_file(self) -> MypyFile:
defs = self.parse_defs()
weak_opts = self.weak_opts()
self.expect_type(Eof)
# Skip imports that have been ignored (so that we can ignore a C extension module without
# stub, for example), except for 'from x import *', because we wouldn't be able to
# determine which names should be defined unless we process the module. We can still
# ignore errors such as redefinitions when using the latter form.
imports = [node for node in self.imports
if node.line not in self.ignored_lines or isinstance(node, ImportAll)]
node = MypyFile(defs, imports, is_bom, self.ignored_lines,
node = MypyFile(defs, self.imports, is_bom, self.ignored_lines,
weak_opts=weak_opts)
return node

Expand Down