Annotate deprecated_args decorator to preserve wrapped function type signature #3701
+7
−3
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.
Pull Request check-list
Everything passes except one standalone test:
tests/test_commands.py::TestRedisCommands::test_psync
However, I ran the tests on the
master
branch of the repo and got the same result, so I assume that test failure is unrelated to my changes.mharding-hpe#2
Is the new or changed code fully tested?
Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
N.A
N/A
Description of change
Opened to resolve issue #3700
Added type annotations to the
deprecated_args
decorator, to clarify that the type of callable will not be modified by anything inside the different functions (thus preserving its original signature). Without this,mypy
interprets the type ofredis.Redis()
to beAny
.This issue was introduced between
v6.0.0b2
andv6.0.0
. So ideally this fix would be backported to thev6.0
andv6.1
branches, but I don't know the policy for that in this project.