-
Couldn't load subscription status.
- Fork 2.6k
Open
Labels
Description
Version: redis==5.0.4, mypy==1.10.0
Platform: Python 3.12 on Ubuntu 23.10
Description:
For some reasons, mypy shows the incompatible types error for the expiretime command in the async case, but this code works fine. What could be the problem?
import asyncio from redis.asyncio import ConnectionPool, Redis async def main() -> None: pool = ConnectionPool.from_url('redis://localhost:6379/0') client = await Redis.from_pool(connection_pool=pool) assert isinstance(client, Redis) try: await client.set('key', 'value', ex=300) exp = await client.expiretime('key') # error: Incompatible types in "await" (actual type "int", expected type "Awaitable[Any]") [misc] assert isinstance(exp, int) finally: await client.aclose() if __name__ == '__main__': asyncio.run(main())According to this description: "Redis-py 5.0.0 added a py.typed file, but the inline annotations are incomplete", so perhaps the issue is the built-in annotations
P.S. looks similar to 2399