Skip to content

Commit ae45edc

Browse files
committed
Temporarily revert contextlib deprecation
1 parent 1e3d413 commit ae45edc

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

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, 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-
)
9589
def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ...
9690

9791
if 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-
)
128115
def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ...
129116
@type_check_only
130117
class _SupportsClose(Protocol):

0 commit comments

Comments
 (0)