Remove incorrect deque method overloads (#6628)

As the current comment in the source code states, these methods don't really take slices. It's surely better just to add `# type: ignore` comments, rather than have an incorrect stub.
This commit is contained in:
Alex Waygood
2021-12-18 20:00:03 +00:00
committed by GitHub
parent 4f7f30a8c4
commit 12b79f64d7

View File

@@ -206,20 +206,10 @@ class deque(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
# These methods of deque don't really take slices, but we need to
# define them as taking a slice to satisfy MutableSequence.
@overload
def __getitem__(self, __index: SupportsIndex) -> _T: ...
@overload
def __getitem__(self, __s: slice) -> MutableSequence[_T]: ...
@overload
def __setitem__(self, __i: SupportsIndex, __x: _T) -> None: ...
@overload
def __setitem__(self, __s: slice, __o: Iterable[_T]) -> None: ...
@overload
def __delitem__(self, __i: SupportsIndex) -> None: ...
@overload
def __delitem__(self, __s: slice) -> None: ...
# These methods of deque don't take slices, unlike MutableSequence, hence the type: ignores
def __getitem__(self, __index: SupportsIndex) -> _T: ... # type: ignore[override]
def __setitem__(self, __i: SupportsIndex, __x: _T) -> None: ... # type: ignore[override]
def __delitem__(self, __i: SupportsIndex) -> None: ... # type: ignore[override]
def __contains__(self, __o: object) -> bool: ...
def __reduce__(self: Self) -> tuple[Type[Self], tuple[()], None, Iterator[_T]]: ...
def __reversed__(self) -> Iterator[_T]: ...