@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod
55from collections .abc import AsyncGenerator , AsyncIterator , Awaitable , Callable , Generator , Iterator
66from types import TracebackType
77from typing import Any , Generic , Protocol , TypeVar , overload , runtime_checkable , type_check_only
8- from typing_extensions import ParamSpec , Self , TypeAlias , deprecated
8+ from typing_extensions import ParamSpec , Self , TypeAlias
99
1010__all__ = [
1111 "contextmanager" ,
@@ -86,12 +86,6 @@ class _GeneratorContextManager(
8686 self , typ : type [BaseException ] | None , value : BaseException | None , traceback : TracebackType | None
8787 ) -> bool | None : ...
8888
89- @overload
90- def contextmanager (func : Callable [_P , Generator [_T_co , None , object ]]) -> Callable [_P , _GeneratorContextManager [_T_co ]]: ...
91- @overload
92- @deprecated (
93- "Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead."
94- )
9589def contextmanager (func : Callable [_P , Iterator [_T_co ]]) -> Callable [_P , _GeneratorContextManager [_T_co ]]: ...
9690
9791if sys .version_info >= (3 , 10 ):
@@ -118,13 +112,6 @@ else:
118112 self , typ : type [BaseException ] | None , value : BaseException | None , traceback : TracebackType | None
119113 ) -> bool | None : ...
120114
121- @overload
122- def asynccontextmanager (func : Callable [_P , AsyncGenerator [_T_co ]]) -> Callable [_P , _AsyncGeneratorContextManager [_T_co ]]: ...
123- @overload
124- @deprecated (
125- "Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. "
126- "Use `-> AsyncGenerator[Foo]` instead."
127- )
128115def asynccontextmanager (func : Callable [_P , AsyncIterator [_T_co ]]) -> Callable [_P , _AsyncGeneratorContextManager [_T_co ]]: ...
129116@type_check_only
130117class _SupportsClose (Protocol ):
0 commit comments