stdlib: correct many pos-or-kw arg names in dunder methods (#7451)

This commit is contained in:
Alex Waygood
2022-03-07 15:40:03 +00:00
committed by GitHub
parent 626ccdaee2
commit f4ae363b56
27 changed files with 153 additions and 162 deletions

View File

@@ -477,8 +477,8 @@ class TypeVar:
self, name: str, *constraints: Any, bound: Any | None = ..., covariant: bool = ..., contravariant: bool = ...
) -> None: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
# Used for an undocumented mypy feature. Does not exist at runtime.
_promote = object()
@@ -486,7 +486,7 @@ _promote = object()
# N.B. Keep this definition in sync with typing_extensions._SpecialForm
@_final
class _SpecialForm:
def __getitem__(self, typeargs: 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: ...
@@ -547,8 +547,8 @@ if sys.version_info >= (3, 10):
def args(self) -> ParamSpecArgs: ...
@property
def kwargs(self) -> ParamSpecKwargs: ...
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
Concatenate: _SpecialForm
TypeAlias: _SpecialForm
TypeGuard: _SpecialForm
@@ -786,14 +786,14 @@ class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
@overload
@abstractmethod
def __getitem__(self, i: int) -> _T_co: ...
def __getitem__(self, index: int) -> _T_co: ...
@overload
@abstractmethod
def __getitem__(self, s: slice) -> Sequence[_T_co]: ...
def __getitem__(self, index: slice) -> Sequence[_T_co]: ...
# Mixin methods
def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ...
def count(self, value: Any) -> int: ...
def __contains__(self, x: object) -> bool: ...
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __reversed__(self) -> Iterator[_T_co]: ...
@@ -802,22 +802,22 @@ class MutableSequence(Sequence[_T], Generic[_T]):
def insert(self, index: int, value: _T) -> None: ...
@overload
@abstractmethod
def __getitem__(self, i: int) -> _T: ...
def __getitem__(self, index: int) -> _T: ...
@overload
@abstractmethod
def __getitem__(self, s: slice) -> MutableSequence[_T]: ...
def __getitem__(self, index: slice) -> MutableSequence[_T]: ...
@overload
@abstractmethod
def __setitem__(self, i: int, o: _T) -> None: ...
def __setitem__(self, index: int, value: _T) -> None: ...
@overload
@abstractmethod
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __setitem__(self, index: slice, value: Iterable[_T]) -> None: ...
@overload
@abstractmethod
def __delitem__(self, i: int) -> None: ...
def __delitem__(self, index: int) -> None: ...
@overload
@abstractmethod
def __delitem__(self, i: slice) -> None: ...
def __delitem__(self, index: slice) -> None: ...
# Mixin methods
def append(self, value: _T) -> None: ...
def clear(self) -> None: ...
@@ -825,21 +825,21 @@ class MutableSequence(Sequence[_T], Generic[_T]):
def reverse(self) -> None: ...
def pop(self, index: int = ...) -> _T: ...
def remove(self, value: _T) -> None: ...
def __iadd__(self: TypeshedSelf, x: Iterable[_T]) -> TypeshedSelf: ...
def __iadd__(self: TypeshedSelf, values: Iterable[_T]) -> TypeshedSelf: ...
class AbstractSet(Collection[_T_co], Generic[_T_co]):
@abstractmethod
def __contains__(self, x: object) -> bool: ...
def _hash(self) -> int: ...
# Mixin methods
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
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 isdisjoint(self, other: Iterable[Any]) -> bool: ...
class MutableSet(AbstractSet[_T], Generic[_T]):
@@ -851,10 +851,10 @@ class MutableSet(AbstractSet[_T], Generic[_T]):
def clear(self) -> None: ...
def pop(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def __ior__(self: TypeshedSelf, s: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __iand__(self: TypeshedSelf, s: AbstractSet[Any]) -> TypeshedSelf: ...
def __ixor__(self: TypeshedSelf, s: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __isub__(self: TypeshedSelf, s: AbstractSet[Any]) -> TypeshedSelf: ...
def __ior__(self: TypeshedSelf, it: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __iand__(self: TypeshedSelf, it: AbstractSet[Any]) -> TypeshedSelf: ...
def __ixor__(self: TypeshedSelf, it: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __isub__(self: TypeshedSelf, it: AbstractSet[Any]) -> TypeshedSelf: ...
class MappingView(Sized):
def __init__(self, mapping: Mapping[Any, Any]) -> None: ... # undocumented
@@ -862,39 +862,39 @@ 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, o: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rand__(self, o: Iterable[_T]) -> set[_T]: ...
def __contains__(self, o: 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]]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
def __or__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __ror__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __sub__(self, o: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rsub__(self, o: Iterable[_T]) -> set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __rxor__(self, o: 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], Generic[_KT_co]):
def __init__(self, mapping: Mapping[_KT_co, Any]) -> None: ... # undocumented
def __and__(self, o: Iterable[Any]) -> set[_KT_co]: ...
def __rand__(self, o: Iterable[_T]) -> set[_T]: ...
def __contains__(self, o: 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]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT_co]: ...
def __or__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __ror__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __sub__(self, o: Iterable[Any]) -> set[_KT_co]: ...
def __rsub__(self, o: Iterable[_T]) -> set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __rxor__(self, o: 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, Iterable[_VT_co], Generic[_VT_co]):
def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented
def __contains__(self, o: object) -> bool: ...
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_VT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_VT_co]: ...