@@ -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 , ParamSpec , Protocol , TypeAlias , TypeVar , overload , runtime_checkable , type_check_only
8- from typing_extensions import Self , deprecated
8+ from typing_extensions import Self
99
1010__all__ = [
1111 "aclosing" ,
@@ -84,12 +84,6 @@ class _GeneratorContextManager(
8484 self , typ : type [BaseException ] | None , value : BaseException | None , traceback : TracebackType | None
8585 ) -> bool | None : ...
8686
87- @overload
88- def contextmanager (func : Callable [_P , Generator [_T_co , None , object ]]) -> Callable [_P , _GeneratorContextManager [_T_co ]]: ...
89- @overload
90- @deprecated (
91- "Annotating the return type as `-> Iterator[Foo]` with `@contextmanager` is deprecated. Use `-> Generator[Foo]` instead."
92- )
9387def contextmanager (func : Callable [_P , Iterator [_T_co ]]) -> Callable [_P , _GeneratorContextManager [_T_co ]]: ...
9488
9589_AF = TypeVar ("_AF" , bound = Callable [..., Awaitable [Any ]])
@@ -107,13 +101,6 @@ class _AsyncGeneratorContextManager(
107101 self , typ : type [BaseException ] | None , value : BaseException | None , traceback : TracebackType | None
108102 ) -> bool | None : ...
109103
110- @overload
111- def asynccontextmanager (func : Callable [_P , AsyncGenerator [_T_co ]]) -> Callable [_P , _AsyncGeneratorContextManager [_T_co ]]: ...
112- @overload
113- @deprecated (
114- "Annotating the return type as `-> AsyncIterator[Foo]` with `@asynccontextmanager` is deprecated. "
115- "Use `-> AsyncGenerator[Foo]` instead."
116- )
117104def asynccontextmanager (func : Callable [_P , AsyncIterator [_T_co ]]) -> Callable [_P , _AsyncGeneratorContextManager [_T_co ]]: ...
118105
119106@type_check_only
0 commit comments