diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index ee3aa766d569..b6c7e0762632 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -8,7 +8,7 @@ import mmap import sys from os import PathLike from typing import AbstractSet, Any, Awaitable, Container, Generic, Iterable, Protocol, TypeVar -from typing_extensions import Final, Literal, final +from typing_extensions import Final, Literal, TypeAlias, final _KT = TypeVar("_KT") _KT_co = TypeVar("_KT_co", covariant=True) @@ -23,6 +23,13 @@ _T_contra = TypeVar("_T_contra", contravariant=True) # def __enter__(self: Self) -> Self: ... Self = TypeVar("Self") # noqa Y001 +# For partially known annotations. Usually, fields where type annotations +# haven't been added are left unannotated, but in some situations this +# isn't possible or a type is already partially known. In cases like these, +# use Incomplete instead of Any as a marker. For example, use +# "Incomplete | None" instead of "Any | None". +Incomplete: TypeAlias = Any + # stable class IdentityFunction(Protocol): def __call__(self, __x: _T) -> _T: ...