Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Mapping, Optional, Text, Tuple, Type, Union
from typing import Any, List, Mapping, Text, Tuple, Type
ssl_available: Any
hiredis_version: Any
@@ -53,8 +53,8 @@ DefaultParser: Any
class Encoder:
def __init__(self, encoding, encoding_errors, decode_responses: bool) -> None: ...
def encode(self, value: Union[Text, bytes, memoryview, bool, float]) -> bytes: ...
def decode(self, value: Union[Text, bytes, memoryview], force: bool = ...) -> Text: ...
def encode(self, value: Text | bytes | memoryview | bool | float) -> bytes: ...
def decode(self, value: Text | bytes | memoryview, force: bool = ...) -> Text: ...
class Connection:
description_format: Any
@@ -76,11 +76,11 @@ class Connection:
host: Text = ...,
port: int = ...,
db: int = ...,
password: Optional[Text] = ...,
socket_timeout: Optional[float] = ...,
socket_connect_timeout: Optional[float] = ...,
password: Text | None = ...,
socket_timeout: float | None = ...,
socket_connect_timeout: float | None = ...,
socket_keepalive: bool = ...,
socket_keepalive_options: Optional[Mapping[str, Union[int, str]]] = ...,
socket_keepalive_options: Mapping[str, int | str] | None = ...,
socket_type: int = ...,
retry_on_timeout: bool = ...,
encoding: Text = ...,
@@ -89,8 +89,8 @@ class Connection:
parser_class: Type[BaseParser] = ...,
socket_read_size: int = ...,
health_check_interval: int = ...,
client_name: Optional[Text] = ...,
username: Optional[Text] = ...,
client_name: Text | None = ...,
username: Text | None = ...,
) -> None: ...
def __del__(self): ...
def register_connect_callback(self, callback): ...
@@ -150,7 +150,7 @@ def to_bool(value: object) -> bool: ...
class ConnectionPool:
@classmethod
def from_url(cls, url: Text, db: Optional[int] = ..., decode_components: bool = ..., **kwargs) -> ConnectionPool: ...
def from_url(cls, url: Text, db: int | None = ..., decode_components: bool = ..., **kwargs) -> ConnectionPool: ...
connection_class: Any
connection_kwargs: Any
max_connections: Any

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Any, Optional, Text, Type, Union
from typing import Any, Text, Type, Union
from redis.client import Redis
@@ -10,26 +10,26 @@ class Lock:
self,
redis: Redis[Any],
name: str,
timeout: Union[None, int, float] = ...,
timeout: None | int | float = ...,
sleep: float = ...,
blocking: bool = ...,
blocking_timeout: Optional[bool] = ...,
blocking_timeout: bool | None = ...,
thread_local: bool = ...,
) -> None: ...
def register_scripts(self) -> None: ...
def __enter__(self) -> Lock: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> bool | None: ...
def acquire(
self, blocking: Optional[bool] = ..., blocking_timeout: Union[None, int, float] = ..., token: Optional[_TokenValue] = ...
self, blocking: bool | None = ..., blocking_timeout: None | int | float = ..., token: _TokenValue | None = ...
) -> bool: ...
def do_acquire(self, token: _TokenValue) -> bool: ...
def locked(self) -> bool: ...
def owned(self) -> bool: ...
def release(self) -> None: ...
def do_release(self, expected_token: _TokenValue) -> None: ...
def extend(self, additional_time: Union[int, float], replace_ttl: bool = ...) -> bool: ...
def do_extend(self, additional_time: Union[int, float], replace_ttl: bool) -> bool: ...
def extend(self, additional_time: int | float, replace_ttl: bool = ...) -> bool: ...
def do_extend(self, additional_time: int | float, replace_ttl: bool) -> bool: ...
def reacquire(self) -> bool: ...
def do_reacquire(self) -> bool: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, ContextManager, Optional, Text, TypeVar, overload
from typing import Any, ContextManager, Text, TypeVar, overload
from typing_extensions import Literal
from .client import Pipeline, Redis, _StrType
@@ -8,9 +8,9 @@ _T = TypeVar("_T")
HIREDIS_AVAILABLE: bool
@overload
def from_url(url: Text, db: Optional[int] = ..., *, decode_responses: Literal[True], **kwargs: Any) -> Redis[str]: ...
def from_url(url: Text, db: int | None = ..., *, decode_responses: Literal[True], **kwargs: Any) -> Redis[str]: ...
@overload
def from_url(url: Text, db: Optional[int] = ..., *, decode_responses: Literal[False] = ..., **kwargs: Any) -> Redis[bytes]: ...
def from_url(url: Text, db: int | None = ..., *, decode_responses: Literal[False] = ..., **kwargs: Any) -> Redis[bytes]: ...
@overload
def str_if_bytes(value: bytes) -> str: ... # type: ignore
@overload