--- /dev/null
+# Stubs for struct\r
+\r
+# Based on http://docs.python.org/3.2/library/struct.html\r
+# Based on http://docs.python.org/2/library/struct.html\r
+\r
+import sys\r
+from typing import Any, Tuple, Text, Union, Iterator\r
+from array import array\r
+\r
+class error(Exception): ...\r
+\r
+_FmtType = Union[bytes, Text]\r
+if sys.version_info >= (3,):\r
+ _BufferType = Union[bytes, bytearray, memoryview]\r
+ _WriteBufferType = Union[array, bytearray, memoryview]\r
+else:\r
+ _BufferType = Union[bytes, bytearray, buffer, memoryview]\r
+ _WriteBufferType = Union[array[Any], bytearray, buffer, memoryview]\r
+\r
+def pack(fmt: _FmtType, *v: Any) -> bytes: ...\r
+def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...\r
+def unpack(fmt: _FmtType, buffer: _BufferType) -> Tuple[Any, ...]: ...\r
+def unpack_from(fmt: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...\r
+if sys.version_info >= (3, 4):\r
+ def iter_unpack(fmt: _FmtType, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...\r
+\r
+def calcsize(fmt: _FmtType) -> int: ...\r
+\r
+class Struct:\r
+ if sys.version_info >= (3, 7):\r
+ format: str\r
+ else:\r
+ format: bytes\r
+ size = ... # type: int\r
+\r
+ def __init__(self, format: _FmtType) -> None: ...\r
+\r
+ def pack(self, *v: Any) -> bytes: ...\r
+ def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...\r
+ def unpack(self, buffer: _BufferType) -> Tuple[Any, ...]: ...\r
+ def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ...\r
+ if sys.version_info >= (3, 4):\r
+ def iter_unpack(self, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ...\r