Annotate deprecated_args decorator to preserve wrapped function type signature by mharding-hpe · Pull Request #3701 · redis/redis-py (original) (raw)
Pull Request check-list
- Do tests and lints pass with this change?
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.
- Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
- 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
- Is there an example added to the examples folder (if applicable)?
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 of redis.Redis() to be Any.
This issue was introduced between v6.0.0b2 and v6.0.0. So ideally this fix would be backported to the v6.0 and v6.1 branches, but I don't know the policy for that in this project.