mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
add py3.10 async contextlib.nullcontext (#5711)
This commit is contained in:
@@ -112,7 +112,19 @@ if sys.version_info >= (3, 7):
|
||||
__traceback: Optional[TracebackType],
|
||||
) -> Awaitable[bool]: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
if sys.version_info >= (3, 10):
|
||||
class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_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) -> None: ...
|
||||
async def __aenter__(self) -> _T: ...
|
||||
async def __aexit__(self, *exctype: Any) -> None: ...
|
||||
|
||||
elif sys.version_info >= (3, 7):
|
||||
class nullcontext(AbstractContextManager[_T]):
|
||||
enter_result: _T
|
||||
@overload
|
||||
@@ -120,4 +132,4 @@ if sys.version_info >= (3, 7):
|
||||
@overload
|
||||
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
|
||||
def __enter__(self) -> _T: ...
|
||||
def __exit__(self, *exctype: Any) -> bool: ...
|
||||
def __exit__(self, *exctype: Any) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user