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

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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):