mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Add @type_check_only to stub-only private classes in stdlib (#14512)
This commit is contained in:
@@ -3,7 +3,7 @@ import types
|
||||
from _typeshed import SupportsAllComparisons, SupportsItems
|
||||
from collections.abc import Callable, Hashable, Iterable, Sized
|
||||
from types import GenericAlias
|
||||
from typing import Any, Final, Generic, Literal, NamedTuple, TypedDict, TypeVar, final, overload
|
||||
from typing import Any, Final, Generic, Literal, NamedTuple, TypedDict, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
|
||||
__all__ = [
|
||||
@@ -48,6 +48,7 @@ class _CacheInfo(NamedTuple):
|
||||
maxsize: int | None
|
||||
currsize: int
|
||||
|
||||
@type_check_only
|
||||
class _CacheParameters(TypedDict):
|
||||
maxsize: int
|
||||
typed: bool
|
||||
@@ -96,6 +97,7 @@ else:
|
||||
|
||||
WRAPPER_UPDATES: tuple[Literal["__dict__"]]
|
||||
|
||||
@type_check_only
|
||||
class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWrapper]):
|
||||
__wrapped__: Callable[_PWrapped, _RWrapped]
|
||||
def __call__(self, *args: _PWrapper.args, **kwargs: _PWrapper.kwargs) -> _RWrapper: ...
|
||||
@@ -103,6 +105,7 @@ class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWrapper]):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
|
||||
@type_check_only
|
||||
class _Wrapper(Generic[_PWrapped, _RWrapped]):
|
||||
def __call__(self, f: Callable[_PWrapper, _RWrapper]) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWrapper]: ...
|
||||
|
||||
@@ -180,6 +183,7 @@ if sys.version_info >= (3, 11):
|
||||
else:
|
||||
_RegType: TypeAlias = type[Any]
|
||||
|
||||
@type_check_only
|
||||
class _SingleDispatchCallable(Generic[_T]):
|
||||
registry: types.MappingProxyType[Any, Callable[..., _T]]
|
||||
def dispatch(self, cls: Any) -> Callable[..., _T]: ...
|
||||
|
||||
Reference in New Issue
Block a user