Add @type_check_only to various typeshed-only procotols in stdlib (#14465)

Mark various typeshed-only protocols as `@type_check_only` in stdlib
This commit is contained in:
Brian Schubert authored and GitHub committed 2025-07-26 20:02:17 +01:00
1 parent e2d0c451e2
commit f88a09d479
15 files changed
+42 -19

No files matched your search

+3 -2
View File
@@ -4,7 +4,7 @@ from _typeshed import FileDescriptorOrPath, Unused
from abc import ABC, abstractmethod
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
from types import TracebackType
from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable
from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable, type_check_only
from typing_extensions import ParamSpec, Self, TypeAlias
__all__ = [
@@ -112,7 +112,7 @@ else:
) -> bool | None: ...
def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ...
@type_check_only
class _SupportsClose(Protocol):
def close(self) -> object: ...
@@ -123,6 +123,7 @@ class closing(AbstractContextManager[_SupportsCloseT, None]):
def __exit__(self, *exc_info: Unused) -> None: ...
if sys.version_info >= (3, 10):
@type_check_only
class _SupportsAclose(Protocol):
def aclose(self) -> Awaitable[object]: ...