Description
Sometimes it's impossible to put # type: ignore
on the offending line - e.g. because it's a multiline string, and there's nowhere you can put the comment outside the string that mypy will recognise. Or more generally, there might be a whole block of code for which mypy has a bunch of spurious complaints, so putting in dozens of # type: ignore
s is a bit noisy.
The only other option today is to have mypy ignore the entire file, but that has nasty ramifications - beyond just killing type checking for what might be 99% checkable, it also makes any imports of that file invalid, and so you have to spread ignore directives out like a messy spiderweb.
Thus, it'd be great if one could do e.g. # type: ignore on
and # type: ignore off
, so that the scope could be controlled precisely.