Add @disjoint_base decorator in the stdlib (#14599)

And fix some other new stubtest finds.
This commit is contained in:
Jelle Zijlstra
2025-08-24 07:27:14 -07:00
committed by GitHub
parent 2565f34946
commit e8ba06f710
55 changed files with 701 additions and 307 deletions
+61 -24
View File
@@ -4,7 +4,7 @@ from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, S
from contextlib import _GeneratorContextManager
from types import TracebackType
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
from typing_extensions import ParamSpec, Self, TypeAlias
from typing_extensions import ParamSpec, Self, TypeAlias, disjoint_base
_T = TypeVar("_T")
_TT = TypeVar("_TT", bound=type[Any])
@@ -68,29 +68,66 @@ _ArgsKwargs: TypeAlias = tuple[tuple[Any, ...], Mapping[str, Any]]
_NameArgsKwargs: TypeAlias = tuple[str, tuple[Any, ...], Mapping[str, Any]]
_CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs | _NameArgsKwargs
class _Call(tuple[Any, ...]):
def __new__(
cls, value: _CallValue = (), name: str | None = "", parent: _Call | None = None, two: bool = False, from_kall: bool = True
) -> Self: ...
def __init__(
self,
value: _CallValue = (),
name: str | None = None,
parent: _Call | None = None,
two: bool = False,
from_kall: bool = True,
) -> None: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __eq__(self, other: object) -> bool: ...
def __ne__(self, value: object, /) -> bool: ...
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: str) -> Any: ...
def __getattribute__(self, attr: str) -> Any: ...
@property
def args(self) -> tuple[Any, ...]: ...
@property
def kwargs(self) -> Mapping[str, Any]: ...
def call_list(self) -> Any: ...
if sys.version_info >= (3, 12):
class _Call(tuple[Any, ...]):
def __new__(
cls,
value: _CallValue = (),
name: str | None = "",
parent: _Call | None = None,
two: bool = False,
from_kall: bool = True,
) -> Self: ...
def __init__(
self,
value: _CallValue = (),
name: str | None = None,
parent: _Call | None = None,
two: bool = False,
from_kall: bool = True,
) -> None: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __eq__(self, other: object) -> bool: ...
def __ne__(self, value: object, /) -> bool: ...
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: str) -> Any: ...
def __getattribute__(self, attr: str) -> Any: ...
@property
def args(self) -> tuple[Any, ...]: ...
@property
def kwargs(self) -> Mapping[str, Any]: ...
def call_list(self) -> Any: ...
else:
@disjoint_base
class _Call(tuple[Any, ...]):
def __new__(
cls,
value: _CallValue = (),
name: str | None = "",
parent: _Call | None = None,
two: bool = False,
from_kall: bool = True,
) -> Self: ...
def __init__(
self,
value: _CallValue = (),
name: str | None = None,
parent: _Call | None = None,
two: bool = False,
from_kall: bool = True,
) -> None: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __eq__(self, other: object) -> bool: ...
def __ne__(self, value: object, /) -> bool: ...
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: str) -> Any: ...
def __getattribute__(self, attr: str) -> Any: ...
@property
def args(self) -> tuple[Any, ...]: ...
@property
def kwargs(self) -> Mapping[str, Any]: ...
def call_list(self) -> Any: ...
call: _Call