| 1 |
# tuple definition from typeshed, |
| 2 |
from typing import ( |
| 3 |
Generic, |
| 4 |
Sequence, |
| 5 |
TypeVar, |
| 6 |
Iterable, |
| 7 |
Iterator, |
| 8 |
Any, |
| 9 |
overload, |
| 10 |
Self, |
| 11 |
Protocol, |
| 12 |
) |
| 13 |
from types import GenericAlias |
| 14 |
|
| 15 |
_T = TypeVar("_T") |
| 16 |
_T_co = TypeVar('_T_co', covariant=True) |
| 17 |
|
| 18 |
class tuple(Sequence[_T_co], Generic[_T_co]): |
| 19 |
def __new__(cls, iterable: Iterable[_T_co] = ..., /) -> Self: ... |
| 20 |
def __len__(self) -> int: ... |
| 21 |
def __contains__(self, key: object, /) -> bool: ... |
| 22 |
@overload |
| 23 |
def __getitem__(self, key: SupportsIndex, /) -> _T_co: ... |
| 24 |
@overload |
| 25 |
def __getitem__(self, key: slice, /) -> tuple[_T_co, ...]: ... |
| 26 |
def __iter__(self) -> Iterator[_T_co]: ... |
| 27 |
def __lt__(self, value: tuple[_T_co, ...], /) -> bool: ... |
| 28 |
def __le__(self, value: tuple[_T_co, ...], /) -> bool: ... |
| 29 |
def __gt__(self, value: tuple[_T_co, ...], /) -> bool: ... |
| 30 |
def __ge__(self, value: tuple[_T_co, ...], /) -> bool: ... |
| 31 |
def __eq__(self, value: object, /) -> bool: ... |
| 32 |
def __hash__(self) -> int: ... |
| 33 |
@overload |
| 34 |
def __add__(self, value: tuple[_T_co, ...], /) -> tuple[_T_co, ...]: ... |
| 35 |
@overload |
| 36 |
def __add__(self, value: tuple[_T, ...], /) -> tuple[_T_co | _T, ...]: ... |
| 37 |
def __mul__(self, value: SupportsIndex, /) -> tuple[_T_co, ...]: ... |
| 38 |
def __rmul__(self, value: SupportsIndex, /) -> tuple[_T_co, ...]: ... |
| 39 |
def count(self, value: Any, /) -> int: ... |
| 40 |
def index(self, value: Any, start: SupportsIndex = ..., stop: SupportsIndex = ..., /) -> int: ... |
| 41 |
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... |
| 42 |
|
| 43 |
class dict: pass |
| 44 |
class int: pass |
| 45 |
class slice: pass |
| 46 |
class bool(int): pass |
| 47 |
class str: pass # For convenience |
| 48 |
class object: pass |
| 49 |
class type: pass |
| 50 |
class ellipsis: pass |
| 51 |
class SupportsIndex(Protocol): |
| 52 |
def __index__(self) -> int: pass |
| 53 |
class list(Sequence[_T], Generic[_T]): |
| 54 |
@overload |
| 55 |
def __getitem__(self, i: int) -> _T: ... |
| 56 |
@overload |
| 57 |
def __getitem__(self, s: slice) -> list[_T]: ... |
| 58 |
def __contains__(self, item: object) -> bool: ... |
| 59 |
def __iter__(self) -> Iterator[_T]: ... |