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

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Protocol, TypeVar
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Protocol, TypeVar
from typing_extensions import ParamSpec
_T = TypeVar("_T")
@@ -7,7 +7,7 @@ _T_co = TypeVar("_T_co", covariant=True)
_F = TypeVar("_F", bound=Callable[..., Any])
_P = ParamSpec("_P")
_ExitFunc = Callable[[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
_ExitFunc = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool]
class GeneratorContextManager(ContextManager[_T_co]):
def __call__(self, func: _F) -> _F: ...