Merge v2 and v3 array stubs (#1670)

See #1608
This commit is contained in:
hashstat
2017-10-25 09:46:25 -07:00
committed by Matthias Kramm
parent 37f1bf54a5
commit c366a1be55
2 changed files with 18 additions and 60 deletions

View File

@@ -1,56 +0,0 @@
"""Stub file for the 'array' module."""
from typing import (Any, Generic, IO, Iterable, Sequence, TypeVar,
Union, overload, Iterator, Tuple, BinaryIO, List)
_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) -> int: ...
def extend(self, x: Sequence[_T]) -> None: ...
def fromlist(self, list: List[_T]) -> None:
raise EOFError()
raise IOError()
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: IO[str], n: int) -> None:
raise DeprecationWarning()
def remove(self, x: _T) -> None: ...
def reverse(self) -> None: ...
def tofile(self, f: BinaryIO) -> None:
raise IOError()
def tolist(self) -> List[_T]: ...
def tostring(self) -> str: ...
def tounicode(self) -> unicode: ...
def write(self, f: IO[str]) -> None:
raise DeprecationWarning()

View File

@@ -1,13 +1,15 @@
# Stubs for array
# Based on http://docs.python.org/3.2/library/array.html
# Based on http://docs.python.org/3.6/library/array.html
import sys
from typing import (Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence,
overload, Text, Tuple, TypeVar, Union)
_T = TypeVar('_T', int, float, Text)
typecodes = ... # type: str
if sys.version_info >= (3,):
typecodes = ... # type: str
class array(MutableSequence[_T], Generic[_T]):
typecode = ... # type: str
@@ -19,7 +21,8 @@ class array(MutableSequence[_T], Generic[_T]):
def byteswap(self) -> None: ...
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def frombytes(self, s: bytes) -> None: ...
if sys.version_info >= (3, 2):
def frombytes(self, s: bytes) -> None: ...
def fromfile(self, f: BinaryIO, n: int) -> None: ...
def fromlist(self, list: List[_T]) -> None: ...
def fromstring(self, s: bytes) -> None: ...
@@ -27,13 +30,18 @@ class array(MutableSequence[_T], Generic[_T]):
def index(self, x: _T) -> int: ... # type: ignore # Overrides Sequence
def insert(self, i: int, x: _T) -> None: ...
def pop(self, i: int = ...) -> _T: ...
if sys.version_info < (3,):
def read(self, f: BinaryIO, n: int) -> None: ...
def remove(self, x: Any) -> None: ...
def reverse(self) -> None: ...
def tobytes(self) -> bytes: ...
if sys.version_info >= (3, 2):
def tobytes(self) -> bytes: ...
def tofile(self, f: BinaryIO) -> None: ...
def tolist(self) -> List[_T]: ...
def tostring(self) -> bytes: ...
def tounicode(self) -> str: ...
if sys.version_info < (3,):
def write(self, f: BinaryIO) -> None: ...
def __len__(self) -> int: ...
@@ -57,3 +65,9 @@ class array(MutableSequence[_T], Generic[_T]):
def __lt__(self, other: array[_T]) -> bool: ...
def __mul__(self, n: int) -> array[_T]: ...
def __rmul__(self, n: int) -> array[_T]: ...
if sys.version_info < (3,):
def __delslice__(self, i: int, j: int) -> None: ...
def __getslice__(self, i: int, j: int) -> array[_T]: ...
def __setslice__(self, i: int, j: int, y: array[_T]) -> None: ...
ArrayType = array