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

[waiting for typed_ast PR] allow to write both "type: ignore" and "mypy: ignore" #2030

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion mypy/lex.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def add_pre_whitespace(self, s: str) -> None:
self.pre_whitespace += s
self.i += len(s)

type_ignore_exp = re.compile(r'[ \t]*#[ \t]*type:[ \t]*ignore\b')
type_ignore_exp = re.compile(r'[ \t]*#[ \t]*(mypy|type):[ \t]*ignore\b')

def add_token(self, tok: Token) -> None:
"""Store a token.
Expand Down
4 changes: 4 additions & 0 deletions test-data/unit/check-ignore.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ x = 1
x() # type: ignore
x() # E: "int" not callable

[case testMypyIgnore]
x = 1
x() # mypy: ignore

[case testIgnoreUndefinedName]
x = 1
y # type: ignore
Expand Down