redis / redis-py

Redis Python client
MIT License
12.69k stars 2.53k forks source link

Clarification on Broad Type Hints for Redis Client Methods #3421

Open h3isenbug opened 3 weeks ago

h3isenbug commented 3 weeks ago

Version: 5.2.0 Platform: all of them Description: Type hints seem way too broad, and I was wondering if there’s a specific reason for this or if it's simply an unresolved issue.

For example, the ping method on the synchronous Redis client only returns a boolean, but the type annotations are as follows:

ResponseT = Union[Awaitable[Any], Any]

    def ping(self, **kwargs) -> ResponseT:

I understand that the same type annotation is used for both synchronous and asynchronous implementations, but this confuses linters.

Thanks in advance.