mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 16:27:08 +08:00
Update redis to 4.5.5 (#10161)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
version = "4.5.4"
|
||||
version = "4.5.5"
|
||||
# Requires a version of cryptography with a `py.typed` file
|
||||
requires = ["cryptography>=35.0.0", "types-pyOpenSSL"]
|
||||
|
||||
|
||||
@@ -832,7 +832,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override]
|
||||
def zremrangebyrank(self, name: _Key, min: int, max: int) -> Any: ... # type: ignore[override]
|
||||
def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Any: ... # type: ignore[override]
|
||||
def zrevrank(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override]
|
||||
def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> Any: ... # type: ignore[override]
|
||||
def zscore(self, name: _Key, value: _Value) -> Any: ... # type: ignore[override]
|
||||
def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False) -> Any: ... # type: ignore[override]
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> Any: ... # type: ignore[override]
|
||||
|
||||
@@ -73,6 +73,7 @@ class RedisCluster(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # T
|
||||
ssl_certfile: str | None = None,
|
||||
ssl_check_hostname: bool = False,
|
||||
ssl_keyfile: str | None = None,
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None = None,
|
||||
) -> None: ...
|
||||
async def initialize(self) -> Self: ...
|
||||
async def close(self) -> None: ...
|
||||
@@ -135,8 +136,13 @@ class NodesManager:
|
||||
nodes_cache: dict[str, ClusterNode]
|
||||
slots_cache: dict[int, list[ClusterNode]]
|
||||
read_load_balancer: LoadBalancer
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None
|
||||
def __init__(
|
||||
self, startup_nodes: list[ClusterNode], require_full_coverage: bool, connection_kwargs: dict[str, Any]
|
||||
self,
|
||||
startup_nodes: list[ClusterNode],
|
||||
require_full_coverage: bool,
|
||||
connection_kwargs: dict[str, Any],
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None = None,
|
||||
) -> None: ...
|
||||
def get_node(self, host: str | None = None, port: int | None = None, node_name: str | None = None) -> ClusterNode | None: ...
|
||||
def set_nodes(self, old: dict[str, ClusterNode], new: dict[str, ClusterNode], remove_old: bool = False) -> None: ...
|
||||
@@ -144,6 +150,7 @@ class NodesManager:
|
||||
def get_nodes_by_server_type(self, server_type: str) -> list[ClusterNode]: ...
|
||||
async def initialize(self) -> None: ...
|
||||
async def close(self, attr: str = "nodes_cache") -> None: ...
|
||||
def remap_host_port(self, host: str, port: int) -> tuple[str, int]: ...
|
||||
|
||||
class ClusterPipeline(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # TODO: AsyncRedisClusterCommands
|
||||
def __init__(self, client: RedisCluster[_StrType]) -> None: ...
|
||||
|
||||
@@ -43,7 +43,8 @@ class BaseParser:
|
||||
EXCEPTION_CLASSES: ExceptionMappingT
|
||||
def __init__(self, socket_read_size: int) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def parse_error(self, response: str) -> ResponseError: ...
|
||||
@classmethod
|
||||
def parse_error(cls, response: str) -> ResponseError: ...
|
||||
def on_disconnect(self) -> None: ...
|
||||
def on_connect(self, connection: Connection): ...
|
||||
async def read_response(self, disable_decoding: bool = False) -> EncodableT | ResponseError | list[EncodableT] | None: ...
|
||||
@@ -60,7 +61,7 @@ class HiredisParser(BaseParser):
|
||||
def on_connect(self, connection: Connection): ...
|
||||
def on_disconnect(self) -> None: ...
|
||||
async def read_from_socket(self) -> Literal[True]: ...
|
||||
async def read_response(self, disable_decoding: bool = False) -> EncodableT | list[EncodableT]: ...
|
||||
async def read_response(self, disable_decoding: bool = False) -> EncodableT | list[EncodableT]: ... # type: ignore[override]
|
||||
|
||||
DefaultParser: type[PythonParser | HiredisParser]
|
||||
|
||||
@@ -134,11 +135,13 @@ class Connection:
|
||||
async def send_packed_command(self, command: bytes | str | Iterable[bytes], check_health: bool = True): ...
|
||||
async def send_command(self, *args, **kwargs) -> None: ...
|
||||
@overload
|
||||
async def read_response(self, *, timeout: float) -> Incomplete | None: ...
|
||||
async def read_response(self, *, timeout: float, disconnect_on_error: bool = True) -> Incomplete | None: ...
|
||||
@overload
|
||||
async def read_response(self, disable_decoding: bool, timeout: float) -> Incomplete | None: ...
|
||||
async def read_response(
|
||||
self, disable_decoding: bool, timeout: float, *, disconnect_on_error: bool = True
|
||||
) -> Incomplete | None: ...
|
||||
@overload
|
||||
async def read_response(self, disable_decoding: bool = False, timeout: None = None): ...
|
||||
async def read_response(self, disable_decoding: bool = False, timeout: None = None, *, disconnect_on_error: bool = True): ...
|
||||
def pack_command(self, *args: EncodableT) -> list[bytes]: ...
|
||||
def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> list[bytes]: ...
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class SentinelManagedConnection(Connection):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
async def connect_to(self, address) -> None: ...
|
||||
async def connect(self): ...
|
||||
@overload
|
||||
@overload # type: ignore[override]
|
||||
async def read_response(self, *, timeout: float) -> Incomplete | None: ...
|
||||
@overload
|
||||
async def read_response(self, disable_decoding: bool, timeout: float) -> Incomplete | None: ...
|
||||
|
||||
@@ -702,7 +702,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def zrevrangebylex( # type: ignore[override]
|
||||
self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None
|
||||
) -> Pipeline[_StrType]: ...
|
||||
def zrevrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zscore(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def pfadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
|
||||
@@ -18,6 +18,7 @@ def get_connection(redis_node: Redis[Any], *args, **options: _ConnectionPoolOpti
|
||||
def parse_scan_result(command: Unused, res, **options): ...
|
||||
def parse_pubsub_numsub(command: Unused, res, **options: Unused): ...
|
||||
def parse_cluster_slots(resp, **options) -> dict[tuple[int, int], dict[str, Any]]: ...
|
||||
def parse_cluster_myshardid(resp: bytes, **options: Unused) -> str: ...
|
||||
|
||||
PRIMARY: str
|
||||
REPLICA: str
|
||||
@@ -69,6 +70,7 @@ class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType], Generic
|
||||
read_from_replicas: bool = False,
|
||||
dynamic_startup_nodes: bool = True,
|
||||
url: str | None = None,
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None = None,
|
||||
**kwargs,
|
||||
) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
@@ -141,6 +143,7 @@ class NodesManager:
|
||||
connection_pool_class: type[ConnectionPool]
|
||||
connection_kwargs: dict[str, Incomplete] # TODO: could be a TypedDict
|
||||
read_load_balancer: LoadBalancer
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None
|
||||
def __init__(
|
||||
self,
|
||||
startup_nodes: Iterable[ClusterNode],
|
||||
@@ -149,6 +152,7 @@ class NodesManager:
|
||||
lock: Lock | None = None,
|
||||
dynamic_startup_nodes: bool = True,
|
||||
connection_pool_class: type[ConnectionPool] = ...,
|
||||
address_remap: Callable[[str, int], tuple[str, int]] | None = None,
|
||||
**kwargs, # TODO: same type as connection_kwargs
|
||||
) -> None: ...
|
||||
def get_node(
|
||||
@@ -164,6 +168,7 @@ class NodesManager:
|
||||
def initialize(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def remap_host_port(self, host: str, port: int) -> tuple[str, int]: ...
|
||||
|
||||
class ClusterPubSub(PubSub):
|
||||
node: ClusterNode | None
|
||||
|
||||
@@ -56,6 +56,7 @@ class RedisClusterCommands(
|
||||
def cluster_setslot_stable(self, slot_id): ...
|
||||
def cluster_replicas(self, node_id, target_nodes: Incomplete | None = None): ...
|
||||
def cluster_slots(self, target_nodes: Incomplete | None = None): ...
|
||||
def cluster_myshardid(self, target_nodes: Incomplete | None = None): ...
|
||||
read_from_replicas: bool
|
||||
def readonly(self, target_nodes: Incomplete | None = None): ...
|
||||
def readwrite(self, target_nodes: Incomplete | None = None): ...
|
||||
|
||||
@@ -133,6 +133,8 @@ class ManagementCommands:
|
||||
def client_unblock(self, client_id, error: bool = False, **kwargs: _CommandOptions): ...
|
||||
def client_pause(self, timeout, all: bool = True, **kwargs: _CommandOptions): ...
|
||||
def client_unpause(self, **kwargs: _CommandOptions): ...
|
||||
def client_no_evict(self, mode: str): ...
|
||||
def client_no_touch(self, mode: str): ...
|
||||
def command(self, **kwargs: _CommandOptions): ...
|
||||
def command_info(self, **kwargs: _CommandOptions): ...
|
||||
def command_count(self, **kwargs: _CommandOptions): ...
|
||||
@@ -1181,7 +1183,7 @@ class SortedSetCommands(Generic[_StrType]):
|
||||
def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ...
|
||||
def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
def zrevrank(self, name: _Key, value: _Value) -> int | None: ...
|
||||
def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ...
|
||||
def zscore(self, name: _Key, value: _Value) -> float | None: ...
|
||||
def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ...
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> int: ...
|
||||
@@ -1384,7 +1386,7 @@ class AsyncSortedSetCommands(Generic[_StrType]):
|
||||
async def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ...
|
||||
async def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zrevrank(self, name: _Key, value: _Value) -> int | None: ...
|
||||
async def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ...
|
||||
async def zscore(self, name: _Key, value: _Value) -> float | None: ...
|
||||
async def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ...
|
||||
async def zunionstore(
|
||||
|
||||
@@ -31,7 +31,8 @@ _ConnectFunc: TypeAlias = Callable[[Connection], object]
|
||||
|
||||
class BaseParser:
|
||||
EXCEPTION_CLASSES: ClassVar[dict[str, type[Exception] | dict[str, type[Exception]]]]
|
||||
def parse_error(self, response: str) -> Exception: ...
|
||||
@classmethod
|
||||
def parse_error(cls, response: str) -> Exception: ...
|
||||
|
||||
class SocketBuffer:
|
||||
socket_read_size: int
|
||||
@@ -127,7 +128,9 @@ class AbstractConnection:
|
||||
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 = 0) -> bool: ...
|
||||
def read_response(self, disable_decoding: bool = False) -> Any: ... # `str | bytes` or `list[str | bytes]`
|
||||
def read_response(
|
||||
self, disable_decoding: bool = False, *, disconnect_on_error: bool = True
|
||||
) -> Any: ... # `str | bytes` or `list[str | bytes]`
|
||||
def pack_command(self, *args) -> list[bytes]: ...
|
||||
def pack_commands(self, commands: Iterable[Iterable[Incomplete]]) -> list[bytes]: ...
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class SentinelManagedConnection(Connection):
|
||||
def connect_to(self, address: _AddressAndPort) -> None: ...
|
||||
def connect(self) -> None: ...
|
||||
# The result can be either `str | bytes` or `list[str | bytes]`
|
||||
def read_response(self, disable_decoding: bool = False) -> Any: ...
|
||||
def read_response(self, disable_decoding: bool = False) -> Any: ... # type: ignore[override]
|
||||
|
||||
class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user