Use PEP 604 syntax wherever possible (#7493)

This commit is contained in:
Alex Waygood
2022-03-16 15:01:33 +00:00
committed by GitHub
parent 15e21a8dc1
commit 3ab250eec8
174 changed files with 472 additions and 490 deletions

View File

@@ -5,20 +5,7 @@ from importlib.abc import PathEntryFinder
from importlib.machinery import ModuleSpec
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import (
Any,
AsyncGenerator,
Callable,
Coroutine,
NoReturn,
Optional,
Protocol,
Sequence,
TextIO,
TypeVar,
Union,
overload,
)
from typing import Any, AsyncGenerator, Callable, Coroutine, NoReturn, Protocol, Sequence, TextIO, TypeVar, Union, overload
from typing_extensions import Literal, final
_T = TypeVar("_T")
@@ -255,7 +242,7 @@ _ProfileFunc = Callable[[FrameType, str, Any], Any]
def getprofile() -> _ProfileFunc | None: ...
def setprofile(profilefunc: _ProfileFunc | None) -> None: ...
_TraceFunc = Callable[[FrameType, str, Any], Optional[Callable[[FrameType, str, Any], Any]]]
_TraceFunc = Callable[[FrameType, str, Any], Callable[[FrameType, str, Any], Any] | None]
def gettrace() -> _TraceFunc | None: ...
def settrace(tracefunc: _TraceFunc | None) -> None: ...
@@ -322,7 +309,7 @@ if sys.version_info >= (3, 8):
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
def audit(__event: str, *args: Any) -> None: ...
_AsyncgenHook = Optional[Callable[[AsyncGenerator[Any, Any]], None]]
_AsyncgenHook = Callable[[AsyncGenerator[Any, Any]], None] | None
@final
class _asyncgen_hooks(structseq[_AsyncgenHook], tuple[_AsyncgenHook, _AsyncgenHook]):