Skip to content

mypy types #3583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CoJeAndy opened this issue Apr 3, 2025 · 2 comments
Closed

mypy types #3583

CoJeAndy opened this issue Apr 3, 2025 · 2 comments

Comments

@CoJeAndy
Copy link

CoJeAndy commented Apr 3, 2025

Hi, would it be possible to add method annotations ass string literals to get type annotations with mypy? I was using types-redis but it doesn't support some new functionality from the >=5.0.0.

If this is not possible could you please give me explanation what it would break? Thanks

from json import JSONDecoder, JSONEncoder

from typing import TYPE_CHECKING  

if TYPE_CHECKING:  
    from .json import JSON


class RedisModuleCommands:
    """This class contains the wrapper functions to bring supported redis
    modules into the command namespace.
    """

    def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()) -> "JSON":
        """Access the json namespace, providing support for redis json."""

        from .json import JSON

        jj = JSON(client=self, encoder=encoder, decoder=decoder)
        return jj
@petyaslavova
Copy link
Collaborator

Hi @CoJeAndy, that sounds like a great addition! I can make the change sometime next week, but if you have time, feel free to contribute by opening a PR. 🙂

@petyaslavova
Copy link
Collaborator

Fixed with PR #3632

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants