### compress method implementation Source: https://vlaci.github.io/lzallright/api Implementation of the compress method. It compresses data, reusing the compression state. The GIL is released during execution. ```python 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. """ ``` -------------------------------- ### LZOCompressor.compress Source: https://vlaci.github.io/lzallright/api Compresses data using the LZO algorithm. The compression state is reused across calls, so the total output size is consistent regardless of input chunking. ```APIDOC ## LZOCompressor.compress ### Description Compresses data. Subsequent invocations of this method reuse the compression state, so the total output size doesn't change if you call this method using one big buffer or multiple small ones. ### Method compress ### Parameters - **data** (bytes) - Required - Any python object that implements the buffer protocol ### Note The GIL (Global Interpreter Lock) is released for the duration of this function. ### Returns bytes - The compressed data. ``` -------------------------------- ### decompress method implementation Source: https://vlaci.github.io/lzallright/api Implementation of the decompress static method. It decompresses data, optionally preallocating the output buffer. The GIL is released during execution. ```python @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. """ ``` -------------------------------- ### OutputOverrun attribute Source: https://vlaci.github.io/lzallright/api Error code indicating the buffer is not long enough to hold output. lzallright always tries to find the appropriate buffer size, so seeing this is an error. ```python OutputOverrun = ... ``` -------------------------------- ### InputOverrun attribute Source: https://vlaci.github.io/lzallright/api Error code indicating input to decompress is truncated. ```python InputOverrun = ... ``` -------------------------------- ### LookbehindOverrun attribute Source: https://vlaci.github.io/lzallright/api Error code indicating invalid input. ```python LookbehindOverrun = ... ``` -------------------------------- ### InputNotConsumed exception class Source: https://vlaci.github.io/lzallright/api Defines the InputNotConsumed exception class, which inherits from LZOError. It overrides the args attribute to include decompressed data as bytes. ```python 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)`` """ ``` -------------------------------- ### compress method signature Source: https://vlaci.github.io/lzallright/api Signature of the compress method. It compresses data, reusing the compression state across calls. The GIL is released during execution. ```python compress(data) ``` -------------------------------- ### LZOCompressor.decompress Source: https://vlaci.github.io/lzallright/api Decompresses data using the LZO algorithm. This is a static method that can be called without an instance. ```APIDOC ## LZOCompressor.decompress ### Description Decompresses data. This is a static method that can be called without an instance. ### Method decompress ### Parameters - **data** (bytes) - Required - Any python object that implements the buffer protocol - **output_size_hint** (Optional[int]) - Optional - 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. ### Returns bytes - The decompressed data. ``` -------------------------------- ### InputNotConsumed exception alias Source: https://vlaci.github.io/lzallright/api Defines the InputNotConsumed exception as an alias. The ellipsis indicates that the actual implementation is not shown. ```python InputNotConsumed = ... ``` -------------------------------- ### decompress method signature Source: https://vlaci.github.io/lzallright/api Signature of the decompress static method. It decompresses data, optionally preallocating the output buffer. The GIL is released during execution. ```python decompress(data, output_size_hint=None) ``` -------------------------------- ### LZOCompressor class definition Source: https://vlaci.github.io/lzallright/api Defines the LZOCompressor class with compress and decompress methods. The class is not thread-safe. The GIL is released during compression and decompression. ```python 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. """ ``` -------------------------------- ### EResult class definition Source: https://vlaci.github.io/lzallright/api Defines the EResult class with error codes used in LZOError.args[0]. Includes LookbehindOverrun, OutputOverrun, InputOverrun, Error, and InputNotConsumed. ```python 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]" ``` -------------------------------- ### Error exception alias Source: https://vlaci.github.io/lzallright/api Defines the Error exception as an alias. The ellipsis indicates that the actual implementation is not shown. ```python Error = ... ``` -------------------------------- ### LZOError args attribute Source: https://vlaci.github.io/lzallright/api Declares the args instance attribute for LZOError. It holds the error reason as a tuple of EResult values. ```python args ``` -------------------------------- ### LZOError exception class Source: https://vlaci.github.io/lzallright/api Defines the LZOError exception class, which inherits from Exception. It includes an args attribute of type Tuple[EResult] that holds the error reason. ```python class LZOError(Exception): """Fatal error during compression/decompression.""" args: Tuple[EResult] """Error reason. See [`EResult`][lzallright._lzallright.EResult]""" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.