Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Make untyped decorator its own code#19911
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
2eae039 Update errorcodes.py: UNTYPED_DECORATOR
wyattscarpenter021fc0a Update messages.py: UNTYPED_DECORATOR
wyattscarpenter6b0f0d8 black
wyattscarpentera586b8e docu
wyattscarpenter3282eb1 enable sub_code_of=MISC for backwards compat reason
wyattscarpenter3456a8b Apply suggestion from @wyattscarpenter
wyattscarpenter19d9d40 Update error_code_list2.rst
wyattscarpenter8b62963 add tests
wyattscarpenter78af836 Update docs/source/error_code_list2.rst: fix heading underline
wyattscarpenter10ffd2e fix the fix
wyattscarpenter93ed8dd make untyped-decorator not a sub cose of misc, per suggestion
wyattscarpenter263b93f [pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]ed20c35 actually this last thing should test sonething different
wyattscarpenterFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
docu
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commita586b8ec9510c4dbe3f0ffaf8b5febc750a9a949
There are no files selected for viewing
23 changes: 23 additions & 0 deletionsdocs/source/error_code_list2.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -676,3 +676,26 @@ Example: | ||
| print("red") | ||
| case _: | ||
| print("other") | ||
| .. _code-untyped-decorator: | ||
| Error if an untyped decorator makes a typed function effectively untyped [untyped-decorator] | ||
| -----------------------------------------------------> | ||
wyattscarpenter marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| If enabled with :option:`--disallow-untyped-decorators` | ||
| mypy generates an error if a typed function is wrapped by an untyped decorator | ||
| (as this would effectively remove the benefits of typing the function). | ||
| Example: | ||
| .. code-block:: python | ||
| def printing_decorator(func): | ||
| def wrapper(*args, **kwds): | ||
| print("Calling", func) | ||
| return func(*args, **kwds) | ||
| return wrapper | ||
| # A decorated function. | ||
| @printing_decorator # E: Untyped decorator makes function "add_forty_two" untyped [misc] | ||
| def add_forty_two(value: int) -> int: | ||
| return value + 42 | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.