diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index d296c8d92149..d69f5c8d02c2 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -207,12 +207,12 @@ class TypeVar: contravariant: bool = False, ) -> None: ... if sys.version_info >= (3, 10): - def __or__(self, right: Any) -> _SpecialForm: ... # AnnotationForm - def __ror__(self, left: Any) -> _SpecialForm: ... # AnnotationForm + def __or__(self, right: Any, /) -> _SpecialForm: ... # AnnotationForm + def __ror__(self, left: Any, /) -> _SpecialForm: ... # AnnotationForm if sys.version_info >= (3, 11): - def __typing_subst__(self, arg: Any) -> Any: ... + def __typing_subst__(self, arg: Any, /) -> Any: ... if sys.version_info >= (3, 13): - def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ... + def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ... def has_default(self) -> bool: ... if sys.version_info >= (3, 14): @property @@ -229,10 +229,10 @@ _promote = object() # N.B. Keep this definition in sync with typing_extensions._SpecialForm @final class _SpecialForm(_Final): - def __getitem__(self, parameters: Any) -> object: ... + def __getitem__(self, parameters: Any, /) -> object: ... if sys.version_info >= (3, 10): - def __or__(self, other: Any) -> _SpecialForm: ... - def __ror__(self, other: Any) -> _SpecialForm: ... + def __or__(self, other: Any, /) -> _SpecialForm: ... + def __ror__(self, other: Any, /) -> _SpecialForm: ... Union: _SpecialForm Generic: _SpecialForm @@ -273,8 +273,8 @@ if sys.version_info >= (3, 11): def __init__(self, name: str) -> None: ... def __iter__(self) -> Any: ... - def __typing_subst__(self, arg: Never) -> Never: ... - def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ... + def __typing_subst__(self, arg: Never, /) -> Never: ... + def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ... if sys.version_info >= (3, 14): @property def evaluate_default(self) -> EvaluateFunc | None: ... @@ -289,7 +289,7 @@ if sys.version_info >= (3, 10): else: def __init__(self, origin: ParamSpec) -> None: ... - def __eq__(self, other: object) -> bool: ... + def __eq__(self, other: object, /) -> bool: ... __hash__: ClassVar[None] # type: ignore[assignment] @final @@ -301,7 +301,7 @@ if sys.version_info >= (3, 10): else: def __init__(self, origin: ParamSpec) -> None: ... - def __eq__(self, other: object) -> bool: ... + def __eq__(self, other: object, /) -> bool: ... __hash__: ClassVar[None] # type: ignore[assignment] @final @@ -365,11 +365,11 @@ if sys.version_info >= (3, 10): @property def kwargs(self) -> ParamSpecKwargs: ... if sys.version_info >= (3, 11): - def __typing_subst__(self, arg: Any) -> Any: ... - def __typing_prepare_subst__(self, alias: Any, args: Any) -> tuple[Any, ...]: ... + def __typing_subst__(self, arg: Any, /) -> Any: ... + def __typing_prepare_subst__(self, alias: Any, args: Any, /) -> tuple[Any, ...]: ... - def __or__(self, right: Any) -> _SpecialForm: ... - def __ror__(self, left: Any) -> _SpecialForm: ... + def __or__(self, right: Any, /) -> _SpecialForm: ... + def __ror__(self, left: Any, /) -> _SpecialForm: ... if sys.version_info >= (3, 13): def has_default(self) -> bool: ... if sys.version_info >= (3, 14): @@ -388,8 +388,8 @@ if sys.version_info >= (3, 10): else: def __call__(self, x: _T) -> _T: ... - def __or__(self, other: Any) -> _SpecialForm: ... - def __ror__(self, other: Any) -> _SpecialForm: ... + def __or__(self, other: Any, /) -> _SpecialForm: ... + def __ror__(self, other: Any, /) -> _SpecialForm: ... __supertype__: type | NewType else: @@ -421,7 +421,7 @@ def type_check_only(func_or_cls: _FT) -> _FT: ... class _Alias: # Class for defining generic aliases for library types. - def __getitem__(self, typeargs: Any) -> Any: ... + def __getitem__(self, typeargs: Any, /) -> Any: ... List = _Alias() Dict = _Alias() @@ -630,38 +630,38 @@ class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): class Sequence(Reversible[_T_co], Collection[_T_co]): @overload @abstractmethod - def __getitem__(self, index: int) -> _T_co: ... + def __getitem__(self, index: int, /) -> _T_co: ... @overload @abstractmethod - def __getitem__(self, index: slice) -> Sequence[_T_co]: ... + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... # Mixin methods def index(self, value: Any, start: int = 0, stop: int = ...) -> int: ... def count(self, value: Any) -> int: ... - def __contains__(self, value: object) -> bool: ... + def __contains__(self, value: object, /) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... def __reversed__(self) -> Iterator[_T_co]: ... class MutableSequence(Sequence[_T]): @abstractmethod - def insert(self, index: int, value: _T) -> None: ... + def insert(self, index: int, value: _T, /) -> None: ... @overload @abstractmethod - def __getitem__(self, index: int) -> _T: ... + def __getitem__(self, index: int, /) -> _T: ... @overload @abstractmethod - def __getitem__(self, index: slice) -> MutableSequence[_T]: ... + def __getitem__(self, index: slice, /) -> MutableSequence[_T]: ... @overload @abstractmethod - def __setitem__(self, index: int, value: _T) -> None: ... + def __setitem__(self, index: int, value: _T, /) -> None: ... @overload @abstractmethod - def __setitem__(self, index: slice, value: Iterable[_T]) -> None: ... + def __setitem__(self, index: slice, value: Iterable[_T], /) -> None: ... @overload @abstractmethod - def __delitem__(self, index: int) -> None: ... + def __delitem__(self, index: int, /) -> None: ... @overload @abstractmethod - def __delitem__(self, index: slice) -> None: ... + def __delitem__(self, index: slice, /) -> None: ... # Mixin methods def append(self, value: _T) -> None: ... def clear(self) -> None: ... @@ -669,37 +669,37 @@ class MutableSequence(Sequence[_T]): def reverse(self) -> None: ... def pop(self, index: int = -1) -> _T: ... def remove(self, value: _T) -> None: ... - def __iadd__(self, values: Iterable[_T]) -> typing_extensions.Self: ... + def __iadd__(self, values: Iterable[_T], /) -> typing_extensions.Self: ... class AbstractSet(Collection[_T_co]): @abstractmethod - def __contains__(self, x: object) -> bool: ... + def __contains__(self, x: object, /) -> bool: ... def _hash(self) -> int: ... # Mixin methods - def __le__(self, other: AbstractSet[Any]) -> bool: ... - def __lt__(self, other: AbstractSet[Any]) -> bool: ... - def __gt__(self, other: AbstractSet[Any]) -> bool: ... - def __ge__(self, other: AbstractSet[Any]) -> bool: ... - def __and__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __or__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... - def __sub__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ... - def __xor__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ... - def __eq__(self, other: object) -> bool: ... + def __le__(self, other: AbstractSet[Any], /) -> bool: ... + def __lt__(self, other: AbstractSet[Any], /) -> bool: ... + def __gt__(self, other: AbstractSet[Any], /) -> bool: ... + def __ge__(self, other: AbstractSet[Any], /) -> bool: ... + def __and__(self, other: AbstractSet[Any], /) -> AbstractSet[_T_co]: ... + def __or__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ... + def __sub__(self, other: AbstractSet[Any], /) -> AbstractSet[_T_co]: ... + def __xor__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ... + def __eq__(self, other: object, /) -> bool: ... def isdisjoint(self, other: Iterable[Any]) -> bool: ... class MutableSet(AbstractSet[_T]): @abstractmethod - def add(self, value: _T) -> None: ... + def add(self, value: _T, /) -> None: ... @abstractmethod - def discard(self, value: _T) -> None: ... + def discard(self, value: _T, /) -> None: ... # Mixin methods def clear(self) -> None: ... def pop(self) -> _T: ... def remove(self, value: _T) -> None: ... - def __ior__(self, it: AbstractSet[_T]) -> typing_extensions.Self: ... # type: ignore[override,misc] - def __iand__(self, it: AbstractSet[Any]) -> typing_extensions.Self: ... - def __ixor__(self, it: AbstractSet[_T]) -> typing_extensions.Self: ... # type: ignore[override,misc] - def __isub__(self, it: AbstractSet[Any]) -> typing_extensions.Self: ... + def __ior__(self, it: AbstractSet[_T], /) -> typing_extensions.Self: ... # type: ignore[override,misc] + def __iand__(self, it: AbstractSet[Any], /) -> typing_extensions.Self: ... + def __ixor__(self, it: AbstractSet[_T], /) -> typing_extensions.Self: ... # type: ignore[override,misc] + def __isub__(self, it: AbstractSet[Any], /) -> typing_extensions.Self: ... class MappingView(Sized): def __init__(self, mapping: Mapping[Any, Any]) -> None: ... # undocumented @@ -707,33 +707,33 @@ class MappingView(Sized): class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented - def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... - def __rand__(self, other: Iterable[_T]) -> set[_T]: ... - def __contains__(self, item: object) -> bool: ... + def __and__(self, other: Iterable[Any], /) -> set[tuple[_KT_co, _VT_co]]: ... + def __rand__(self, other: Iterable[_T], /) -> set[_T]: ... + def __contains__(self, item: object, /) -> bool: ... def __iter__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... - def __or__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... - def __ror__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... - def __sub__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... - def __rsub__(self, other: Iterable[_T]) -> set[_T]: ... - def __xor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... - def __rxor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __or__(self, other: Iterable[_T], /) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __ror__(self, other: Iterable[_T], /) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __sub__(self, other: Iterable[Any], /) -> set[tuple[_KT_co, _VT_co]]: ... + def __rsub__(self, other: Iterable[_T], /) -> set[_T]: ... + def __xor__(self, other: Iterable[_T], /) -> set[tuple[_KT_co, _VT_co] | _T]: ... + def __rxor__(self, other: Iterable[_T], /) -> set[tuple[_KT_co, _VT_co] | _T]: ... class KeysView(MappingView, AbstractSet[_KT_co]): def __init__(self, mapping: Mapping[_KT_co, Any]) -> None: ... # undocumented - def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ... - def __rand__(self, other: Iterable[_T]) -> set[_T]: ... - def __contains__(self, key: object) -> bool: ... + def __and__(self, other: Iterable[Any], /) -> set[_KT_co]: ... + def __rand__(self, other: Iterable[_T], /) -> set[_T]: ... + def __contains__(self, key: object, /) -> bool: ... def __iter__(self) -> Iterator[_KT_co]: ... - def __or__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... - def __ror__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... - def __sub__(self, other: Iterable[Any]) -> set[_KT_co]: ... - def __rsub__(self, other: Iterable[_T]) -> set[_T]: ... - def __xor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... - def __rxor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ... + def __or__(self, other: Iterable[_T], /) -> set[_KT_co | _T]: ... + def __ror__(self, other: Iterable[_T], /) -> set[_KT_co | _T]: ... + def __sub__(self, other: Iterable[Any], /) -> set[_KT_co]: ... + def __rsub__(self, other: Iterable[_T], /) -> set[_T]: ... + def __xor__(self, other: Iterable[_T], /) -> set[_KT_co | _T]: ... + def __rxor__(self, other: Iterable[_T], /) -> set[_KT_co | _T]: ... class ValuesView(MappingView, Collection[_VT_co]): def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented - def __contains__(self, value: object) -> bool: ... + def __contains__(self, value: object, /) -> bool: ... def __iter__(self) -> Iterator[_VT_co]: ... class Mapping(Collection[_KT], Generic[_KT, _VT_co]): @@ -1013,7 +1013,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] def update(self, m: typing_extensions.Self, /) -> None: ... - def __delitem__(self, k: _Never) -> None: ... + def __delitem__(self, k: _Never, /) -> None: ... def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... @@ -1087,11 +1087,11 @@ else: self, globalns: dict[str, Any] | None, localns: Mapping[str, Any] | None, recursive_guard: frozenset[str] ) -> Any | None: ... # AnnotationForm - def __eq__(self, other: object) -> bool: ... + def __eq__(self, other: object, /) -> bool: ... def __hash__(self) -> int: ... if sys.version_info >= (3, 11): - def __or__(self, other: Any) -> _SpecialForm: ... - def __ror__(self, other: Any) -> _SpecialForm: ... + def __or__(self, other: Any, /) -> _SpecialForm: ... + def __ror__(self, other: Any, /) -> _SpecialForm: ... if sys.version_info >= (3, 10): def is_typeddict(tp: object) -> bool: ... @@ -1114,9 +1114,9 @@ if sys.version_info >= (3, 12): # It's writable on types, but not on instances of TypeAliasType. @property def __module__(self) -> str | None: ... # type: ignore[override] - def __getitem__(self, parameters: Any) -> GenericAlias: ... # AnnotationForm - def __or__(self, right: Any) -> _SpecialForm: ... - def __ror__(self, left: Any) -> _SpecialForm: ... + def __getitem__(self, parameters: Any, /) -> GenericAlias: ... # AnnotationForm + def __or__(self, right: Any, /) -> _SpecialForm: ... + def __ror__(self, left: Any, /) -> _SpecialForm: ... if sys.version_info >= (3, 14): @property def evaluate_value(self) -> EvaluateFunc: ...