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
2025-07-26 20:02:17 +01:00
committed by GitHub
parent e2d0c451e2
commit f88a09d479
15 changed files with 42 additions and 19 deletions
+3 -2
View File
@@ -25,7 +25,7 @@ from types import (
TracebackType,
WrapperDescriptorType,
)
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs
if sys.version_info >= (3, 14):
@@ -240,10 +240,11 @@ def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ..
def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ...
@overload
def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ...
@type_check_only
class _SupportsSet(Protocol[_T_contra, _V_contra]):
def __set__(self, instance: _T_contra, value: _V_contra, /) -> None: ...
@type_check_only
class _SupportsDelete(Protocol[_T_contra]):
def __delete__(self, instance: _T_contra, /) -> None: ...