### Install pyppmd using pip Source: https://pyppmd.readthedocs.io/en/latest/getting_started.html Use this command to install the pyppmd library from PyPI. The installation process automatically selects the appropriate wheel for CPython or PyPy. ```bash pip install pyppmd ``` -------------------------------- ### Install pyppmd using pip Source: https://pyppmd.readthedocs.io/en/latest/_sources/getting_started.rst.txt Use this command to install the pyppmd library from PyPI. The installation process automatically selects the appropriate wheel based on your Python implementation (CPython or PyPy). ```console pip install pyppmd ``` -------------------------------- ### Library Build with CMake Source: https://pyppmd.readthedocs.io/en/latest/contribution.html Compile the C files into a static library file named 'pyppmd' using CMake. ```bash cd cmake-build make pyppmd ``` -------------------------------- ### Initialize Streaming Compressor Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Instantiate `PpmdCompressor` for processing data in chunks. The `restore_method` parameter is relevant only when the 'I' variant is used. ```python c = PpmdCompressor() ``` -------------------------------- ### PpmdDecompressor Initialization Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Initializes a PpmdDecompressor object with specified parameters for the PPMd algorithm. ```APIDOC ## __init__ ### Description Initialize a PpmdDecompressor object. ### Parameters #### Path Parameters - **max_order** (int) - Required - maximum order of PPMd algorithm - **mem_size** (int) - Required - memory size used for building PPMd model - **variant** (str) - Required - PPMd variant name, only accept "H" or "I" - **restore_method** (int) - Required - PPMD8_RESTORE_METHOD_RESTART(0) or PPMD8_RESTORE_METHOD_CUTOFF(1) ``` -------------------------------- ### Initialize Streaming Decompressor Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Instantiate `PpmdDecompressor` for decompressing data in chunks. The `restore_method` parameter is relevant only when the 'I' variant is used. ```python d = PpmdDecompressor() ``` -------------------------------- ### Manual Build and Run with GDB Source: https://pyppmd.readthedocs.io/en/latest/contribution.html Steps to manually build and run the pytest runner under a C/C++ debugger (GDB). This is useful for debugging C bindings. ```bash mkdir cmake-build cd cmake-build cmake .. make pytest_runner gdb ./pytest_runner ../tests ``` -------------------------------- ### compress() Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Compresses the provided data using the PPMd algorithm with specified parameters. It can handle both bytes-like objects and strings (which are UTF-8 encoded before compression). ```APIDOC ## compress() ### Description Compresses the provided data using the PPMd algorithm with specified parameters. It can handle both bytes-like objects and strings (which are UTF-8 encoded before compression). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **bytes_or_str** (Union[bytes, bytearray, memoryview, str]) - Required - Data to be compressed. When it is type of str, encoded with “UTF-8” encoding before compress. - **max_order** (int) - Required - maximum order of PPMd algorithm - **mem_size** (int) - Required - memory size used for building PPMd model - **variant** (str) - Required - PPMd variant name, only accept “H” or “I” ### Request Example ```python compressed_data = compress(data) ``` ### Response #### Success Response (200) - **bytes** - Compressed data #### Response Example ```python compressed_data ``` ``` -------------------------------- ### Run Pytest with Tox Source: https://pyppmd.readthedocs.io/en/latest/contribution.html Execute the pytest suite using Tox for a specific Python version (e.g., py38). ```bash tox -e py38 ``` -------------------------------- ### Streaming Compression Operations Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Use the `compress` method to feed data into the compressor and `flush` to retrieve any remaining compressed data. The compressor cannot be reused after flushing. ```python dat1 = c.compress(b'123456') dat2 = c.compress(b'abcdef') dat3 = c.flush() ``` -------------------------------- ### compress Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Compresses data using the PPMd algorithm. Supports both bytes-like objects and strings (which are UTF-8 encoded before compression). ```APIDOC ## compress ### Description Compresses data using the PPMd algorithm. Supports both bytes-like objects and strings (which are UTF-8 encoded before compression). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **bytes_or_str** (Union[bytes, bytearray, memoryview, str]) - Data to be compressed. When it is type of str, encoded with "UTF-8" encoding before compress. - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **variant** (str) - PPMd variant name, only accept "H" or "I" ### Returns - **bytes** - Compressed data ### Example ```python compressed_data = compress(data) ``` ``` -------------------------------- ### Compress Data Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Use the `compress` function for simple, in-memory compression of data. It supports both bytes and string inputs, automatically encoding strings to UTF-8. ```python compressed_data = compress(data) ``` -------------------------------- ### Streaming Compression with PpmdCompressor Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Utilize `PpmdCompressor` for streaming compression. Compress data in chunks using the `compress` method and finalize with `flush`. The compressor cannot be reused after flushing. ```python c = PpmdCompressor() dat1 = c.compress(b'123456') dat2 = c.compress(b'abcdef') dat3 = c.flush() ``` -------------------------------- ### decompress() Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Decompresses the provided data and returns it as bytes. This function is suitable for binary data decompression. ```APIDOC ## decompress() ### Description Decompresses the provided data and returns it as bytes. This function is suitable for binary data decompression. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **data** (Union[bytes, memoryview]) - Required - Data to be decompressed - **max_order** (int) - Required - maximum order of PPMd algorithm - **mem_size** (int) - Required - memory size used for building PPMd model - **variant** (str) - Required - PPMd variant name, only accept “H” or “I” ### Request Example ```python decompressed_data = decompress(data) ``` ### Response #### Success Response (200) - **bytes** - Decompressed data #### Response Example ```python decompressed_data ``` ### Error Handling - **PpmdError** - If decompression fails. ``` -------------------------------- ### Built-in Functions Source: https://pyppmd.readthedocs.io/en/latest/genindex.html Provides high-level functions for compression and decompression. ```APIDOC ## Built-in Functions ### compress() Compresses data. ### decompress() Decompresses data. ### decompress_str() Decompresses data to a string. ``` -------------------------------- ### Decompress Data in Chunks Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Use this pattern to decompress data that is split into multiple parts. Ensure all parts are processed sequentially. ```python d1 = PpmdDecompressor() decompressed_dat = d1.decompress(dat1) decompressed_dat += d1.decompress(dat2) decompressed_dat += d1.decompress(dat3) ``` -------------------------------- ### decompress Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Decompresses data and returns it as bytes. Raises PpmdError if decompression fails. ```APIDOC ## decompress ### Description Decompresses data and returns it as bytes. Raises PpmdError if decompression fails. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **data** (Union[bytes, memoryview]) - Data to be decompressed. - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **variant** (str) - PPMd variant name, only accept "H" or "I" ### Returns - **bytes** - Decompressed data ### Raises - **PpmdError** - If decompression fails. ### Example ```python decompressed_data = decompress(data) ``` ``` -------------------------------- ### decompress_str() Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Decompresses the provided data and returns it as a string. Allows specifying the encoding for decoding the raw decompressed data, defaulting to UTF-8 if not provided. ```APIDOC ## decompress_str() ### Description Decompresses the provided data and returns it as a string. Allows specifying the encoding for decoding the raw decompressed data, defaulting to UTF-8 if not provided. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **data** (Union[bytes, memoryview]) - Required - Data to be decompressed. - **max_order** (int) - Required - maximum order of PPMd algorithm - **mem_size** (int) - Required - memory size used for building PPMd model - **encoding** (str) - Required - Encoding name to use when decoding raw decompressed data - **variant** (str) - Required - PPMd variant name, only accept “H” or “I” ### Request Example ```python decompressed_text = decompress_str(data) ``` ### Response #### Success Response (200) - **str** - Decompressed text #### Response Example ```python decompressed_text ``` ### Error Handling - **PpmdError** - If decompression fails. ``` -------------------------------- ### Set Python Version in CMakeLists.txt Source: https://pyppmd.readthedocs.io/en/latest/contribution.html Edit these lines in CMakeLists.txt to change the target Python variation and version for C bindings development. ```cmake set(PY_VERSION 3.8) set(Python_FIND_IMPLEMENTATIONS PyPy) ``` -------------------------------- ### PpmdCompressor Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for performing compression operations. ```APIDOC ## PpmdCompressor Class ### __init__() Initializes a PpmdCompressor object. ### compress() Compresses data using the PpmdCompressor. ### flush() Flushes any remaining compressed data. ``` -------------------------------- ### PpmdDecompressor Attributes Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Provides information about the state of the decompressor, such as whether more input is needed, if the end of the frame is reached, or if there is unused data. ```APIDOC ## PpmdDecompressor Attributes ### Description These attributes provide insights into the decompressor's current state, useful for managing complex decompression scenarios. ### Attributes #### `needs_input` - **Type**: bool - **Description**: If the `max_length` limit in `decompress` has been reached and the decompressor has unconsumed input, this is set to `False`. Passing `b''` to `decompress` may yield more data. It can be `True` even if all input is consumed. #### `eof` - **Type**: bool - **Description**: `True` if the end of the first frame has been reached. Decompressing further will raise an `EOFError`. This can be `False` even if all input is consumed. #### `unused_data` - **Type**: bytes - **Description**: Input data remaining after the end mark of the first frame. If no data remains after the end mark, this will be `b''`. ``` -------------------------------- ### PpmdCompressor Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html A streaming compressor class that allows data to be compressed in chunks. It is thread-safe at the method level. ```APIDOC ## PpmdCompressor ### Description A streaming compressor class that allows data to be compressed in chunks. It is thread-safe at the method level. ### Methods #### __init__(self, max_order: int, mem_size: int, variant: str, restore_method: int) Initialize a PpmdCompressor object. restore_method param is affected only when variant is “I”. Parameters: - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **variant** (str) - PPMd variant name, only accept “H” or “I” - **restore_method** (int) - PPMD8_RESTORE_METHOD_RESTART(0) or PPMD8_RESTORE_METHOD_CUTOFF(1) #### compress(self, data) Provide data to the compressor object. Parameters: - **data** (bytes-like object) - Data to be compressed. Returns: - A chunk of compressed data if possible, or `b''` otherwise. Return type: - bytes #### flush(self) Flush any remaining data in internal buffer. The compressor object can not be used after this method is called. Returns: - Flushed data. Return type: - bytes ### Request Example ```python c = PpmdCompressor() dat1 = c.compress(b'123456') dat2 = c.compress(b'abcdef') dat3 = c.flush() ``` ``` -------------------------------- ### decompress Source: https://pyppmd.readthedocs.io/en/latest/api_guide.html Decompresses data using the PpmdDecompressor. ```APIDOC ## decompress ### Description Decompress data, returning decompressed data as a `bytes` object. ### Parameters #### Path Parameters - **data** (bytes-like object) - Required - Data to be decompressed. - **max_length** (int) - Optional - Maximum size of returned data. When it’s negative, the output size is unlimited. When it’s non-negative, returns at most `max_length` bytes of decompressed data. If this limit is reached and further output can (or may) be produced, the `needs_input` attribute will be set to `False`. In this case, the next call to this method may provide `data` as `b''` to obtain more of the output. ### Request Example ```python d1 = PpmdDecompressor() decompressed_dat = d1.decompress(dat1) decompressed_dat += d1.decompress(dat2) decompressed_dat += d1.decompress(dat3) ``` ``` -------------------------------- ### decompress_str Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Decompresses data and returns it as a string. Allows specifying the encoding for decoding the raw decompressed data. ```APIDOC ## decompress_str ### Description Decompresses data and returns it as a string. Allows specifying the encoding for decoding the raw decompressed data. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **data** (Union[bytes, memoryview]) - Data to be decompressed. - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **encoding** (str) - Encoding name to use when decoding raw decompressed data - **variant** (str) - PPMd variant name, only accept "H" or "I" ### Returns - **str** - Decompressed text ### Raises - **PpmdError** - If decompression fails. ### Example ```python decompressed_text = decompress_str(data) ``` ``` -------------------------------- ### Decompress Data to String Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Use `decompress_str` to decompress data and decode it into a string using a specified encoding. Defaults to UTF-8 if no encoding is provided. ```python decompressed_text = decompress_str(data) ``` -------------------------------- ### Ppmd7Encoder Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for encoding data using the PPMd7 algorithm. ```APIDOC ## Ppmd7Encoder Class ### encode() Encodes data using PPMd7. ### flush() Flushes any remaining encoded data. ``` -------------------------------- ### Ppmd7Decoder Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for decoding data using the PPMd7 algorithm. ```APIDOC ## Ppmd7Decoder Class ### decode() Decodes data using PPMd7. ### flush() Flushes any remaining decoded data. ``` -------------------------------- ### Ppmd7Decoder Source: https://pyppmd.readthedocs.io/en/latest/_sources/ppmd7.rst.txt Decoder for PPMd Variant H. Initializes with max_order and mem_size. ```APIDOC ## Ppmd7Decoder ### Description Decoder for PPMd Variant H. ### Method __init__(max_order: int, mem_size: int) ### Parameters #### Path Parameters - **max_order** (int) - The ``max_order`` parameter is between 2 to 64. - **mem_size** (int) - ``mem_size`` is a memory size in bytes which the encoder can use. ## Ppmd7Decoder.decode ### Description Returns decoded data that sizes is length. The decoder may return data which size is smaller than specified length, that is because the size of input data is not enough to decode. ### Method decode(data: Union[bytes, bytearray, memoryview], length: int) ### Parameters #### Path Parameters - **data** (Union[bytes, bytearray, memoryview]) - The data to decode. - **length** (int) - The desired length of the decoded data. ## Ppmd7Decoder.flush ### Description All pending input is processed, and a bytes object containing the remaining uncompressed output of specified length is returned. After calling flush(), the decode() method cannot be called again; the only realistic action is to delete the object. ### Method flush(length: int) ### Parameters #### Path Parameters - **length** (int) - The specified length of the remaining uncompressed output. ``` -------------------------------- ### Decompress Data to Bytes Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Use the `decompress` function for simple, in-memory decompression of data, returning the raw decompressed bytes. ```python decompressed_data = decompress(data) ``` -------------------------------- ### PpmdCompressor Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt A streaming compressor class that allows compressing data in chunks. It is thread-safe at the method level. ```APIDOC ## PpmdCompressor ### Description A streaming compressor class that allows compressing data in chunks. It is thread-safe at the method level. ### Methods #### __init__ Initialize a PpmdCompressor object. restore_method param is affected only when variant is "I". - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **variant** (str) - PPMd variant name, only accept "H" or "I" - **restore_method** (int) - PPMD8_RESTORE_METHOD_RESTART(0) or PPMD8_RESTORE_METHOD_CUTOFF(1) #### compress Provide data to the compressor object. - **data** (bytes-like object) - Data to be compressed. - **Returns**: A chunk of compressed data if possible, or ``b''`` otherwise. - **rtype**: bytes #### flush Flush any remaining data in internal buffer. The compressor object can not be used after this method is called. - **Returns**: Flushed data. - **rtype**: bytes ### Example ```python c = PpmdCompressor() dat1 = c.compress(b'123456') dat2 = c.compress(b'abcdef') dat3 = c.flush() ``` ``` -------------------------------- ### PpmdDecompressor Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for performing decompression operations. ```APIDOC ## PpmdDecompressor Class ### __init__() Initializes a PpmdDecompressor object. ### eof Attribute indicating end-of-file. ### needs_input Attribute indicating if input is needed. ### unused_data Attribute for unused data. ``` -------------------------------- ### Ppmd8Decoder Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for decoding data using the PPMd8 algorithm. ```APIDOC ## Ppmd8Decoder Class ### decode() Decodes data using PPMd8. ### flush() Flushes any remaining decoded data. ``` -------------------------------- ### PpmdDecompressor.decompress Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt Decompresses input data using the PPMd algorithm. It can handle partial decompression with a maximum length limit. ```APIDOC ## PpmdDecompressor.decompress ### Description Decompresses input data. Supports a maximum output length to control memory usage and stream processing. ### Method `decompress(data, max_length)` ### Parameters #### Arguments - **data** (bytes-like object) - The data to be decompressed. - **max_length** (int) - Maximum size of returned data. If negative, the output size is unlimited. If non-negative, returns at most `max_length` bytes. If this limit is reached and further output is possible, `needs_input` will be set to `False`. ### Request Example ```python d1 = PpmdDecompressor() decompressed_dat = d1.decompress(dat1) decompressed_dat += d1.decompress(dat2) decompressed_dat += d1.decompress(dat3) ``` ### Response #### Success Response - **decompressed_data** (bytes) - The decompressed data. ``` -------------------------------- ### Ppmd8Encoder Class Source: https://pyppmd.readthedocs.io/en/latest/genindex.html A class for encoding data using the PPMd8 algorithm. ```APIDOC ## Ppmd8Encoder Class ### encode() Encodes data using PPMd8. ### flush() Flushes any remaining encoded data. ``` -------------------------------- ### Ppmd7Encoder Source: https://pyppmd.readthedocs.io/en/latest/_sources/ppmd7.rst.txt Encoder for PPMd Variant H. Initializes with max_order and mem_size. ```APIDOC ## Ppmd7Encoder ### Description Encoder for PPMd Variant H. ### Method __init__(max_order: int, mem_size: int) ### Parameters #### Path Parameters - **max_order** (int) - The ``max_order`` parameter is between 2 to 64. - **mem_size** (int) - ``mem_size`` is a memory size in bytes which the encoder can use. ## Ppmd7Encoder.encode ### Description Compress data, returning a bytes object containing compressed data for at least part of the data in data. This data should be concatenated to the output produced by any preceding calls to the encode() method. Some input may be kept in internal buffers for later processing. ### Method encode(data: Union[bytes, bytearray, memoryview]) ### Parameters #### Path Parameters - **data** (Union[bytes, bytearray, memoryview]) - The data to compress. ## Ppmd7Encoder.flush ### Description All pending input is processed, and bytes object containing the remaining compressed output is returned. After calling flush(), the encode() method cannot be called again; the only realistic action is to delete the object. When ``endmark`` is true, flush write endmark(-1) to end of archive, otherwise do not write (default). ### Method flush(endmark: boolean) ### Parameters #### Path Parameters - **endmark** (boolean) - If true, write endmark(-1) to end of archive, otherwise do not write (default). ``` -------------------------------- ### PpmdDecompressor Source: https://pyppmd.readthedocs.io/en/latest/_sources/api_guide.rst.txt A streaming decompressor class that allows decompressing data in chunks. It is thread-safe at the method level. ```APIDOC ## PpmdDecompressor ### Description A streaming decompressor class that allows decompressing data in chunks. It is thread-safe at the method level. A restore_method param is affected only when variant is "I". ### Methods #### __init__ Initialize a PpmdDecompressor object. - **max_order** (int) - maximum order of PPMd algorithm - **mem_size** (int) - memory size used for building PPMd model - **variant** (str) - PPMd variant name, only accept "H" or "I" - **restore_method** (int) - PPMD8_RESTORE_METHOD_RESTART(0) or PPMD8_RESTORE_METHOD_CUTOFF(1) #### decompress Decompress *data*, returning decompressed data as a ``bytes`` object. - **data** (bytes-like object) - Data to be decompressed. - **max_length** (int) - Optional. Maximum length of data to decompress. Defaults to -1 (no limit). ### Example ```python # Example usage would go here, but is not provided in the source. ``` ``` -------------------------------- ### Ppmd8Encoder Source: https://pyppmd.readthedocs.io/en/latest/_sources/ppmd8.rst.txt Encoder for PPMd Variant I version 2. It allows compressing data using specified memory and order parameters. ```APIDOC ## Ppmd8Encoder Encoder for PPMd Variant I version 2. ### Parameters * **max_order** (int) - The maximum order parameter, between 2 and 64. * **mem_size** (int) - The memory size in bytes that the encoder will use. * **restore_method** (int) - The restore method, which should be either ``PPMD8_RESTORE_METHOD_RESTART`` or ``PPMD8_RESTORE_METHOD_CUTOFF``. ### Methods #### encode(data: Union[bytes, bytearray, memoryview]) -> bytes Compresses the provided data and returns a bytes object containing the compressed data. This data should be appended to any output from previous calls. Some input may be retained in an internal buffer for future processing. #### flush(endmark: bool = True) -> bytes Processes all pending input and returns a bytes object with the remaining compressed output. After calling `flush()`, the `encode()` method cannot be used again. This method also releases some resources used by the object. If `endmark` is true (default), an endmark (-1) is written to the archive; otherwise, nothing is written, and the buffer is simply flushed. ``` -------------------------------- ### Ppmd8Decoder Source: https://pyppmd.readthedocs.io/en/latest/_sources/ppmd8.rst.txt Decoder for PPMd Variant I version 2. It reconstructs original data from compressed input. ```APIDOC ## Ppmd8Decoder Decoder for PPMd Variant I version 2. ### Parameters * **max_order** (int) - The maximum order parameter, between 2 and 64. This should match the encoder's setting. * **mem_size** (int) - The memory size in bytes used by the encoder. This should match the encoder's setting. * **restore_method** (int) - The restore method used by the encoder. This should match the encoder's setting. ### Methods #### decode(data: Union[bytes, bytearray, memoryview], length: int = -1) -> bytes Decodes the given data and returns the decoded data. If `length` is -1, the maximum possible output data is returned. If the decoder encounters the end mark, it automatically flushes all data and closes some resources. The `Ppmd8Decoder.eof` member becomes `True` when the end mark is reached. If `Ppmd8Decoder.needs_input` is `True`, all input data has been consumed, and more input is required to generate output. Otherwise, there is data in the internal buffer that can be reused. The decoder might return data smaller than the specified `length` if the input data is insufficient for full decoding. ``` -------------------------------- ### Ppmd8Decoder Source: https://pyppmd.readthedocs.io/en/latest/ppmd8.html Decoder for PPMd Variant I version 2. It decodes compressed data using the same parameters as the encoder. ```APIDOC ## Class Ppmd8Decoder Decoder for PPMd Variant I version 2. ### Methods #### __init__(self, max_order: int, mem_size: int, restore_method: int) Constructor for Ppmd8Decoder. * **max_order** (int) - The maximum order parameter, between 2 to 64. Should match the encoder's `max_order`. * **mem_size** (int) - The memory size in bytes the decoder will use. Should match the encoder's `mem_size`. * **restore_method** (int) - Should match the encoder's `restore_method`. #### decode(self, data: Union[bytes, bytearray, memoryview], length: int = -1) -> bytes Decodes the given data. * **data** (Union[bytes, bytearray, memoryview]) - The compressed data to decode. * **length** (int) - The maximum amount of decoded data to return. If -1 (default), returns the maximum possible output data. * Returns decoded data. If the decoder reaches the end mark, `Ppmd8Decoder.eof` becomes True. If `Ppmd8Decoder.needs_input` is True, more input data is required. The decoder may return data smaller than `length` if input data is insufficient. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.