Skip to content

Commit ec36fe4

Browse files
emmatypinggvanrossum
authored andcommitted
Add note about silencing linters (#4314)
Fixes #4305.
1 parent 0991bc3 commit ec36fe4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/source/common_issues.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,25 @@ Here's the above example modified to use ``MYPY``:
472472
473473
def listify(arg: 'bar.BarClass') -> 'List[bar.BarClass]':
474474
return [arg]
475+
476+
477+
Silencing Linters
478+
-----------------
479+
480+
In some cases, linters will complain about unused imports or code. In
481+
these cases, you can silence them with a comment after type comments, or on
482+
the same line as the import:
483+
484+
.. code-block:: python
485+
486+
# to silence complaints about unused imports
487+
from typing import List # noqa
488+
a = None # type: List[int]
489+
490+
491+
To silence the linter on the same line as a type comment
492+
put the linter comment *after* the type comment:
493+
494+
.. code-block:: python
495+
496+
a = some_complex_thing() # type: ignore # noqa

0 commit comments

Comments
 (0)