Fixes inaccuracies in redis scan methods (#3870)

The scan() and scan_iter() methods for redis Client objects had
incorrect stubs, this has been fixed.

Tested on pyredis 3.3.8; the output of those functions does depend on
the `decode_responses` configuration, so Any was used instead of a Union
return type.
This commit is contained in:
coiax
2020-03-20 11:15:51 +00:00
committed by GitHub
parent 24691fa03a
commit cd1b56662c

View File

@@ -1,5 +1,5 @@
from datetime import timedelta
from typing import Any, Iterable, Text, Optional, Mapping, Tuple, Union, Callable, List, Dict
from typing import Any, Iterable, Iterator, Text, Optional, Mapping, Tuple, Union, Callable, List, Dict
from .connection import ConnectionPool
@@ -183,8 +183,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[Text] = ..., count: Optional[int] = ...) -> List[Text]: ...
def scan_iter(self, match: Optional[Text] = ..., count: Optional[int] = ...) -> List[Text]: ...
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 sscan(self, name, cursor=..., match=..., count=...): ...
def sscan_iter(self, name, match=..., count=...): ...
def hscan(self, name, cursor=..., match=..., count=...): ...