Skip to content

Reference#

LZOCompressor #

Object containing the compressor state.

Thread safety

It is not allowed to pass instances of this class between threads.

Source code in python/lzallright/_lzallright.pyi
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class LZOCompressor:
    """Object containing the compressor state.

    Thread safety:
        It is not allowed to pass instances of this class between threads.
    """

    def compress(self, data: _BufferType) -> bytes:
        """Compresses data.

        Subsequent invocations of this method reuses the compression state.  In other
        words, the total output size doesn't change if you call this method using one
        big buffer or multiple small ones.

        Args:
            data (bytes): Any python object that implements the buffer protocol

        Note:
            The GIL (Global Interpreter Lock) is released for the duration of this
            function.
        """
    @staticmethod
    def decompress(data: _BufferType, output_size_hint: Optional[int] = None) -> bytes:
        """Decompresses data.

        Args:
            data (bytes): Any python object that implements the buffer protocol
            output_size_hint: Preallocate output buffer to this size.
                Helps reducing memory overhead if decompressed size is known in advance.

        Note:
            The GIL (Global Interpreter Lock) is released for the duration of this
            function.
        """

compress #

compress(data)

Compresses data.

Subsequent invocations of this method reuses the compression state. In other words, the total output size doesn't change if you call this method using one big buffer or multiple small ones.

Parameters:

Name Type Description Default
data bytes

Any python object that implements the buffer protocol

required
Note

The GIL (Global Interpreter Lock) is released for the duration of this function.

Source code in python/lzallright/_lzallright.pyi
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def compress(self, data: _BufferType) -> bytes:
    """Compresses data.

    Subsequent invocations of this method reuses the compression state.  In other
    words, the total output size doesn't change if you call this method using one
    big buffer or multiple small ones.

    Args:
        data (bytes): Any python object that implements the buffer protocol

    Note:
        The GIL (Global Interpreter Lock) is released for the duration of this
        function.
    """

decompress staticmethod #

decompress(data, output_size_hint=None)

Decompresses data.

Parameters:

Name Type Description Default
data bytes

Any python object that implements the buffer protocol

required
output_size_hint Optional[int]

Preallocate output buffer to this size. Helps reducing memory overhead if decompressed size is known in advance.

None
Note

The GIL (Global Interpreter Lock) is released for the duration of this function.

Source code in python/lzallright/_lzallright.pyi
32
33
34
35
36
37
38
39
40
41
42
43
44
@staticmethod
def decompress(data: _BufferType, output_size_hint: Optional[int] = None) -> bytes:
    """Decompresses data.

    Args:
        data (bytes): Any python object that implements the buffer protocol
        output_size_hint: Preallocate output buffer to this size.
            Helps reducing memory overhead if decompressed size is known in advance.

    Note:
        The GIL (Global Interpreter Lock) is released for the duration of this
        function.
    """

EResult #

Error codes in LZOError.args[0].

Source code in python/lzallright/_lzallright.pyi
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class EResult:
    """Error codes in [`LZOError.args[0]`][lzallright._lzallright.LZOError.args]."""

    LookbehindOverrun = ...
    "Invalid input"
    OutputOverrun = ...
    """Buffer is not long enough to hold output.

    Warning:
        lzallright always tries to find the appropriate buffer size.
        If you see this, it is an error.
    """
    InputOverrun = ...
    "Input to decompress is truncated"
    Error = ...
    "Other error occurred"
    InputNotConsumed = ...
    "See [`InputNotConsumed`][lzallright._lzallright.InputNotConsumed]"

LookbehindOverrun instance-attribute class-attribute #

LookbehindOverrun = Ellipsis

Invalid input

OutputOverrun instance-attribute class-attribute #

OutputOverrun = Ellipsis

Buffer is not long enough to hold output.

Warning

lzallright always tries to find the appropriate buffer size. If you see this, it is an error.

InputOverrun instance-attribute class-attribute #

InputOverrun = Ellipsis

Input to decompress is truncated

Error instance-attribute class-attribute #

Error = Ellipsis

Other error occurred

InputNotConsumed instance-attribute class-attribute #

InputNotConsumed = Ellipsis

LZOError #

Bases: Exception

Fatal error during compression/decompression.

Source code in python/lzallright/_lzallright.pyi
65
66
67
68
69
70
71
class LZOError(Exception):
    """Fatal error during compression/decompression."""

    args: Tuple[EResult]
    """Error reason.

    See [`EResult`][lzallright._lzallright.EResult]"""

args instance-attribute #

args: Tuple[EResult]

Error reason.

See EResult

InputNotConsumed #

Bases: LZOError

Decompression finished with leftover data.

Source code in python/lzallright/_lzallright.pyi
73
74
75
76
77
78
79
80
class InputNotConsumed(LZOError):  # noqa: N818
    """Decompression finished with leftover data."""

    args: Tuple[EResult, bytes]  # type: ignore[assignment]
    """Error reason, with decompressed data

    ``(EResult.InputNotConsumed, decompressed: bytes)``
    """

args instance-attribute #

args: Tuple[EResult, bytes]

Error reason, with decompressed data

(EResult.InputNotConsumed, decompressed: bytes)