-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed as not planned
Closed as not planned
Copy link
Labels
topic: redisIssues related to the redis third-party stubsIssues related to the redis third-party stubs
Description
The latest releases of the async version of RedisCluster for the redis library (i.e: redis.asyncio.cluster) are failing on mypy due to undefined attributes (which do exist in reality):
Steps to reproduce:
- Install
mypy - Install
types-redis - Paste the following code into a file (e.g:
main.py):
import asyncio
import string
import random
from redis.asyncio.cluster import RedisCluster
async def future(rc: RedisCluster):
key = ''.join([random.choice(string.ascii_uppercase) for _ in range(6)])
field = ''.join([random.choice(string.ascii_uppercase) for _ in range(4)])
value = random.randint(0, 10)
await rc.zadd(key, {field: value}, ch=True)
await rc.zrem(key, field)
print("Ran for %s -> %s: %s" % (key, field, value))
async def main():
async with RedisCluster("localhost", 6379) as rc:
futures = [future(rc) for _ in range(100000)]
await asyncio.gather(*futures)
asyncio.run(main())- Evaluate the code with
mypy:mypy main.py - Output will be:
$ mypy redis_test.py
redis_test.py:11: error: "RedisCluster[Any]" has no attribute "zadd" [attr-defined]
redis_test.py:12: error: "RedisCluster[Any]" has no attribute "zrem" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)
chrisrink10
Metadata
Metadata
Assignees
Labels
topic: redisIssues related to the redis third-party stubsIssues related to the redis third-party stubs