mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
[redis] Update stubs to 4.5.2 (#9912)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
version = "4.5.1"
|
||||
version = "4.5.2"
|
||||
# Requires a version of cryptography with a `py.typed` file
|
||||
requires = ["cryptography>=35.0.0", "types-pyOpenSSL"]
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
class JSONCommands:
|
||||
def arrappend(self, name, path=..., *args): ...
|
||||
def arrindex(self, name, path, scalar, start: int = ..., stop: int = ...): ...
|
||||
def arrinsert(self, name, path, index, *args): ...
|
||||
def arrlen(self, name, path=...): ...
|
||||
def arrpop(self, name, path=..., index: int = ...): ...
|
||||
def arrtrim(self, name, path, start, stop): ...
|
||||
def type(self, name, path=...): ...
|
||||
def resp(self, name, path=...): ...
|
||||
def arrappend(self, name: str, path: str | None = ..., *args) -> list[int | None]: ...
|
||||
def arrindex(
|
||||
self, name: str, path: str, scalar: int, start: int | None = None, stop: int | None = None
|
||||
) -> list[int | None]: ...
|
||||
def arrinsert(self, name: str, path: str, index: int, *args) -> list[int | None]: ...
|
||||
def arrlen(self, name: str, path: str | None = ...) -> list[int | None]: ...
|
||||
def arrpop(self, name: str, path: str | None = ..., index: int | None = -1) -> list[str | None]: ...
|
||||
def arrtrim(self, name: str, path: str, start: int, stop: int) -> list[int | None]: ...
|
||||
def type(self, name: str, path: str | None = ...) -> list[str]: ...
|
||||
def resp(self, name: str, path: str | None = ...) -> list[Incomplete]: ...
|
||||
def objkeys(self, name, path=...): ...
|
||||
def objlen(self, name, path=...): ...
|
||||
def numincrby(self, name, path, number): ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from _typeshed import Incomplete, Unused
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Iterable, Mapping
|
||||
from queue import Queue
|
||||
from socket import socket
|
||||
@@ -80,37 +81,25 @@ class Encoder:
|
||||
def encode(self, value: _Encodable) -> bytes: ...
|
||||
def decode(self, value: str | bytes | memoryview, force: bool = ...) -> str: ...
|
||||
|
||||
class Connection:
|
||||
class AbstractConnection:
|
||||
pid: int
|
||||
host: str
|
||||
port: int
|
||||
db: int
|
||||
username: str | None
|
||||
password: str | None
|
||||
client_name: str | None
|
||||
socket_timeout: float | None
|
||||
socket_connect_timeout: float | None
|
||||
socket_keepalive: bool
|
||||
socket_keepalive_options: Mapping[str, int | str]
|
||||
socket_type: int
|
||||
credential_provider: CredentialProvider | None
|
||||
password: str | None
|
||||
username: str | None
|
||||
retry_on_timeout: bool
|
||||
retry_on_error: list[type[Exception]]
|
||||
retry: Retry
|
||||
health_check_interval: int
|
||||
next_health_check: int
|
||||
redis_connect_func: _ConnectFunc | None
|
||||
encoder: Encoder
|
||||
next_health_check: int
|
||||
health_check_interval: int
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
db: int = 0,
|
||||
password: str | None = None,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool = False,
|
||||
socket_keepalive_options: Mapping[str, int | str] | None = None,
|
||||
socket_type: int = 0,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[Exception]] = ...,
|
||||
encoding: str = "utf-8",
|
||||
@@ -126,7 +115,8 @@ class Connection:
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
command_packer: Incomplete | None = None,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
@abstractmethod
|
||||
def repr_pieces(self) -> list[tuple[str, Any]]: ...
|
||||
def register_connect_callback(self, callback: _ConnectFunc) -> None: ...
|
||||
def clear_connect_callbacks(self) -> None: ...
|
||||
def set_parser(self, parser_class: type[BaseParser]) -> None: ...
|
||||
@@ -134,13 +124,49 @@ class Connection:
|
||||
def on_connect(self) -> None: ...
|
||||
def disconnect(self, *args: Unused) -> None: ... # 'args' added in redis 4.1.2
|
||||
def check_health(self) -> None: ...
|
||||
def send_packed_command(self, command: str | Iterable[str], check_health: bool = ...) -> None: ...
|
||||
def send_packed_command(self, command: str | Iterable[str], check_health: bool = True) -> None: ...
|
||||
def send_command(self, *args, **kwargs) -> None: ...
|
||||
def can_read(self, timeout: float | None = ...) -> bool: ...
|
||||
def read_response(self, disable_decoding: bool = ...) -> Any: ... # `str | bytes` or `list[str | bytes]`
|
||||
def can_read(self, timeout: float | None = 0) -> bool: ...
|
||||
def read_response(self, disable_decoding: bool = False) -> Any: ... # `str | bytes` or `list[str | bytes]`
|
||||
def pack_command(self, *args) -> list[bytes]: ...
|
||||
def pack_commands(self, commands: Iterable[Iterable[Incomplete]]) -> list[bytes]: ...
|
||||
def repr_pieces(self) -> list[tuple[str, str]]: ...
|
||||
|
||||
class Connection(AbstractConnection):
|
||||
host: str
|
||||
port: int
|
||||
socket_timeout: float | None
|
||||
socket_connect_timeout: float | None
|
||||
socket_keepalive: bool
|
||||
socket_keepalive_options: Mapping[str, int | str]
|
||||
socket_type: int
|
||||
def __init__(
|
||||
self,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool = False,
|
||||
socket_keepalive_options: Mapping[str, int | str] | None = None,
|
||||
socket_type: int = 0,
|
||||
*,
|
||||
db: int = 0,
|
||||
password: str | None = None,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[Exception]] = ...,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: bool = False,
|
||||
parser_class: type[BaseParser] = ...,
|
||||
socket_read_size: int = 65536,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
redis_connect_func: _ConnectFunc | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
command_packer: Incomplete | None = None,
|
||||
) -> None: ...
|
||||
def repr_pieces(self) -> list[tuple[str, Any]]: ...
|
||||
|
||||
class SSLConnection(Connection):
|
||||
keyfile: Any
|
||||
@@ -168,33 +194,57 @@ class SSLConnection(Connection):
|
||||
ssl_validate_ocsp_stapled: bool = ..., # added in 4.1.1
|
||||
ssl_ocsp_context: Incomplete | None = ..., # added in 4.1.1
|
||||
ssl_ocsp_expected_cert: Incomplete | None = ..., # added in 4.1.1
|
||||
**kwargs,
|
||||
) -> None: ...
|
||||
|
||||
class UnixDomainSocketConnection(Connection):
|
||||
path: str
|
||||
def __init__(
|
||||
self,
|
||||
path: str = "",
|
||||
db: int = 0,
|
||||
username: str | None = None,
|
||||
password: str | None = None,
|
||||
*,
|
||||
host: str = "localhost",
|
||||
port: int = 6379,
|
||||
socket_timeout: float | None = None,
|
||||
socket_connect_timeout: float | None = None,
|
||||
socket_keepalive: bool = False,
|
||||
socket_keepalive_options: Mapping[str, int | str] | None = None,
|
||||
socket_type: int = 0,
|
||||
db: int = 0,
|
||||
password: str | None = None,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[Exception]] = ...,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: bool = False,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[Exception]] = ...,
|
||||
parser_class: type[BaseParser] = ...,
|
||||
socket_read_size: int = 65536,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
redis_connect_func: _ConnectFunc | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
command_packer: Incomplete | None = None,
|
||||
) -> None: ...
|
||||
|
||||
class UnixDomainSocketConnection(AbstractConnection):
|
||||
path: str
|
||||
def __init__(
|
||||
self,
|
||||
path: str = "",
|
||||
*,
|
||||
db: int = 0,
|
||||
password: str | None = None,
|
||||
retry_on_timeout: bool = False,
|
||||
retry_on_error: list[type[Exception]] = ...,
|
||||
encoding: str = "utf-8",
|
||||
encoding_errors: str = "strict",
|
||||
decode_responses: bool = False,
|
||||
parser_class: type[BaseParser] = ...,
|
||||
socket_read_size: int = 65536,
|
||||
health_check_interval: int = 0,
|
||||
client_name: str | None = None,
|
||||
username: str | None = None,
|
||||
retry: Retry | None = None,
|
||||
redis_connect_func: _ConnectFunc | None = None,
|
||||
credential_provider: CredentialProvider | None = None,
|
||||
command_packer: Incomplete | None = None,
|
||||
) -> None: ...
|
||||
def repr_pieces(self) -> list[tuple[str, Any]]: ...
|
||||
|
||||
# TODO: make generic on `connection_class`
|
||||
class ConnectionPool:
|
||||
connection_class: type[Connection]
|
||||
|
||||
Reference in New Issue
Block a user