diff --git a/builtins/2.7/array.pyi b/builtins/2.7/array.pyi index 2fd03535a..e0ea9a83a 100644 --- a/builtins/2.7/array.pyi +++ b/builtins/2.7/array.pyi @@ -1,56 +1,55 @@ """Stub file for the 'array' module.""" -# This is an autogenerated file. It serves as a starting point -# for a more precise manual annotation of this module. -# Feel free to edit the source below, but remove this header when you do. -from typing import Any, List, Tuple, Dict, Generic +from typing import Any, Generic, IO, Iterable, Sequence, TypeVar, Union, overload -class array(object): - def __copy__(self) -> Any: ... - def __deepcopy__(self, *args, **kwargs) -> Any: ... - def __reduce__(self) -> tuple: - raise AttributeError() - def __sizeof__(self) -> long: ... - def append(self, *args, **kwargs) -> None: ... - def buffer_info(self) -> tuple: ... +T = TypeVar('T') + +class array(Generic[T]): + def __init__(self, typecode: str, init: Iterable[T] = ...) -> None: ... + def __add__(self, y: "array[T]") -> "array[T]": ... + def __contains__(self, y: Any) -> bool: ... + def __copy__(self) -> "array[T]": ... + def __deepcopy__(self) -> "array": ... + def __delitem__(self, y: Union[slice, int]) -> None: ... + def __delslice__(self, i: int, j: int) -> None: ... + @overload + def __getitem__(self, i: int) -> Any: ... + @overload + def __getitem__(self, s: slice) -> "array": ... + def __iadd__(self, y: "array[T]") -> "array[T]": ... + def __imul__(self, y: int) -> "array[T]": ... + def __iter__(self) -> Iterator[T]: ... + def __len__(self) -> int: ... + def __mul__(self, n: int) -> "array[T]": ... + def __rmul__(self, n: int) -> "array[T]": ... + @overload + def __setitem__(self, i: int, y: T) -> None: ... + @overload + def __setitem__(self, i: slice, y: "array[T]") -> None: ... + + def append(self, x: T) -> None: ... + def buffer_info(self) -> Tuple[int, int]: ... def byteswap(self) -> None: raise RuntimeError() - def count(self, *args, **kwargs) -> int: ... - def extend(self, *args, **kwargs) -> None: ... - def fromfile(self, a, b: int) -> None: + def count(self) -> int: ... + def extend(self, x: Sequence[T]) -> None: ... + def fromlist(self, list: List[T]) -> None: raise EOFError() raise IOError() - raise MemoryError() - raise TypeError() - def fromlist(self, *args, **kwargs) -> None: - raise MemoryError() - raise TypeError() - def fromstring(self, a) -> None: - raise MemoryError() - raise ValueError() - def fromunicode(self, a: str) -> None: - raise MemoryError() - raise ValueError() - def index(self, *args, **kwargs) -> int: - raise ValueError() - def insert(self, a: int, b) -> None: ... - def pop(self, *args, **kwargs) -> Any: - raise IndexError() - def read(self, *args, **kwargs) -> None: + def fromfile(self, f: BinaryIO, n: int) -> None: ... + def fromstring(self, s: str) -> None: ... + def fromunicode(self, u: unicode) -> None: ... + def index(self, x: T) -> int: ... + def insert(self, i: int, x: T) -> None: ... + def pop(self, i: int = ...) -> T: ... + def read(self, f: file, n: int) -> None: raise DeprecationWarning() - def remove(self, *args, **kwargs) -> None: - raise ValueError() + def remove(self, x: T) -> None: ... def reverse(self) -> None: ... - def tofile(self, *args, **kwargs) -> None: + def tofile(self, f: BinaryIO) -> None: raise IOError() - raise TypeError() - def tolist(self) -> list: ... - def tostring(self) -> str: - raise MemoryError() - def tounicode(self) -> unicode: - raise ValueError() - def write(self, *args, **kwargs) -> None: + def tolist(self) -> List[T]: ... + def tostring(self) -> str: ... + def tounicode(self) -> unicode: ... + def write(self, f: file) -> None: raise DeprecationWarning() - -class arrayiterator(object): - pass