mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Improve stubs for sequence types (#6386)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, SupportsIndex
|
||||
|
||||
_IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
|
||||
_FloatTypeCode = Literal["f", "d"]
|
||||
@@ -48,14 +48,14 @@ class array(MutableSequence[_T], Generic[_T]):
|
||||
def tostring(self) -> bytes: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, __i: int) -> _T: ...
|
||||
def __getitem__(self, __i: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, __s: slice) -> array[_T]: ...
|
||||
@overload # type: ignore # Overrides MutableSequence
|
||||
def __setitem__(self, __i: int, __o: _T) -> None: ...
|
||||
def __setitem__(self, __i: SupportsIndex, __o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, __s: slice, __o: array[_T]) -> None: ...
|
||||
def __delitem__(self, __i: int | slice) -> None: ...
|
||||
def __delitem__(self, __i: SupportsIndex | slice) -> None: ...
|
||||
def __add__(self, __x: array[_T]) -> array[_T]: ...
|
||||
def __ge__(self, __other: array[_T]) -> bool: ...
|
||||
def __gt__(self, __other: array[_T]) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user