Use TypeAlias where possible for type aliases (#7630)

This commit is contained in:
Alex Waygood
2022-04-16 02:01:00 +01:00
committed by GitHub
parent c0e6dd3f3f
commit 740193a8fc
218 changed files with 760 additions and 625 deletions

View File

@@ -1,11 +1,12 @@
from typing import Any, Callable
from typing_extensions import TypeAlias
import docutils.nodes
import docutils.parsers.rst.states
from docutils.languages import _LanguageModule
from docutils.utils import Reporter, SystemMessage
_RoleFn = Callable[
_RoleFn: TypeAlias = Callable[
[str, str, str, int, docutils.parsers.rst.states.Inliner, dict[str, Any], list[str]],
tuple[list[docutils.nodes.reference], list[docutils.nodes.reference]],
]

View File

@@ -1,7 +1,7 @@
import optparse
from collections.abc import Iterable
from typing import Any
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
from docutils import ApplicationError
from docutils.io import FileOutput
@@ -17,7 +17,7 @@ class DependencyList:
def add(self, *filenames: str) -> None: ...
def close(self) -> None: ...
_SystemMessageLevel = Literal[0, 1, 2, 3, 4]
_SystemMessageLevel: TypeAlias = Literal[0, 1, 2, 3, 4]
class Reporter:
DEBUG_LEVEL: Literal[0]