Add a few Redis types (#3016)

* StrictRedis is an alias for Redis in current redis

* Add a few types

* Add missing import

* Add missing argument and types
This commit is contained in:
Sebastian Rittau
2019-06-12 18:18:48 +02:00
committed by Jelle Zijlstra
parent 5327484176
commit b9101e9c5e

View File

@@ -1,4 +1,7 @@
from typing import Any
from datetime import timedelta
from typing import Any, Text, Optional, Mapping, Union
from .connection import ConnectionPool
SYM_EMPTY: Any
@@ -31,16 +34,37 @@ def parse_hscan(response, **options): ...
def parse_zscan(response, **options): ...
def parse_slowlog_get(response, **options): ...
class StrictRedis:
class Redis(object):
RESPONSE_CALLBACKS: Any
@classmethod
def from_url(cls, url, db=..., **kwargs): ...
connection_pool: Any
response_callbacks: Any
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=...,
socket_keepalive=..., socket_keepalive_options=..., connection_pool=..., unix_socket_path=..., encoding=...,
encoding_errors=..., charset=..., errors=..., decode_responses=..., retry_on_timeout=..., ssl=...,
ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=...) -> None: ...
def __init__(
self,
host: Text = ...,
port: int = ...,
db: int = ...,
password: Optional[Text] = ...,
socket_timeout: Optional[float] = ...,
socket_connect_timeout: Optional[float] = ...,
socket_keepalive: Optional[bool] = ...,
socket_keepalive_options: Optional[Mapping[str, Union[int, str]]] = ...,
connection_pool: Optional[ConnectionPool] = ...,
unix_socket_path: Optional[Text] = ...,
encoding: Text = ...,
encoding_errors: Text = ...,
charset: Optional[Text] = ...,
errors: Optional[Text] = ...,
decode_responses: bool = ...,
retry_on_timeout: bool = ...,
ssl: bool = ...,
ssl_keyfile: Optional[Text] = ...,
ssl_certfile: Optional[Text] = ...,
ssl_cert_reqs: Optional[Union[str, int]] = ...,
ssl_ca_certs: Optional[Text] = ...,
max_connections: Optional[int] = ...,
) -> None: ...
def set_response_callback(self, command, callback): ...
def pipeline(self, transaction=..., shard_hint=...): ...
def transaction(self, func, *watches, **kwargs): ...
@@ -93,9 +117,9 @@ class StrictRedis:
def dump(self, name): ...
def exists(self, name): ...
__contains__: Any
def expire(self, name, time): ...
def expire(self, name: Text, time: Union[int, timedelta]) -> bool: ...
def expireat(self, name, when): ...
def get(self, name): ...
def get(self, name: Text) -> Optional[bytes]: ...
def __getitem__(self, name): ...
def getbit(self, name, offset): ...
def getrange(self, key, start, end): ...
@@ -117,7 +141,15 @@ class StrictRedis:
def rename(self, src, dst): ...
def renamenx(self, src, dst): ...
def restore(self, name, ttl, value): ...
def set(self, name, value, ex=..., px=..., nx=..., xx=...): ...
def set(
self,
name: Text,
value: Any,
ex: Union[None, int, timedelta] = ...,
px: Union[None, int, timedelta] = ...,
nx: bool = ...,
xx: bool = ...,
) -> Optional[bool]: ...
def __setitem__(self, name, value): ...
def setbit(self, name, offset, value): ...
def setex(self, name, time, value): ...
@@ -169,7 +201,7 @@ class StrictRedis:
def srem(self, name, *values): ...
def sunion(self, keys, *args): ...
def sunionstore(self, dest, keys, *args): ...
def zadd(self, name, *args, **kwargs): ...
def zadd(self, name, mapping, nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ...): ...
def zcard(self, name): ...
def zcount(self, name, min, max): ...
def zincrby(self, name, value, amount=...): ...
@@ -213,12 +245,7 @@ class StrictRedis:
def script_load(self, script): ...
def register_script(self, script): ...
class Redis(StrictRedis):
RESPONSE_CALLBACKS: Any
def pipeline(self, transaction=..., shard_hint=...): ...
def setex(self, name, value, time): ...
def lrem(self, name, value, num=...): ...
def zadd(self, name, *args, **kwargs): ...
StrictRedis = Redis
class PubSub:
PUBLISH_MESSAGE_TYPES: Any