Set pyflake AND mypy ignore same line

Question:

I write a module for Salt. By the documentation it adds __salt__ object into builtins. So, pyflake warn me that __salt__ is undefined when I run prospector and mypy says the same, that __salt__ is undefined! I can ignore either for pyflake with # noqa: F821 or for mypy with # type: ignore on that line.

The question is! How to ignore for both of them?

Asked By: senior_pimiento

||

Answers:

PEP 484 specifies towards the end of the section on type comments the following:

In some cases, linting tools or other comments may be needed on the same line as a type comment. In these cases, the type comment should be before other comments and linting markers:

# type: ignore # ~comment or other marker~

So, as Ryan Tam suggested, # type: ignore # noqa is the correct way to ignore both.

Answered By: ethanhs
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.