39

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?

senior_pimiento
  • 702
  • 1
  • 5
  • 15

1 Answers1

62

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.

ethanhs
  • 1,483
  • 9
  • 12