diff --git a/stdlib/2.7/__builtin__.pyi b/stdlib/2.7/__builtin__.pyi index 901cb6584..c81ddb68c 100644 --- a/stdlib/2.7/__builtin__.pyi +++ b/stdlib/2.7/__builtin__.pyi @@ -8,7 +8,7 @@ from typing import ( Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set, AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping, - MutableSet, ItemsView, KeysView, ValuesView + MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, ) from abc import abstractmethod, ABCMeta @@ -705,7 +705,6 @@ def map(func: Callable[[_T1, _T2], _S], def max(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = None) -> _T: ... @overload def max(iterable: Iterable[_T], key: Callable[[_T], Any] = None) -> _T: ... -# TODO memoryview @overload def min(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = None) -> _T: ... @overload @@ -801,6 +800,36 @@ class buffer(Sized): def __len__(self) -> int: ... def __mul__(self, x: int) -> str: ... +class memoryview(Sized, Container[bytes]): + format = ... # type: str + itemsize = ... # type: int + shape = ... # type: Optional[Tuple[int, ...]] + strides = ... # type: Optional[Tuple[int, ...]] + suboffsets = ... # type: Optional[Tuple[int, ...]] + readonly = ... # type: bool + ndim = ... # type: int + + def __init__(self, obj: Union[str, bytearray, buffer, memoryview]) -> None: ... + + @overload + def __getitem__(self, i: int) -> bytes: ... + @overload + def __getitem__(self, s: slice) -> memoryview: ... + + def __contains__(self, x: object) -> bool: ... + def __iter__(self) -> Iterator[bytes]: ... + def __len__(self) -> int: ... + + @overload + def __setitem__(self, i: int, o: bytes) -> None: ... + @overload + def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ... + @overload + def __setitem__(self, s: slice, o: memoryview) -> None: ... + + def tobytes(self) -> bytes: ... + def tolist(self) -> List[int]: ... + class BaseException: args = ... # type: Any message = ... # type: str