Add contextlib.nullcontext [Python 3.7]. (#2677)

Closes #2676
This commit is contained in:
Brandt Bucher
2018-12-07 17:55:47 -08:00
committed by Sebastian Rittau
parent dd2400df6a
commit 0b49ce75b4

View File

@@ -2,7 +2,7 @@
from typing import (
Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type,
Generic, TypeVar
Generic, TypeVar, overload
)
from types import TracebackType
import sys
@@ -91,3 +91,9 @@ if sys.version_info >= (3, 7):
def pop_all(self: _S) -> _S: ...
def aclose(self) -> Awaitable[None]: ...
def __aenter__(self: _S) -> Awaitable[_S]: ...
if sys.version_info >= (3, 7):
@overload
def nullcontext(enter_result: _T) -> ContextManager[_T]: ...
@overload
def nullcontext() -> ContextManager[None]: ...