Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conformance/tests/directives_type_ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
y: int = "" # type: ignore - additional stuff

# The following type violation should be suppressed.
z: int = "" # type: ignore[additional_stuff]
z: int = "" # type: ignore[assignment]

# > 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
Expand Down
7 changes: 7 additions & 0 deletions docs/spec/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ other comments and linting markers:

# type: ignore # <comment or other marker>

Any text following ``# type: ignore`` is ignored, provided there is at least one
whitespace character after ``# type: ignore``. The form of
``# type: ignore[error_code1, error_code2]`` can be used to filter error codes
that may vary across type checkers. Type checkers may ignore the bracketed
codes and treat this form as equivalent to ``# type: ignore``.


.. _`cast`:

``cast()``
Expand Down