Skip to content

Add basic support for PEP 702 (@deprecated). #17476

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

Merged
merged 40 commits into from
Oct 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f04f4e3
Add basic support for PEP 702 (@deprecated).
tyralla Jul 3, 2024
973bf2d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 3, 2024
a88f4b4
use `type: ignore[deprecated]` when importing `abstractproperty`
tyralla Jul 3, 2024
91612c9
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla Jul 3, 2024
faa4911
accept deprecated.args >= 1
tyralla Jul 4, 2024
101e9b8
": " instead of " - "
tyralla Jul 4, 2024
e3dfacb
only consider `warnings.deprecated` and `typing_extensions.deprecated…
tyralla Jul 4, 2024
cbf7574
note instead of error
tyralla Jul 4, 2024
9a947a5
remove walrusses
tyralla Jul 4, 2024
6d92318
document the new option
tyralla Jul 4, 2024
afa0336
motivate the semantic analyzer
tyralla Jul 4, 2024
7bfb534
`report-deprecated-as-error` instead of `warn-deprecated` and three n…
tyralla Jul 4, 2024
1042c65
fix a typo in error_code_list2.rst
tyralla Jul 4, 2024
978b1a2
additional note when PEP 702 is unsatisfied with the order of `@depre…
tyralla Jul 4, 2024
b0ced07
mention the affected overload
tyralla Jul 4, 2024
a07fc64
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla Jul 4, 2024
b527250
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2024
f636024
add an annotation required by mypyc
tyralla Jul 4, 2024
63a725e
Merge remote-tracking branch 'mypypy/feature/support_deprecated' into…
tyralla Jul 4, 2024
966ac8b
refactor: create the whole deprecation warning in one place
tyralla Jul 5, 2024
6a7dfe0
refactor: get rid of the `memberaccess` parameter
tyralla Jul 5, 2024
1a40953
refactor: merge `check_deprecated_function` and `check_deprecated_cla…
tyralla Jul 5, 2024
1372e66
refactor: convert `get_deprecation_warning` to `create_deprecation_wa…
tyralla Jul 5, 2024
286371f
prefix the warnings with `class ...`, `function ...`, or `overload ..…
tyralla Jul 5, 2024
6f54dab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 5, 2024
8c0260e
Consider `CallableType.deprecated` in `__hash__`, `__eq__`, `serializ…
tyralla Aug 27, 2024
cf2dcaf
Add a few fine-grained tests (of which `testAddFunctionDeprecationInd…
tyralla Aug 27, 2024
6a93d6a
Merge branch 'feature/support_deprecated' of https://github.com/tyral…
tyralla Aug 27, 2024
a6d0e59
Move the complete creation process of warning notes from `checker.py`…
tyralla Sep 22, 2024
6163787
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 22, 2024
49ee7a8
Move the `deprecation` attribute from the nodes `CallableType` and `O…
tyralla Sep 28, 2024
250e171
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 28, 2024
09a53d5
Modify function`snapshot_symbol_table` by removing the "CrossRef" sp…
tyralla Sep 29, 2024
31c4296
`typ: SymbolNode` -> `node: SymbolNode`
tyralla Sep 29, 2024
90fb06d
`type_` -> typ
tyralla Sep 29, 2024
beed6a5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2024
8eb2e77
Revert commit 09a53d5b (regarding `astdiff.py` but not `fine-grained.…
tyralla Oct 6, 2024
988bf5f
Merge branch 'master' into feature/support_deprecated
tyralla Oct 6, 2024
80ddc68
Add `testDeprecateFunctionAlreadyDecorated`.
tyralla Oct 6, 2024
d104f26
Add `deprecated` to the `Func` snapshot and adjust test `testDeprecat…
tyralla Oct 6, 2024
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
Prev Previous commit
Next Next commit
accept deprecated.args >= 1
  • Loading branch information
tyralla committed Jul 4, 2024
commit faa49111467cd37620d8b0cecf276dadf270cfd7
2 changes: 1 addition & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7565,7 +7565,7 @@ def get_deprecation_warning(self, decorators: Iterable[Expression]) -> str | Non
(callee.fullname in DEPRECATED_TYPE_NAMES)
or (not callee.fullname and callee.name == "deprecated")
)
and (len(args := decorator.args) == 1)
and (len(args := decorator.args) >= 1)
and isinstance(arg := args[0], StrExpr)
):
return arg.value
Expand Down