File: struct.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (30 lines) | stat: -rw-r--r-- 874 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Stubs for struct

# Based on http://docs.python.org/3.2/library/struct.html

from typing import overload, Any, Tuple

class error(Exception): ...

def pack(fmt: str, *v: Any) -> bytes: ...
# TODO buffer type
def pack_into(fmt: str, buffer: Any, offset: int, *v: Any) -> None: ...

# TODO buffer type
def unpack(fmt: str, buffer: Any) -> Tuple[Any, ...]: ...
def unpack_from(fmt: str, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ...

def calcsize(fmt: str) -> int: ...

class Struct:
    format = b''
    size = 0

    def __init__(self, format: str) -> None: ...

    def pack(self, *v: Any) -> bytes: ...
    # TODO buffer type
    def pack_into(self, buffer: Any, offset: int, *v: Any) -> None: ...
    # TODO buffer type
    def unpack(self, buffer: Any) -> Tuple[Any, ...]: ...
    def unpack_from(self, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ...