Use PEP 604 syntax wherever possible (#7493)

This commit is contained in:
Alex Waygood
2022-03-16 15:01:33 +00:00
committed by GitHub
parent 15e21a8dc1
commit 3ab250eec8
174 changed files with 472 additions and 490 deletions

View File

@@ -1,7 +1,7 @@
import threading
from _typeshed import Self, SupportsItems
from datetime import datetime, timedelta
from typing import Any, Callable, ClassVar, Generic, Iterable, Iterator, Mapping, Pattern, Sequence, TypeVar, Union, overload
from typing import Any, Callable, ClassVar, Generic, Iterable, Iterator, Mapping, Pattern, Sequence, TypeVar, overload
from typing_extensions import Literal
from .commands import CoreCommands, RedisModuleCommands, SentinelCommands
@@ -9,11 +9,11 @@ from .connection import ConnectionPool, _ConnectionPoolOptions
from .lock import Lock
from .retry import Retry
_Value = Union[bytes, float, int, str]
_Key = Union[str, bytes]
_Value = bytes | float | int | str
_Key = str | bytes
# Lib returns str or bytes depending on value of decode_responses
_StrType = TypeVar("_StrType", bound=Union[str, bytes])
_StrType = TypeVar("_StrType", bound=str | bytes)
_VT = TypeVar("_VT")
_T = TypeVar("_T")

View File

@@ -1,13 +1,13 @@
import builtins
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from datetime import datetime, timedelta
from typing import Any, Generic, TypeVar, Union, overload
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Literal
from ..client import _CommandOptions, _Key, _Value
_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn")
_StrType = TypeVar("_StrType", bound=Union[str, bytes])
_StrType = TypeVar("_StrType", bound=str | bytes)
class ACLCommands(Generic[_StrType]):
def acl_cat(self, category: str | None = ..., **kwargs: _CommandOptions) -> list[str]: ...