diff --git a/third_party/2and3/redis/connection.pyi b/third_party/2and3/redis/connection.pyi index 719e95b7e..db30d2895 100644 --- a/third_party/2and3/redis/connection.pyi +++ b/third_party/2and3/redis/connection.pyi @@ -1,4 +1,4 @@ -from typing import Any, Mapping, Optional, Text, Union +from typing import Any, List, Mapping, Optional, Text, Tuple, Type, Union ssl_available: Any hiredis_version: Any @@ -12,10 +12,6 @@ SYM_CRLF: Any SYM_EMPTY: Any SERVER_CLOSED_CONNECTION_ERROR: Any -class Token: - value: Any - def __init__(self, value) -> None: ... - class BaseParser: EXCEPTION_CLASSES: Any def parse_error(self, response): ... @@ -24,13 +20,14 @@ class SocketBuffer: socket_read_size: Any bytes_written: Any bytes_read: Any - def __init__(self, socket, socket_read_size) -> None: ... + def __init__(self, socket, socket_read_size, socket_timeout) -> None: ... @property def length(self): ... def read(self, length): ... def readline(self): ... def purge(self): ... def close(self): ... + def can_read(self, timeout): ... class PythonParser(BaseParser): encoding: Any @@ -39,7 +36,7 @@ class PythonParser(BaseParser): def __del__(self): ... def on_connect(self, connection): ... def on_disconnect(self): ... - def can_read(self): ... + def can_read(self, timeout): ... def read_response(self): ... class HiredisParser(BaseParser): @@ -48,11 +45,17 @@ class HiredisParser(BaseParser): def __del__(self): ... def on_connect(self, connection): ... def on_disconnect(self): ... - def can_read(self): ... + def can_read(self, timeout): ... + def read_from_socket(self, timeout=..., raise_on_timeout: bool = ...) -> bool: ... def read_response(self): ... DefaultParser: Any +class Encoder: + def __init__(self, encoding, encoding_errors, decode_responses: bool) -> None: ... + def encode(self, value: Union[Text, bytes, memoryview, bool, float]) -> bytes: ... + def decode(self, value: Union[Text, bytes, memoryview], force: bool = ...) -> Text: ... + class Connection: description_format: Any pid: Any @@ -83,7 +86,7 @@ class Connection: encoding: Text = ..., encoding_errors: Text = ..., decode_responses: bool = ..., - parser_class: Optional[BaseParser] = ..., + parser_class: Type[BaseParser] = ..., socket_read_size: int = ..., health_check_interval: int = ..., client_name: Optional[Text] = ..., @@ -95,13 +98,14 @@ class Connection: def connect(self): ... def on_connect(self): ... def disconnect(self): ... - def send_packed_command(self, command): ... + def check_health(self) -> None: ... + def send_packed_command(self, command, check_health: bool = ...): ... def send_command(self, *args): ... - def can_read(self): ... + def can_read(self, timeout=...): ... def read_response(self): ... - def encode(self, value): ... def pack_command(self, *args): ... def pack_commands(self, commands): ... + def repr_pieces(self) -> List[Tuple[Text, Text]]: ... class SSLConnection(Connection): description_format: Any @@ -109,7 +113,9 @@ class SSLConnection(Connection): certfile: Any cert_reqs: Any ca_certs: Any - def __init__(self, ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=..., **kwargs) -> None: ... + def __init__( + self, ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=..., ssl_check_hostname: bool = ..., **kwargs + ) -> None: ... class UnixDomainSocketConnection(Connection): description_format: Any @@ -125,7 +131,8 @@ class UnixDomainSocketConnection(Connection): def __init__( self, path=..., - db=..., + db: int = ..., + username=..., password=..., socket_timeout=..., encoding=..., @@ -133,12 +140,17 @@ class UnixDomainSocketConnection(Connection): decode_responses=..., retry_on_timeout=..., parser_class=..., - socket_read_size=..., + socket_read_size: int = ..., + health_check_interval: int = ..., + client_name=..., ) -> None: ... + def repr_pieces(self) -> List[Tuple[Text, Text]]: ... + +def to_bool(value: object) -> bool: ... class ConnectionPool: @classmethod - def from_url(cls, url: Text, db: Optional[int] = ..., **kwargs) -> ConnectionPool: ... + def from_url(cls, url: Text, db: Optional[int] = ..., decode_components: bool = ..., **kwargs) -> ConnectionPool: ... connection_class: Any connection_kwargs: Any max_connections: Any @@ -148,7 +160,9 @@ class ConnectionPool: def get_connection(self, command_name, *keys, **options): ... def make_connection(self): ... def release(self, connection): ... - def disconnect(self): ... + def disconnect(self, inuse_connections: bool = ...): ... + def get_encoder(self) -> Encoder: ... + def owns_connection(self, connection: Connection) -> bool: ... class BlockingConnectionPool(ConnectionPool): queue_class: Any