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?
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.
所有评论(0)