- Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Description
I noticed the return value type hint of redis-py functions are always like: Union[Awaitable[int], int]: (e.g. redis.commands.core.py:L4824)
def hlen(self, name: str) -> Union[Awaitable[int], int]: """ Return the number of elements in hash ``name`` For more information see https://redis.io/commands/hlen """ return self.execute_command("HLEN", name) When I receive the value as normal
dict_size = redis.hlen("dict_key") assert dict_size < 10 Pylance will remind me
Operator "<=" not supported for types "Awaitable[int] | int" and "Literal[10]" Operator "<=" not supported for types "Awaitable[int]" and "Literal[10]" How to let Pylance know I am not calling the function in asynchronous way, so I can mitigate this type checking error?
evgenymarkov, iamkroot, gazorby, JamesTann, abbasyadollahi and 31 morerob4226, tsukumijima, NikitaChekalinski and wookayin
Metadata
Metadata
Assignees
Labels
No labels