Format: application/octet-stream
⬇ Download File (1.5 KB)
   1  import sys
   2  from array import array
   3  from mmap import mmap
   4  from typing import Any, Iterator, Text, Tuple, Union
   5  
   6  class error(Exception): ...
   7  
   8  _FmtType = Union[bytes, Text]
   9  if sys.version_info >= (3,):
  10      _BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
  11      _WriteBufferType = Union[array, bytearray, memoryview, mmap]
  12  else:
  13      _BufferType = Union[array[int], bytes, bytearray, buffer, memoryview, mmap]
  14      _WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap]
  15  
  16  def pack(fmt: _FmtType, *v: Any) -> bytes: ...
  17  def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
  18  def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ...
  19  def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
  20  
  21  if sys.version_info >= (3, 4):
  22      def iter_unpack(__format: _FmtType, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
  23  
  24  def calcsize(__format: _FmtType) -> int: ...
  25  
  26  class Struct:
  27      if sys.version_info >= (3, 7):
  28          format: str
  29      else:
  30          format: bytes
  31      size: int
  32      def __init__(self, format: _FmtType) -> None: ...
  33      def pack(self, *v: Any) -> bytes: ...
  34      def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
  35      def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ...
  36      def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
  37      if sys.version_info >= (3, 4):
  38          def iter_unpack(self, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
  39