Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft modification to the @no_type_check section of the spec. #1615

Merged
merged 2 commits into from
Feb 4, 2024
Merged
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
14 changes: 10 additions & 4 deletions docs/spec/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,16 @@ This approach may also be useful to handle import cycles.
``@no_type_check``
------------------

To mark portions of the program that should not be covered by type
hinting, you can use the ``@typing.no_type_check`` decorator on a class or function.
Functions with this decorator should be treated as having
no annotations.
The ``@typing.no_type_check`` decorator may be supported by type checkers
for functions and classes.

If a type checker supports the ``no_type_check`` decorator for functions, it
should suppress all type errors for the ``def`` statement and its body including
any nested functions or classes. It should also ignore all parameter
and return type annotations and treat the function as if it were unannotated.

The behavior for the ``no_type_check`` decorator when applied to a class is
left undefined by the typing spec at this time.

Version and platform checking
-----------------------------
Expand Down
Loading