mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-17 08:35:03 +08:00
Remove or move several TypeAlias declarations (#8444)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
from collections.abc import Callable
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
from lib2to3.pytree import _RawNode
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# This is imported in several lib2to3/pgen2 submodules
|
||||
_Convert: TypeAlias = Callable[[Grammar, _RawNode], Any]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from _typeshed import StrPath
|
||||
from collections.abc import Iterable
|
||||
from lib2to3.pgen2 import _Convert
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
from lib2to3.pytree import _NL, _Convert
|
||||
from lib2to3.pytree import _NL
|
||||
from logging import Logger
|
||||
from typing import IO, Any
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from collections.abc import Sequence
|
||||
from lib2to3.pgen2 import _Convert
|
||||
from lib2to3.pgen2.grammar import _DFAS, Grammar
|
||||
from lib2to3.pytree import _NL, _Convert, _RawNode
|
||||
from lib2to3.pytree import _NL, _RawNode
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from collections.abc import Callable, Iterator
|
||||
from collections.abc import Iterator
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -8,9 +8,6 @@ _NL: TypeAlias = Node | Leaf
|
||||
_Context: TypeAlias = tuple[str, int, int]
|
||||
_Results: TypeAlias = dict[str, _NL]
|
||||
_RawNode: TypeAlias = tuple[int, str, _Context, list[_NL] | None]
|
||||
# This alias isn't used in this file,
|
||||
# but is imported in other lib2to3 submodules
|
||||
_Convert: TypeAlias = Callable[[Grammar, _RawNode], Any]
|
||||
|
||||
HUGE: int
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ _SqliteData: TypeAlias = str | ReadableBuffer | int | float | None
|
||||
_AdaptedInputData: TypeAlias = _SqliteData | Any
|
||||
# The Mapping must really be a dict, but making it invariant is too annoying.
|
||||
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
|
||||
_SqliteOutputData: TypeAlias = str | bytes | int | float | None
|
||||
_Adapter: TypeAlias = Callable[[_T], _SqliteData]
|
||||
_Converter: TypeAlias = Callable[[bytes], Any]
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from typing_extensions import Literal, TypeAlias, final
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
_OptExcInfo: TypeAlias = OptExcInfo # TODO: obsolete, remove fall 2022 or later
|
||||
_OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall 2022 or later
|
||||
|
||||
# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
|
||||
class _MetaPathFinder(Protocol):
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user