stdlib: Add several missing @abstractmethod decorators (#7443)

This commit is contained in:
Alex Waygood
2022-03-07 00:41:13 +00:00
committed by GitHub
parent 2fb9c35ff9
commit 947724a5cb
7 changed files with 29 additions and 4 deletions

View File

@@ -137,6 +137,9 @@ elif sys.version_info >= (3, 7):
func: Callable[..., AsyncGenerator[_T_co, Any]]
args: tuple[Any, ...]
kwds: dict[str, Any]
async def __aexit__(
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> bool | None: ...
if sys.version_info >= (3, 7):
def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ...
@@ -148,6 +151,7 @@ _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
class closing(AbstractContextManager[_SupportsCloseT]):
def __init__(self, thing: _SupportsCloseT) -> None: ...
def __exit__(self, *exc_info: object) -> None: ...
if sys.version_info >= (3, 10):
class _SupportsAclose(Protocol):
@@ -156,6 +160,7 @@ if sys.version_info >= (3, 10):
class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):
def __init__(self, thing: _SupportsAcloseT) -> None: ...
async def __aexit__(self, *exc_info: object) -> None: ...
class suppress(AbstractContextManager[None]):
def __init__(self, *exceptions: type[BaseException]) -> None: ...
@@ -163,11 +168,14 @@ class suppress(AbstractContextManager[None]):
self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
) -> bool: ...
class redirect_stdout(AbstractContextManager[_T_io]):
class _RedirectStream(AbstractContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
def __exit__(
self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
) -> None: ...
class redirect_stderr(AbstractContextManager[_T_io]):
def __init__(self, new_target: _T_io) -> None: ...
class redirect_stdout(_RedirectStream[_T_io]): ...
class redirect_stderr(_RedirectStream[_T_io]): ...
class ExitStack(AbstractContextManager[ExitStack]):
def __init__(self) -> None: ...