Skip to content

ResponseT shouldn't be async when using sync Redis class #3497

Closed
@patrick91

Description

@patrick91

This code here:

from typing import reveal_type

from redis import Redis

redis = Redis(host="localhost", port=6379, db=0)

redis.set("test", "Hello, World!")

reveal_type(redis.get("test"))

Shows:

Revealed type is "Union[typing.Awaitable[Any], Any]"

Which I think is wrong, since the return type should be Any instead[1], right?

I think we might separate ResponseT for Redis and async Redis, what do you think?

I haven't sent a PR for this, because it will touch quite a few files, so I wanted to double check with you all first 😊

[1] We should allow using generics for return types, but that's another issue 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions