mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Fix some incorrect redis Text annotations (#3969)
I've changed some instances of `Text` to `_Key` so that bytes will be accepted as well. I'm not sure if they should be `_Str` instead. The existing annotations seem to use a mix of the two. _Str is a better reflection of what redis-py will accept (any arguments that it passes through to the redis server can be _Str and it'll convert to bytes); but passing an int or float where a key is expected may be a code smell.
This commit is contained in:
22
third_party/2and3/redis/client.pyi
vendored
22
third_party/2and3/redis/client.pyi
vendored
@@ -92,7 +92,7 @@ class Redis(object):
|
||||
def echo(self, value): ...
|
||||
def flushall(self) -> bool: ...
|
||||
def flushdb(self) -> bool: ...
|
||||
def info(self, section: Optional[Text] = ...) -> Mapping[str, Any]: ...
|
||||
def info(self, section: Optional[_Key] = ...) -> Mapping[str, Any]: ...
|
||||
def lastsave(self): ...
|
||||
def object(self, infotype, key): ...
|
||||
def ping(self) -> bool: ...
|
||||
@@ -117,10 +117,10 @@ class Redis(object):
|
||||
def bitop(self, operation, dest, *keys): ...
|
||||
def bitpos(self, key, bit, start=..., end=...): ...
|
||||
def decr(self, name, amount=...): ...
|
||||
def delete(self, *names: Text): ...
|
||||
def __delitem__(self, name): ...
|
||||
def delete(self, *names: _Key): ...
|
||||
def __delitem__(self, _Key): ...
|
||||
def dump(self, name): ...
|
||||
def exists(self, *names: Text) -> int: ...
|
||||
def exists(self, *names: _Key) -> int: ...
|
||||
__contains__: Any
|
||||
def expire(self, name: _Key, time: Union[int, timedelta]) -> bool: ...
|
||||
def expireat(self, name, when): ...
|
||||
@@ -274,7 +274,7 @@ class Redis(object):
|
||||
def hmset(self, name, mapping): ...
|
||||
def hmget(self, name, keys, *args): ...
|
||||
def hvals(self, name): ...
|
||||
def publish(self, channel: Text, message: _Str) -> int: ...
|
||||
def publish(self, channel: _Key, message: _Key) -> int: ...
|
||||
def eval(self, script, numkeys, *keys_and_args): ...
|
||||
def evalsha(self, sha, numkeys, *keys_and_args): ...
|
||||
def script_exists(self, *args): ...
|
||||
@@ -282,8 +282,8 @@ class Redis(object):
|
||||
def script_kill(self): ...
|
||||
def script_load(self, script): ...
|
||||
def register_script(self, script): ...
|
||||
def pubsub_channels(self, pattern: Text = ...) -> List[Text]: ...
|
||||
def pubsub_numsub(self, *args: Text) -> List[Tuple[Text, int]]: ...
|
||||
def pubsub_channels(self, pattern: _Key = ...) -> List[Text]: ...
|
||||
def pubsub_numsub(self, *args: _Key) -> List[Tuple[Text, int]]: ...
|
||||
def pubsub_numpat(self) -> int: ...
|
||||
def monitor(self) -> Monitor: ...
|
||||
def cluster(self, cluster_arg: str, *args: Any) -> Any: ...
|
||||
@@ -312,10 +312,10 @@ class PubSub:
|
||||
def subscribed(self): ...
|
||||
def execute_command(self, *args, **kwargs): ...
|
||||
def parse_response(self, block=...): ...
|
||||
def psubscribe(self, *args: Text, **kwargs: Callable[[Any], None]): ...
|
||||
def punsubscribe(self, *args: Text) -> None: ...
|
||||
def subscribe(self, *args: Text, **kwargs: Callable[[Any], None]) -> None: ...
|
||||
def unsubscribe(self, *args: Text) -> None: ...
|
||||
def psubscribe(self, *args: _Key, **kwargs: Callable[[Any], None]): ...
|
||||
def punsubscribe(self, *args: _Key) -> None: ...
|
||||
def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ...
|
||||
def unsubscribe(self, *args: _Key) -> None: ...
|
||||
def listen(self): ...
|
||||
def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...) -> Optional[Dict[str, Any]]: ...
|
||||
def handle_message(self, response, ignore_subscribe_messages: bool = ...) -> Optional[Dict[str, Any]]: ...
|
||||
|
||||
Reference in New Issue
Block a user