Skip to content

mypy types #3583

Closed
Closed
@CoJeAndy

Description

@CoJeAndy

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

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