mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
python: Annotate type aliases with TypeAlias.
This is not strictly necessary but it’s clearer and improves mypy’s error messages. https://docs.python.org/3/library/typing.html#typing.TypeAlias https://mypy.readthedocs.io/en/stable/kinds_of_types.html#type-aliases Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
f55711dae3
commit
c2c96eb0cf
@@ -3,10 +3,11 @@ from typing import Any, Callable, Dict, Iterable, List, Mapping, Sequence, TypeV
|
||||
|
||||
from psycopg2.extensions import connection, cursor
|
||||
from psycopg2.sql import Composable
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
CursorObj = TypeVar("CursorObj", bound=cursor)
|
||||
Query = Union[str, bytes, Composable]
|
||||
Params = Union[Sequence[object], Mapping[str, object], None]
|
||||
Query: TypeAlias = Union[str, bytes, Composable]
|
||||
Params: TypeAlias = Union[Sequence[object], Mapping[str, object], None]
|
||||
ParamsT = TypeVar("ParamsT")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user