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

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

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 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.