Remove or move several TypeAlias declarations (#8444)

This commit is contained in:
Alex Waygood
2022-07-30 15:28:52 +01:00
committed by GitHub
parent 275fc28733
commit fdeb216547
15 changed files with 46 additions and 55 deletions
@@ -7,7 +7,6 @@ _Expression: TypeAlias = Any # mypy.nodes.Expression
_RefExpr: TypeAlias = Any # mypy.nodes.RefExpr
_TypeInfo: TypeAlias = Any # mypy.nodes.TypeInfo
_Var: TypeAlias = Any # mypy.nodes.Var
_StrExpr: TypeAlias = Any # mypy.nodes.StrExpr
_SemanticAnalyzerPluginInterface: TypeAlias = Any # mypy.plugin.SemanticAnalyzerPluginInterface
_ProperType: TypeAlias = Any # mypy.types.ProperType
@@ -1,11 +1,8 @@
from typing import Any
from typing_extensions import Literal, TypeAlias
from ..sql.base import CompileState, Options
from ..sql.dml import DeleteDMLState, UpdateDMLState
_SynchronizeSessionArgument: TypeAlias = Literal[False, "evaluate", "fetch"]
def save_obj(base_mapper, states, uowtransaction, single: bool = ...) -> None: ...
def post_update(base_mapper, states, uowtransaction, post_update_cols) -> None: ...
def delete_obj(base_mapper, states, uowtransaction) -> None: ...
+2 -1
View File
@@ -1,18 +1,19 @@
from _typeshed import Self
from collections.abc import Iterator
from typing import Any, Generic, TypeVar
from typing_extensions import Literal, TypeAlias
from ..sql.annotation import SupportsCloneAnnotations
from ..sql.base import Executable
from ..sql.selectable import GroupedElement, HasHints, HasPrefixes, HasSuffixes, SelectBase, _SelectFromElements
from . import interfaces
from .context import QueryContext as QueryContext
from .persistence import _SynchronizeSessionArgument
from .util import aliased as aliased
__all__ = ["Query", "QueryContext", "aliased"]
_T = TypeVar("_T")
_SynchronizeSessionArgument: TypeAlias = Literal[False, "evaluate", "fetch"]
class Query(_SelectFromElements, SupportsCloneAnnotations, HasPrefixes, HasSuffixes, HasHints, Executable, Generic[_T]):
logger: Any
+18 -1
View File
@@ -3,6 +3,7 @@ from _typeshed import Self
from collections.abc import Callable, Iterable, Iterator
from contextlib import AbstractContextManager
from typing import Any
from typing_extensions import Literal, TypeAlias
from ._common import (
AIX as AIX,
@@ -50,7 +51,6 @@ from ._common import (
NoSuchProcess as NoSuchProcess,
TimeoutExpired as TimeoutExpired,
ZombieProcess as ZombieProcess,
_Status,
pconn,
pcputimes,
pctxsw,
@@ -118,6 +118,23 @@ version_info: tuple[int, int, int]
__version__: str
__author__: str
_Status: TypeAlias = Literal[
"running",
"sleeping",
"disk-sleep",
"stopped",
"tracing-stop",
"zombie",
"dead",
"wake-kill",
"waking",
"idle",
"locked",
"waiting",
"suspended",
"parked",
]
class Process:
def __init__(self, pid: int | None = ...) -> None: ...
def __eq__(self, other: object) -> bool: ...
+1 -18
View File
@@ -3,7 +3,7 @@ from _typeshed import StrOrBytesPath, SupportsWrite
from collections.abc import Callable
from socket import AddressFamily, SocketKind
from typing import Any, NamedTuple, TypeVar, overload
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal
POSIX: bool
WINDOWS: bool
@@ -32,23 +32,6 @@ STATUS_WAITING: Literal["waiting"]
STATUS_SUSPENDED: Literal["suspended"]
STATUS_PARKED: Literal["parked"]
_Status: TypeAlias = Literal[
"running",
"sleeping",
"disk-sleep",
"stopped",
"tracing-stop",
"zombie",
"dead",
"wake-kill",
"waking",
"idle",
"locked",
"waiting",
"suspended",
"parked",
]
CONN_ESTABLISHED: str
CONN_SYN_SENT: str
CONN_SYN_RECV: str
+5 -13
View File
@@ -1,19 +1,11 @@
from collections.abc import Mapping
from typing import Any
from typing_extensions import TypeAlias
from .models import Response
from .sessions import (
RequestsCookieJar,
_Auth,
_Cert,
_Data,
_Files,
_HeadersMapping,
_HooksInput,
_Params,
_TextMapping,
_Timeout,
_Verify,
)
from .sessions import RequestsCookieJar, _Auth, _Cert, _Data, _Files, _HooksInput, _Params, _TextMapping, _Timeout, _Verify
_HeadersMapping: TypeAlias = Mapping[str, str | bytes]
def request(
method: str | bytes,
-1
View File
@@ -70,7 +70,6 @@ _Params: TypeAlias = Union[
str | bytes,
]
_TextMapping: TypeAlias = MutableMapping[str, str]
_HeadersMapping: TypeAlias = Mapping[str, str | bytes]
_HeadersUpdateMapping: TypeAlias = Mapping[str, str | bytes | None]
_Timeout: TypeAlias = Union[float, tuple[float, float], tuple[float, None]]
_Verify: TypeAlias = bool | str
+1 -5
View File
@@ -1,16 +1,12 @@
import ssl
from builtins import ConnectionError as ConnectionError
from collections.abc import Iterable
from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
from typing import IO, Any
from typing_extensions import TypeAlias
from typing import Any
from . import exceptions, util
from .packages import ssl_match_hostname
from .util import ssl_
_TYPE_BODY: TypeAlias = bytes | IO[Any] | Iterable[bytes] | str
class DummyConnection: ...
BaseSSLError = ssl.SSLError
+5 -4
View File
@@ -1,15 +1,16 @@
import io
from _typeshed import Self
from collections.abc import Iterator, Mapping
from collections.abc import Iterable, Iterator, Mapping
from http.client import HTTPMessage as _HttplibHTTPMessage, HTTPResponse as _HttplibHTTPResponse
from typing import Any
from typing_extensions import Literal
from typing import IO, Any
from typing_extensions import Literal, TypeAlias
from urllib3.connectionpool import HTTPConnection
from . import HTTPConnectionPool, Retry
from ._collections import HTTPHeaderDict
from .connection import _TYPE_BODY
_TYPE_BODY: TypeAlias = bytes | IO[Any] | Iterable[bytes] | str
class DeflateDecoder:
def __init__(self) -> None: ...