Format: application/octet-stream
⬇ Download File (3.4 KB)
   1  import sys
   2  from typing import Any, BinaryIO, Generic, Iterable, List, MutableSequence, Text, Tuple, TypeVar, Union, overload
   3  from typing_extensions import Literal
   4  
   5  _IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
   6  _FloatTypeCode = Literal["f", "d"]
   7  _UnicodeTypeCode = Literal["u"]
   8  _TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
   9  
  10  _T = TypeVar("_T", int, float, Text)
  11  
  12  if sys.version_info >= (3,):
  13      typecodes: str
  14  
  15  class array(MutableSequence[_T], Generic[_T]):
  16      typecode: _TypeCode
  17      itemsize: int
  18      @overload
  19      def __init__(self: array[int], typecode: _IntTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
  20      @overload
  21      def __init__(self: array[float], typecode: _FloatTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
  22      @overload
  23      def __init__(self: array[Text], typecode: _UnicodeTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
  24      @overload
  25      def __init__(self, typecode: str, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
  26      def append(self, __v: _T) -> None: ...
  27      def buffer_info(self) -> Tuple[int, int]: ...
  28      def byteswap(self) -> None: ...
  29      def count(self, __v: Any) -> int: ...
  30      def extend(self, __bb: Iterable[_T]) -> None: ...
  31      if sys.version_info >= (3, 2):
  32          def frombytes(self, __buffer: bytes) -> None: ...
  33      def fromfile(self, __f: BinaryIO, __n: int) -> None: ...
  34      def fromlist(self, __list: List[_T]) -> None: ...
  35      def fromunicode(self, __ustr: str) -> None: ...
  36      def index(self, __v: _T) -> int: ...  # type: ignore  # Overrides Sequence
  37      def insert(self, __i: int, __v: _T) -> None: ...
  38      def pop(self, __i: int = ...) -> _T: ...
  39      if sys.version_info < (3,):
  40          def read(self, f: BinaryIO, n: int) -> None: ...
  41      def remove(self, __v: Any) -> None: ...
  42      def reverse(self) -> None: ...
  43      if sys.version_info >= (3, 2):
  44          def tobytes(self) -> bytes: ...
  45      def tofile(self, __f: BinaryIO) -> None: ...
  46      def tolist(self) -> List[_T]: ...
  47      def tounicode(self) -> str: ...
  48      if sys.version_info < (3,):
  49          def write(self, f: BinaryIO) -> None: ...
  50      if sys.version_info < (3, 9):
  51          def fromstring(self, __buffer: bytes) -> None: ...
  52          def tostring(self) -> bytes: ...
  53      def __len__(self) -> int: ...
  54      @overload
  55      def __getitem__(self, i: int) -> _T: ...
  56      @overload
  57      def __getitem__(self, s: slice) -> array[_T]: ...
  58      @overload  # type: ignore  # Overrides MutableSequence
  59      def __setitem__(self, i: int, o: _T) -> None: ...
  60      @overload
  61      def __setitem__(self, s: slice, o: array[_T]) -> None: ...
  62      def __delitem__(self, i: Union[int, slice]) -> None: ...
  63      def __add__(self, x: array[_T]) -> array[_T]: ...
  64      def __ge__(self, other: array[_T]) -> bool: ...
  65      def __gt__(self, other: array[_T]) -> bool: ...
  66      def __iadd__(self, x: array[_T]) -> array[_T]: ...  # type: ignore  # Overrides MutableSequence
  67      def __imul__(self, n: int) -> array[_T]: ...
  68      def __le__(self, other: array[_T]) -> bool: ...
  69      def __lt__(self, other: array[_T]) -> bool: ...
  70      def __mul__(self, n: int) -> array[_T]: ...
  71      def __rmul__(self, n: int) -> array[_T]: ...
  72      if sys.version_info < (3,):
  73          def __delslice__(self, i: int, j: int) -> None: ...
  74          def __getslice__(self, i: int, j: int) -> array[_T]: ...
  75          def __setslice__(self, i: int, j: int, y: array[_T]) -> None: ...
  76  
  77  ArrayType = array
  78