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
+28 -14
View File
@@ -17,7 +17,7 @@ from collections.abc import (
)
from importlib.machinery import ModuleSpec
from typing import Any, ClassVar, Literal, TypeVar, final, overload
from typing_extensions import ParamSpec, Self, TypeAliasType, TypeVarTuple, deprecated
from typing_extensions import ParamSpec, Self, TypeAliasType, TypeVarTuple, deprecated, disjoint_base
if sys.version_info >= (3, 14):
from _typeshed import AnnotateFunc
@@ -331,20 +331,34 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
class SimpleNamespace:
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 13):
def __init__(self, mapping_or_iterable: Mapping[str, Any] | Iterable[tuple[str, Any]] = (), /, **kwargs: Any) -> None: ...
else:
if sys.version_info >= (3, 12):
@disjoint_base
class SimpleNamespace:
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 13):
def __init__(
self, mapping_or_iterable: Mapping[str, Any] | Iterable[tuple[str, Any]] = (), /, **kwargs: Any
) -> None: ...
else:
def __init__(self, **kwargs: Any) -> None: ...
def __eq__(self, value: object, /) -> bool: ...
def __getattribute__(self, name: str, /) -> Any: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...
def __delattr__(self, name: str, /) -> None: ...
if sys.version_info >= (3, 13):
def __replace__(self, **kwargs: Any) -> Self: ...
else:
class SimpleNamespace:
__hash__: ClassVar[None] # type: ignore[assignment]
def __init__(self, **kwargs: Any) -> None: ...
def __eq__(self, value: object, /) -> bool: ...
def __getattribute__(self, name: str, /) -> Any: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...
def __delattr__(self, name: str, /) -> None: ...
def __eq__(self, value: object, /) -> bool: ...
def __getattribute__(self, name: str, /) -> Any: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...
def __delattr__(self, name: str, /) -> None: ...
if sys.version_info >= (3, 13):
def __replace__(self, **kwargs: Any) -> Self: ...
@disjoint_base
class ModuleType:
__name__: str
__file__: str | None
@@ -661,7 +675,7 @@ _P = ParamSpec("_P")
def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Awaitable[_R]]: ...
@overload
def coroutine(func: _Fn) -> _Fn: ...
@disjoint_base
class GenericAlias:
@property
def __origin__(self) -> type | TypeAliasType: ...