massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / struct.pyi
1 # Stubs for struct\r
2 \r
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
5 \r
6 import sys\r
7 from typing import Any, Tuple, Text, Union, Iterator\r
8 from array import array\r
9 \r
10 class error(Exception): ...\r
11 \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
16 else:\r
17     _BufferType = Union[bytes, bytearray, buffer, memoryview]\r
18     _WriteBufferType = Union[array[Any], bytearray, buffer, memoryview]\r
19 \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
26 \r
27 def calcsize(fmt: _FmtType) -> int: ...\r
28 \r
29 class Struct:\r
30     if sys.version_info >= (3, 7):\r
31         format: str\r
32     else:\r
33         format: bytes\r
34     size = ...  # type: int\r
35 \r
36     def __init__(self, format: _FmtType) -> None: ...\r
37 \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