mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Add overloads to redis.asyncio.Redis (#10742)
This commit is contained in:
@@ -30,10 +30,11 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy
|
||||
connection_pool: Any
|
||||
single_connection_client: Any
|
||||
connection: Any
|
||||
@overload
|
||||
@classmethod
|
||||
def from_url(cls, url: str, **kwargs) -> Redis[Any]: ...
|
||||
def __init__(
|
||||
self,
|
||||
def from_url(
|
||||
cls,
|
||||
url: str,
|
||||
*,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
@@ -47,7 +48,117 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy
|
||||
unix_socket_path: str | None = None,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: bool = False,
|
||||
decode_responses: Literal[True],
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[RedisError]] | None = None,
|
||||
ssl: bool = False,
|
||||
ssl_keyfile: str | None = None,
|
||||
ssl_certfile: str | None = None,
|
||||
ssl_cert_reqs: str = "required",
|
||||
ssl_ca_certs: str | None = None,
|
||||
ssl_ca_data: str | None = None,
|
||||
ssl_check_hostname: bool = False,
|
||||
max_connections: int | None = None,
|
||||
single_connection_client: bool = False,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
auto_close_connection_pool: bool = True,
|
||||
redis_connect_func: ConnectCallbackT | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
) -> Redis[str]: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def from_url(
|
||||
cls,
|
||||
url: str,
|
||||
*,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
db: str | int = 0,
|
||||
password: str | None = None,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool | None = None,
|
||||
socket_keepalive_options: Mapping[int, int | bytes] | None = None,
|
||||
connection_pool: ConnectionPool | None = None,
|
||||
unix_socket_path: str | None = None,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: Literal[False] = False,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[RedisError]] | None = None,
|
||||
ssl: bool = False,
|
||||
ssl_keyfile: str | None = None,
|
||||
ssl_certfile: str | None = None,
|
||||
ssl_cert_reqs: str = "required",
|
||||
ssl_ca_certs: str | None = None,
|
||||
ssl_ca_data: str | None = None,
|
||||
ssl_check_hostname: bool = False,
|
||||
max_connections: int | None = None,
|
||||
single_connection_client: bool = False,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
auto_close_connection_pool: bool = True,
|
||||
redis_connect_func: ConnectCallbackT | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
) -> Redis[bytes]: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: Redis[str],
|
||||
*,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
db: str | int = 0,
|
||||
password: str | None = None,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool | None = None,
|
||||
socket_keepalive_options: Mapping[int, int | bytes] | None = None,
|
||||
connection_pool: ConnectionPool | None = None,
|
||||
unix_socket_path: str | None = None,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: Literal[True],
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[RedisError]] | None = None,
|
||||
ssl: bool = False,
|
||||
ssl_keyfile: str | None = None,
|
||||
ssl_certfile: str | None = None,
|
||||
ssl_cert_reqs: str = "required",
|
||||
ssl_ca_certs: str | None = None,
|
||||
ssl_ca_data: str | None = None,
|
||||
ssl_check_hostname: bool = False,
|
||||
max_connections: int | None = None,
|
||||
single_connection_client: bool = False,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
auto_close_connection_pool: bool = True,
|
||||
redis_connect_func: ConnectCallbackT | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: Redis[bytes],
|
||||
*,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
db: str | int = 0,
|
||||
password: str | None = None,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool | None = None,
|
||||
socket_keepalive_options: Mapping[int, int | bytes] | None = None,
|
||||
connection_pool: ConnectionPool | None = None,
|
||||
unix_socket_path: str | None = None,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: Literal[False] = False,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[RedisError]] | None = None,
|
||||
ssl: bool = False,
|
||||
|
||||
Reference in New Issue
Block a user