3 # Based on http://docs.python.org/3.2/library/struct.html
\r
4 # Based on http://docs.python.org/2/library/struct.html
\r
7 from typing import Any, Tuple, Text, Union, Iterator
\r
8 from array import array
\r
10 class error(Exception): ...
\r
12 _FmtType = Union[bytes, Text]
\r
13 if sys.version_info >= (3,):
\r
14 _BufferType = Union[bytes, bytearray, memoryview]
\r
15 _WriteBufferType = Union[array, bytearray, memoryview]
\r
17 _BufferType = Union[bytes, bytearray, buffer, memoryview]
\r
18 _WriteBufferType = Union[array[Any], bytearray, buffer, memoryview]
\r
20 def pack(fmt: _FmtType, *v: Any) -> bytes: ...
\r
21 def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
\r
22 def unpack(fmt: _FmtType, buffer: _BufferType) -> Tuple[Any, ...]: ...
\r
23 def unpack_from(fmt: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
\r
24 if sys.version_info >= (3, 4):
\r
25 def iter_unpack(fmt: _FmtType, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
\r
27 def calcsize(fmt: _FmtType) -> int: ...
\r
30 if sys.version_info >= (3, 7):
\r
34 size = ... # type: int
\r
36 def __init__(self, format: _FmtType) -> None: ...
\r
38 def pack(self, *v: Any) -> bytes: ...
\r
39 def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
\r
40 def unpack(self, buffer: _BufferType) -> Tuple[Any, ...]: ...
\r
41 def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...
\r
42 if sys.version_info >= (3, 4):
\r
43 def iter_unpack(self, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...
\r