0

I used to mark it as client:Redis[bytes] = Redis(decode_responses=False),

but it throw the error raise TypeError(f"{cls} is not a generic class")

what's the correct typing of bytes Redis.

tiyee
  • 63
  • 5
  • Redis is generic [in stubs](https://github.com/python/typeshed/blob/main/stubs/redis/redis/client.pyi), but not at runtime - so it's one more duplicate of question about string annotations. Use annotations future-import or string literal in annotation, as per linked question (there should be better dupe, but I'm not sure it's necessary here and can't find it quickly) – STerliakov Feb 19 '23 at 12:01
  • Does this answer your question? [How do I type hint a method with the type of the enclosing class?](https://stackoverflow.com/questions/33533148/how-do-i-type-hint-a-method-with-the-type-of-the-enclosing-class) – STerliakov Feb 19 '23 at 12:04

0 Answers0