Is it possible to silence mypy only for specific instances of an error code?

Viewed 17

Say that I have the following errors:

error: Name "MY_CONST" is not defined  [name-defined]
error: Name "ANOTHER_CONST" is not defined  [name-defined]

I want mypy to ignore all the error instances where the name not defined is MY_CONST but not when it is ANOTHER_CONST.

I know that I can append # type: ignore[attr-defined] to each line where [name-defined] errors related to MY_CONST are detected, but it is very tedious.

0 Answers
Related