From 298fd733106f490518ed73dac3b8c4008b70ea22 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Sat, 12 Oct 2024 00:36:32 +0800 Subject: [PATCH] inherit collection and reversible directly --- stdlib/builtins.pyi | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 0ceef3f5d9b4..1dfc675ed331 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -30,7 +30,6 @@ from _typeshed import ( SupportsRichComparisonT, SupportsWrite, ) -from abc import abstractmethod from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from types import CellType, CodeType, TracebackType @@ -835,20 +834,8 @@ _IntegerFormats: TypeAlias = Literal[ "b", "B", "@b", "@B", "h", "H", "@h", "@H", "i", "I", "@i", "@I", "l", "L", "@l", "@L", "q", "Q", "@q", "@Q", "P", "@P" ] -# Sequence[T] without index and count -class __memory_view(Collection[_T_co], Reversible[_T_co]): - @overload - @abstractmethod - def __getitem__(self, index: int) -> _T_co: ... - @overload - @abstractmethod - def __getitem__(self, index: slice) -> __memory_view[_T_co]: ... - def __contains__(self, value: object) -> bool: ... - def __iter__(self) -> Iterator[_T_co]: ... - def __reversed__(self) -> Iterator[_T_co]: ... - @final -class memoryview(__memory_view[_I]): +class memoryview(Collection[_T_co], Reversible[_T_co]): @property def format(self) -> str: ... @property