redis-py
redis-py copied to clipboard
New release 5.0.0 returns error with pyright
Hello,
pyright returns a error with the new version :
Version: 5.0.0
Platform: MacOs amd64
Description:
for l in redis.xread({"events": "0"}, count=100000, block=0):
« Awaitable[Unknown] » n’est pas itérable
Méthode « __iter__ » non définie
I'm having the same issues using pyright==1.1.323.
xread() method is typed as returning ResponseT which is a type-alias for Union[Awaitable, Any]. From pyright's point of view this kinda makes sense, as an Awaitable and Any is indeed quite different.
Does it exist any suggested way of telling the type-checker whether we are using sync or async Redis to avoid this, or is this a bug?
Relevant: https://github.com/redis/redis-py/issues/3497