mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-16 21:45:04 +08:00
Use TypeAlias where possible for type aliases (#7630)
This commit is contained in:
@@ -3,15 +3,15 @@ from _typeshed import Self, SupportsItems
|
||||
from datetime import datetime, timedelta
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, ClassVar, Generic, Iterable, Iterator, Mapping, Pattern, Sequence, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .commands import CoreCommands, RedisModuleCommands, SentinelCommands
|
||||
from .connection import ConnectionPool, _ConnectionPoolOptions
|
||||
from .lock import Lock
|
||||
from .retry import Retry
|
||||
|
||||
_Value = bytes | float | int | str
|
||||
_Key = str | bytes
|
||||
_Value: TypeAlias = bytes | float | int | str
|
||||
_Key: TypeAlias = str | bytes
|
||||
|
||||
# Lib returns str or bytes depending on value of decode_responses
|
||||
_StrType = TypeVar("_StrType", bound=str | bytes)
|
||||
@@ -21,9 +21,9 @@ _T = TypeVar("_T")
|
||||
_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn")
|
||||
|
||||
# Keyword arguments that are passed to Redis.parse_response().
|
||||
_ParseResponseOptions = Any
|
||||
_ParseResponseOptions: TypeAlias = Any
|
||||
# Keyword arguments that are passed to Redis.execute_command().
|
||||
_CommandOptions = _ConnectionPoolOptions | _ParseResponseOptions
|
||||
_CommandOptions: TypeAlias = _ConnectionPoolOptions | _ParseResponseOptions
|
||||
|
||||
SYM_EMPTY: bytes
|
||||
EMPTY_RESPONSE: str
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .aggregation import AggregateRequest, AggregateResult, Cursor
|
||||
from .query import Query
|
||||
from .result import Result
|
||||
|
||||
_QueryParams = Mapping[str, str | float]
|
||||
_QueryParams: TypeAlias = Mapping[str, str | float]
|
||||
|
||||
NUMERIC: Literal["NUMERIC"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user