contextlib.nullcontext is a class (#5695)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Thomas Grainger
2021-06-26 16:19:03 +01:00
committed by GitHub
parent 64c85cdd44
commit c522e8e53c

View File

@@ -113,7 +113,11 @@ if sys.version_info >= (3, 7):
) -> Awaitable[bool]: ...
if sys.version_info >= (3, 7):
@overload
def nullcontext(enter_result: _T) -> ContextManager[_T]: ...
@overload
def nullcontext() -> ContextManager[None]: ...
class nullcontext(AbstractContextManager[_T]):
enter_result: _T
@overload
def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ...
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Any) -> bool: ...