dvpl-engine 0.1.1

DVPL file format engine for World of Tanks Blitz
Documentation
"""Type stubs for the dvpl_engine native module."""

COMP_NONE: int
"""No compression - payload stored as-is"""
COMP_LZ4: int
"""Standard LZ4 block compression"""
COMP_LZ4_HC: int
"""LZ4 high-compression mode (better ratio, slower compression)"""

class DvplError(ValueError):
    """Base error for all DVPL operations"""

    ...

class TooSmallError(DvplError):
    """Input shorter than 20 bytes (footer size)"""

    ...

class BadMagicError(DvplError):
    """Footer magic does not match b"DVPL" """

    ...

class SizeMismatchError(DvplError):
    """Payload length disagrees with footer"""

    ...

class CrcMismatchError(DvplError):
    """CRC32 of payload does not match footer checksum"""

    ...

class DecompressedSizeMismatchError(DvplError):
    """Decompressed output length disagrees with footer"""

    ...

class UnknownCompressionError(DvplError):
    """Unrecognized compression type value"""

    ...

class Lz4Error(DvplError):
    """Upstream lz4 error during compress/decompress"""

    ...

def decode(data: bytes) -> bytes:
    """Decode a DVPL-wrapped blob, verifying integrity.

    Parameters
    ----------
    data : bytes
        Raw contents of a ``.dvpl`` file (payload + 20-byte footer).

    Returns
    -------
    bytes
        Decompressed original payload.

    Raises
    ------
    DvplError
        On bad magic, CRC mismatch, size mismatch, or unknown compression.
    """
    ...

def encode(data: bytes, comp_type: int = 2) -> bytes:
    """Encode raw data into DVPL format.

    Parameters
    ----------
    data : bytes
        Uncompressed payload to wrap.
    comp_type : int
        Compression mode: ``COMP_NONE`` (0), ``COMP_LZ4`` (1),
        or ``COMP_LZ4_HC`` (2, default).

    Returns
    -------
    bytes
        DVPL blob (compressed payload + 20-byte footer).

    Raises
    ------
    UnknownCompressionError
        On unknown compression type.
    """
    ...