| 1 | from collections.abc import Callable, Sequence |
| 2 | from typing import TypeVar |
| 3 | |
| 4 | __all__ = ["Error", "Packer", "Unpacker", "ConversionError"] |
| 5 | |
| 6 | _T = TypeVar("_T") |
| 7 | |
| 8 | class Error(Exception): |
| 9 | msg: str |
| 10 | def __init__(self, msg: str) -> None: ... |
| 11 | |
| 12 | class ConversionError(Error): ... |
| 13 | |
| 14 | class Packer: |
| 15 | def reset(self) -> None: ... |
| 16 | def get_buffer(self) -> bytes: ... |
| 17 | def get_buf(self) -> bytes: ... |
| 18 | def pack_uint(self, x: int) -> None: ... |
| 19 | def pack_int(self, x: int) -> None: ... |
| 20 | def pack_enum(self, x: int) -> None: ... |
| 21 | def pack_bool(self, x: bool) -> None: ... |
| 22 | def pack_uhyper(self, x: int) -> None: ... |
| 23 | def pack_hyper(self, x: int) -> None: ... |
| 24 | def pack_float(self, x: float) -> None: ... |
| 25 | def pack_double(self, x: float) -> None: ... |
| 26 | def pack_fstring(self, n: int, s: bytes) -> None: ... |
| 27 | def pack_fopaque(self, n: int, s: bytes) -> None: ... |
| 28 | def pack_string(self, s: bytes) -> None: ... |
| 29 | def pack_opaque(self, s: bytes) -> None: ... |
| 30 | def pack_bytes(self, s: bytes) -> None: ... |
| 31 | def pack_list(self, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... |
| 32 | def pack_farray(self, n: int, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... |
| 33 | def pack_array(self, list: Sequence[_T], pack_item: Callable[[_T], object]) -> None: ... |
| 34 | |
| 35 | class Unpacker: |
| 36 | def __init__(self, data: bytes) -> None: ... |
| 37 | def reset(self, data: bytes) -> None: ... |
| 38 | def get_position(self) -> int: ... |
| 39 | def set_position(self, position: int) -> None: ... |
| 40 | def get_buffer(self) -> bytes: ... |
| 41 | def done(self) -> None: ... |
| 42 | def unpack_uint(self) -> int: ... |
| 43 | def unpack_int(self) -> int: ... |
| 44 | def unpack_enum(self) -> int: ... |
| 45 | def unpack_bool(self) -> bool: ... |
| 46 | def unpack_uhyper(self) -> int: ... |
| 47 | def unpack_hyper(self) -> int: ... |
| 48 | def unpack_float(self) -> float: ... |
| 49 | def unpack_double(self) -> float: ... |
| 50 | def unpack_fstring(self, n: int) -> bytes: ... |
| 51 | def unpack_fopaque(self, n: int) -> bytes: ... |
| 52 | def unpack_string(self) -> bytes: ... |
| 53 | def unpack_opaque(self) -> bytes: ... |
| 54 | def unpack_bytes(self) -> bytes: ... |
| 55 | def unpack_list(self, unpack_item: Callable[[], _T]) -> list[_T]: ... |
| 56 | def unpack_farray(self, n: int, unpack_item: Callable[[], _T]) -> list[_T]: ... |
| 57 | def unpack_array(self, unpack_item: Callable[[], _T]) -> list[_T]: ... |