Skip to content

Commit 4d158e0

Browse files
hauntsaninjacdce8p
authored andcommitted
Temporarily revert contextlib deprecation
1 parent caab710 commit 4d158e0

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

mypy/typeshed/stdlib/contextlib.pyi

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod
55
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
66
from types import TracebackType
77
from 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-
)
9387
def 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-
)
117104
def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ...
118105

119106
@type_check_only

0 commit comments

Comments
 (0)