-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add basic support for PEP 702 (@deprecated). #17476
Open
tyralla
wants to merge
28
commits into
python:master
Choose a base branch
from
tyralla:feature/support_deprecated
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
f04f4e3
Add basic support for PEP 702 (@deprecated).
tyralla 973bf2d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a88f4b4
use `type: ignore[deprecated]` when importing `abstractproperty`
tyralla 91612c9
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla faa4911
accept deprecated.args >= 1
tyralla 101e9b8
": " instead of " - "
tyralla e3dfacb
only consider `warnings.deprecated` and `typing_extensions.deprecated…
tyralla cbf7574
note instead of error
tyralla 9a947a5
remove walrusses
tyralla 6d92318
document the new option
tyralla afa0336
motivate the semantic analyzer
tyralla 7bfb534
`report-deprecated-as-error` instead of `warn-deprecated` and three n…
tyralla 1042c65
fix a typo in error_code_list2.rst
tyralla 978b1a2
additional note when PEP 702 is unsatisfied with the order of `@depre…
tyralla b0ced07
mention the affected overload
tyralla a07fc64
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla b527250
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f636024
add an annotation required by mypyc
tyralla 63a725e
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla 966ac8b
refactor: create the whole deprecation warning in one place
tyralla 6a7dfe0
refactor: get rid of the `memberaccess` parameter
tyralla 1a40953
refactor: merge `check_deprecated_function` and `check_deprecated_cla…
tyralla 1372e66
refactor: convert `get_deprecation_warning` to `create_deprecation_wa…
tyralla 286371f
prefix the warnings with `class ...`, `function ...`, or `overload ..…
tyralla 6f54dab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8c0260e
Consider `CallableType.deprecated` in `__hash__`, `__eq__`, `serializ…
tyralla cf2dcaf
Add a few fine-grained tests (of which `testAddFunctionDeprecationInd…
tyralla 6a93d6a
Merge branch 'feature/support_deprecated' of https://github.com/tyral…
tyralla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there has been some back and forth so docs are out of sync now. To summarize how I see the logic should be:
--disable-error-code=deprecated
and/or# type: ignore[deprecated]
.# type: ignore[deprecated]
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Mypy implement other checks that can result in errors or notes, depending on an option? (I'm just asking to avoid reinventing the wheel.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I don't remember. But in any case it should be as simple as changing last line in your
warn_deprecated()
method inchecker.py
to something likeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems doable, thanks. I will implement it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
report-deprecated-as-error
is the shortest understandable description I could come up with. Other suggestions are welcome, of course.