diff --git a/stubs/redis/@tests/stubtest_allowlist.txt b/stubs/redis/@tests/stubtest_allowlist.txt index 7151eb3c2..f19fdc2a3 100644 --- a/stubs/redis/@tests/stubtest_allowlist.txt +++ b/stubs/redis/@tests/stubtest_allowlist.txt @@ -1,3 +1,6 @@ +redis.Sentinel.master_for +redis.Sentinel.slave_for +redis.sentinel.Sentinel.master_for +redis.sentinel.Sentinel.slave_for redis.client.Pipeline.transaction # instance attribute has same name as superclass method -redis.commands.search.commands.SearchCommands.explain # https://github.com/redis/redis-py/pull/1997 redis.ocsp # requires cryptography to be installed diff --git a/stubs/redis/METADATA.toml b/stubs/redis/METADATA.toml index bb8cc449b..cb7498d03 100644 --- a/stubs/redis/METADATA.toml +++ b/stubs/redis/METADATA.toml @@ -1 +1 @@ -version = "4.1.*" +version = "4.2.*" diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index 95db74b5f..a609b782d 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -167,6 +167,7 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener ssl_cert_reqs: str | int | None = ..., ssl_ca_certs: str | None = ..., ssl_ca_path: Any | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., ssl_password: Any | None = ..., ssl_validate_ocsp: bool = ..., @@ -206,6 +207,7 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., ssl_ca_certs: str | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., ssl_password: Any | None = ..., ssl_validate_ocsp: bool = ..., @@ -244,6 +246,7 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener ssl_certfile: str | None = ..., ssl_cert_reqs: str | int | None = ..., ssl_ca_certs: str | None = ..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., ssl_password: Any | None = ..., ssl_validate_ocsp: bool = ..., @@ -451,17 +454,17 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def slowlog_reset(self) -> Pipeline[_StrType]: ... # type: ignore[override] def time(self) -> Pipeline[_StrType]: ... # type: ignore[override] def append(self, key, value) -> Pipeline[_StrType]: ... # type: ignore[override] - def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def bitop(self, operation, dest, *keys) -> Pipeline[_StrType]: ... # type: ignore[override] - def bitpos(self, key, bit, start=..., end=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def bitpos(self, key, bit, start=..., end=..., mode: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def decr(self, name, amount=...) -> Pipeline[_StrType]: ... # type: ignore[override] def delete(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def __delitem__(self, _Key) -> None: ... def dump(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] def exists(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def __contains__(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def expire(self, name: _Key, time: int | timedelta) -> Pipeline[_StrType]: ... # type: ignore[override] - def expireat(self, name, when) -> Pipeline[_StrType]: ... # type: ignore[override] + def expire(self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def get(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def __getitem__(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] def getbit(self, name: _Key, offset: int) -> Pipeline[_StrType]: ... # type: ignore[override] @@ -476,8 +479,8 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def msetnx(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] def move(self, name: _Key, db: int) -> Pipeline[_StrType]: ... # type: ignore[override] def persist(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def pexpire(self, name: _Key, time: int | timedelta) -> Pipeline[_StrType]: ... # type: ignore[override] - def pexpireat(self, name: _Key, when: int | datetime) -> Pipeline[_StrType]: ... # type: ignore[override] + def pexpire(self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def pexpireat(self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def psetex(self, name, time_ms, value) -> Pipeline[_StrType]: ... # type: ignore[override] def pttl(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] def randomkey(self) -> Pipeline[_StrType]: ... # type: ignore[override] @@ -588,12 +591,12 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def xinfo_stream(self, name, full: bool = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def xlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def xpending(self, name, groupname) -> Pipeline[_StrType]: ... # type: ignore[override] - def xpending_range(self, name, groupname, idle: Any | None = ..., min: int | None = ..., max: int | None = ..., count: int | None = ..., consumername=...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xpending_range(self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def xrange(self, name, min=..., max=..., count=...) -> Pipeline[_StrType]: ... # type: ignore[override] def xread(self, streams, count=..., block=...) -> Pipeline[_StrType]: ... # type: ignore[override] def xreadgroup(self, groupname, consumername, streams, count=..., block=..., noack=...) -> Pipeline[_StrType]: ... # type: ignore[override] def xrevrange(self, name, max=..., min=..., count=...) -> Pipeline[_StrType]: ... # type: ignore[override] - def xtrim(self, name, maxlen: int | None = ..., approximate: bool = ..., minid: Any | None = ..., limit: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] + def xtrim(self, name, maxlen: int, approximate: bool = ..., minid: Any | None = ..., limit: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override] def zadd( # type: ignore[override] self, name: _Key, @@ -674,11 +677,15 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def hkeys(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] def hlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] @overload # type: ignore[override] - def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> Pipeline[_StrType]: ... + def hset( + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ... + ) -> Pipeline[_StrType]: ... @overload # type: ignore[override] - def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... + def hset( + self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ... + ) -> Pipeline[_StrType]: ... @overload # type: ignore[override] - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... + def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> Pipeline[_StrType]: ... def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] diff --git a/stubs/redis/redis/cluster.pyi b/stubs/redis/redis/cluster.pyi index fe6b8c45a..f9ac8bf6a 100644 --- a/stubs/redis/redis/cluster.pyi +++ b/stubs/redis/redis/cluster.pyi @@ -155,6 +155,7 @@ class ClusterPipeline(RedisCluster[_StrType], Generic[_StrType]): def __init__( self, nodes_manager, + commands_parser, result_callbacks: Any | None = ..., cluster_response_callbacks: Any | None = ..., startup_nodes: Any | None = ..., diff --git a/stubs/redis/redis/commands/bf/__init__.pyi b/stubs/redis/redis/commands/bf/__init__.pyi index ba1eb8dd8..d5ef70ee3 100644 --- a/stubs/redis/redis/commands/bf/__init__.pyi +++ b/stubs/redis/redis/commands/bf/__init__.pyi @@ -5,27 +5,27 @@ from .info import BFInfo as BFInfo, CFInfo as CFInfo, CMSInfo as CMSInfo, TDiges class AbstractBloom: @staticmethod - def appendItems(params, items) -> None: ... + def append_items(params, items) -> None: ... @staticmethod - def appendError(params, error) -> None: ... + def append_error(params, error) -> None: ... @staticmethod - def appendCapacity(params, capacity) -> None: ... + def append_capacity(params, capacity) -> None: ... @staticmethod - def appendExpansion(params, expansion) -> None: ... + def append_expansion(params, expansion) -> None: ... @staticmethod - def appendNoScale(params, noScale) -> None: ... + def append_no_scale(params, noScale) -> None: ... @staticmethod - def appendWeights(params, weights) -> None: ... + def append_weights(params, weights) -> None: ... @staticmethod - def appendNoCreate(params, noCreate) -> None: ... + def append_no_create(params, noCreate) -> None: ... @staticmethod - def appendItemsAndIncrements(params, items, increments) -> None: ... + def append_items_and_increments(params, items, increments) -> None: ... @staticmethod - def appendValuesAndWeights(params, items, weights) -> None: ... + def append_values_and_weights(params, items, weights) -> None: ... @staticmethod - def appendMaxIterations(params, max_iterations) -> None: ... + def append_max_iterations(params, max_iterations) -> None: ... @staticmethod - def appendBucketSize(params, bucket_size) -> None: ... + def append_bucket_size(params, bucket_size) -> None: ... class CMSBloom(CMSCommands, AbstractBloom): client: Any diff --git a/stubs/redis/redis/commands/core.pyi b/stubs/redis/redis/commands/core.pyi index 24e8cfb0a..6fac586c8 100644 --- a/stubs/redis/redis/commands/core.pyi +++ b/stubs/redis/redis/commands/core.pyi @@ -137,10 +137,10 @@ class ManagementCommands: class BasicKeyCommands(Generic[_StrType]): def append(self, key, value): ... - def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ...) -> int: ... + def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> int: ... def bitfield(self, key, default_overflow: Any | None = ...): ... def bitop(self, operation, dest, *keys): ... - def bitpos(self, key, bit, start=..., end=...): ... + def bitpos(self, key: _Key, bit: int, start: int | None = ..., end: int | None = ..., mode: str | None = ...): ... def copy(self, source, destination, destination_db: Any | None = ..., replace: bool = ...): ... def decr(self, name, amount: int = ...) -> int: ... def decrby(self, name, amount: int = ...) -> int: ... @@ -149,8 +149,10 @@ class BasicKeyCommands(Generic[_StrType]): def dump(self, name: _Key) -> _StrType | None: ... def exists(self, *names: _Key) -> int: ... __contains__ = exists - def expire(self, name: _Key, time: int | timedelta) -> bool: ... - def expireat(self, name, when): ... + def expire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> bool: ... + def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...): ... def get(self, name: _Key) -> _StrType | None: ... def getdel(self, name: _Key) -> _StrType | None: ... def getex( @@ -186,8 +188,12 @@ class BasicKeyCommands(Generic[_StrType]): def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... def move(self, name: _Key, db: int) -> bool: ... def persist(self, name: _Key) -> bool: ... - def pexpire(self, name: _Key, time: int | timedelta) -> Literal[1, 0]: ... - def pexpireat(self, name: _Key, when: int | datetime) -> Literal[1, 0]: ... + def pexpire( + self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... + def pexpireat( + self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ... + ) -> Literal[1, 0]: ... def psetex(self, name, time_ms, value): ... def pttl(self, name: _Key) -> int: ... def hrandfield(self, key, count: Any | None = ..., withvalues: bool = ...): ... @@ -396,14 +402,7 @@ class StreamCommands: def xlen(self, name: _Key) -> int: ... def xpending(self, name, groupname): ... def xpending_range( - self, - name, - groupname, - idle: Any | None = ..., - min: Any | None = ..., - max: Any | None = ..., - count: int | None = ..., - consumername: Any | None = ..., + self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ... ): ... def xrange(self, name, min: str = ..., max: str = ..., count: Any | None = ...): ... def xread(self, streams, count: Any | None = ..., block: Any | None = ...): ... @@ -411,9 +410,7 @@ class StreamCommands: self, groupname, consumername, streams, count: Any | None = ..., block: Any | None = ..., noack: bool = ... ): ... def xrevrange(self, name, max: str = ..., min: str = ..., count: Any | None = ...): ... - def xtrim( - self, name, maxlen: Any | None = ..., approximate: bool = ..., minid: Any | None = ..., limit: Any | None = ... - ): ... + def xtrim(self, name, maxlen: int, approximate: bool = ..., minid: Any | None = ..., limit: Any | None = ...): ... class SortedSetCommands(Generic[_StrType]): def zadd( @@ -592,11 +589,13 @@ class HashCommands(Generic[_StrType]): def hkeys(self, name: _Key) -> list[_StrType]: ... def hlen(self, name: _Key) -> int: ... @overload - def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> int: ... + def hset( + self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ... + ) -> int: ... @overload - def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value]) -> int: ... + def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... @overload - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> int: ... + def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ... def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... diff --git a/stubs/redis/redis/commands/graph/__init__.pyi b/stubs/redis/redis/commands/graph/__init__.pyi index 2f4915e3b..2586aedbc 100644 --- a/stubs/redis/redis/commands/graph/__init__.pyi +++ b/stubs/redis/redis/commands/graph/__init__.pyi @@ -22,5 +22,5 @@ class Graph(GraphCommands): def add_edge(self, edge) -> None: ... def call_procedure(self, procedure, *args, read_only: bool = ..., **kwagrs): ... def labels(self): ... - def relationshipTypes(self): ... - def propertyKeys(self): ... + def relationship_types(self): ... + def property_keys(self): ... diff --git a/stubs/redis/redis/commands/graph/edge.pyi b/stubs/redis/redis/commands/graph/edge.pyi index 22543f522..643175d75 100644 --- a/stubs/redis/redis/commands/graph/edge.pyi +++ b/stubs/redis/redis/commands/graph/edge.pyi @@ -7,5 +7,5 @@ class Edge: src_node: Any dest_node: Any def __init__(self, src_node, relation, dest_node, edge_id: Any | None = ..., properties: Any | None = ...) -> None: ... - def toString(self): ... + def to_string(self): ... def __eq__(self, rhs): ... diff --git a/stubs/redis/redis/commands/graph/node.pyi b/stubs/redis/redis/commands/graph/node.pyi index 0b14fbae6..8c5ec73ac 100644 --- a/stubs/redis/redis/commands/graph/node.pyi +++ b/stubs/redis/redis/commands/graph/node.pyi @@ -13,5 +13,5 @@ class Node: label: str | list[str] | None = ..., properties: Any | None = ..., ) -> None: ... - def toString(self): ... + def to_string(self): ... def __eq__(self, rhs): ... diff --git a/stubs/redis/redis/commands/helpers.pyi b/stubs/redis/redis/commands/helpers.pyi index d359ff0f8..ec1bb28b2 100644 --- a/stubs/redis/redis/commands/helpers.pyi +++ b/stubs/redis/redis/commands/helpers.pyi @@ -6,5 +6,5 @@ def parse_list_to_dict(response): ... def parse_to_dict(response): ... def random_string(length: int = ...) -> str: ... def quote_string(v): ... -def decodeDictKeys(obj): ... +def decode_dict_keys(obj): ... def stringify_param_value(value): ... diff --git a/stubs/redis/redis/commands/json/path.pyi b/stubs/redis/redis/commands/json/path.pyi index d33df3045..bbc35c4f4 100644 --- a/stubs/redis/redis/commands/json/path.pyi +++ b/stubs/redis/redis/commands/json/path.pyi @@ -1,5 +1,5 @@ class Path: strPath: str @staticmethod - def rootPath() -> str: ... + def root_path() -> str: ... def __init__(self, path: str) -> None: ... diff --git a/stubs/redis/redis/connection.pyi b/stubs/redis/redis/connection.pyi index 4be5a53ee..8c4865c26 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -136,6 +136,7 @@ class SSLConnection(Connection): ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=..., + ssl_ca_data: Any | None = ..., ssl_check_hostname: bool = ..., ssl_ca_path: Any | None = ..., ssl_password: Any | None = ..., diff --git a/stubs/redis/redis/sentinel.pyi b/stubs/redis/redis/sentinel.pyi index 702a796c2..0021b7e7a 100644 --- a/stubs/redis/redis/sentinel.pyi +++ b/stubs/redis/redis/sentinel.pyi @@ -6,7 +6,7 @@ from redis.commands.sentinel import SentinelCommands from redis.connection import Connection, ConnectionPool, SSLConnection from redis.exceptions import ConnectionError -_Redis = TypeVar("_Redis", bound=Redis[Any]) +_RedisT = TypeVar("_RedisT", bound=Redis[Any]) class MasterNotFoundError(ConnectionError): ... class SlaveNotFoundError(ConnectionError): ... @@ -47,9 +47,9 @@ class Sentinel(SentinelCommands): @overload def master_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... @overload - def master_for(self, service_name: str, redis_class: type[_Redis] = ..., connection_pool_class=..., **kwargs) -> _Redis: ... + def master_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... @overload - def slave_for(self, service_name: str, connection_pool_class=..., **kwargs) -> Redis[Any]: ... + def slave_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... @overload - def slave_for(self, service_name: str, redis_class: type[_Redis] = ..., connection_pool_class=..., **kwargs) -> _Redis: ... + def slave_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... def execute_command(self, *args, **kwargs) -> Literal[True]: ...