diff --git a/third_party/2and3/redis/client.pyi b/third_party/2and3/redis/client.pyi index 06e7ac27b..0e6504410 100644 --- a/third_party/2and3/redis/client.pyi +++ b/third_party/2and3/redis/client.pyi @@ -35,6 +35,7 @@ def parse_zscan(response, **options): ... def parse_slowlog_get(response, **options): ... _Str = Union[bytes, float, int, Text] +_Key = Union[Text, bytes] class Redis(object): RESPONSE_CALLBACKS: Any @@ -121,9 +122,9 @@ class Redis(object): def dump(self, name): ... def exists(self, *names: Text) -> int: ... __contains__: Any - def expire(self, name: Union[Text, bytes], time: Union[int, timedelta]) -> bool: ... + def expire(self, name: _Key, time: Union[int, timedelta]) -> bool: ... def expireat(self, name, when): ... - def get(self, name: Union[Text, bytes]) -> Any: ... # Optional[Union[str, bytes]] depending on decode_responses + def get(self, name: _Key) -> Any: ... # Optional[Union[str, bytes]] depending on decode_responses def __getitem__(self, name): ... def getbit(self, name, offset): ... def getrange(self, key, start, end): ... @@ -147,7 +148,7 @@ class Redis(object): def restore(self, name, ttl, value): ... def set( self, - name: Union[Text, bytes], + name: _Key, value: _Str, ex: Union[None, int, timedelta] = ..., px: Union[None, int, timedelta] = ..., @@ -183,8 +184,8 @@ class Redis(object): def rpush(self, name: _Str, *values: _Str) -> int: ... def rpushx(self, name, value): ... def sort(self, name, start=..., num=..., by=..., get=..., desc=..., alpha=..., store=..., groups=...): ... - def scan(self, cursor: int = ..., match: Optional[Union[Text, bytes]] = ..., count: Optional[int] = ...) -> Tuple[int, List[Any]]: ... # Tuple[int, List[Union[Text, bytes]]] depending on decode_responses - def scan_iter(self, match: Optional[Text] = ..., count: Optional[int] = ...) -> Iterator[Any]: ... # Iterator[Union[Text, bytes]] depending on decode_responses + def scan(self, cursor: int = ..., match: Optional[_Key] = ..., count: Optional[int] = ...) -> Tuple[int, List[Any]]: ... # Tuple[int, List[_Key]] depending on decode_responses + def scan_iter(self, match: Optional[Text] = ..., count: Optional[int] = ...) -> Iterator[Any]: ... # Iterator[_Key] depending on decode_responses def sscan(self, name, cursor=..., match=..., count=...): ... def sscan_iter(self, name, match=..., count=...): ... def hscan(self, name, cursor=..., match=..., count=...): ... @@ -236,7 +237,9 @@ class Redis(object): def xreadgroup(self, groupname, consumername, streams, count=..., block=..., noack=...): ... def xrevrange(self, name, max=..., min=..., count=...): ... def xtrim(self, name, maxlen, approximate=...): ... - def zadd(self, name, mapping, nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ...): ... + def zadd( + self, name: _Key, mapping: Mapping[_Key, _Str], nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ... + ) -> int: ... def zcard(self, name): ... def zcount(self, name, min, max): ... def zincrby(self, name, value, amount=...): ... @@ -249,7 +252,7 @@ class Redis(object): def zrem(self, name, *values): ... def zremrangebylex(self, name, min, max): ... def zremrangebyrank(self, name, min, max): ... - def zremrangebyscore(self, name, min, max): ... + def zremrangebyscore(self, name: _Key, min: _Str, max: _Str) -> int: ... def zrevrange(self, name, start, end, withscores=..., score_cast_func=...): ... def zrevrangebyscore(self, name, max, min, start=..., num=..., withscores=..., score_cast_func=...): ... def zrevrank(self, name, value): ...