Module refinery.units.compression.brotli

Expand source code Browse git
from __future__ import annotations

from refinery.units import Unit


class brotli(Unit):
    """
    Brotli compression and decompression.
    """

    @Unit.Requires('brotlipy', ['all'])
    def _brotli():
        import brotli
        return brotli

    def process(self, data):
        return self._brotli.decompress(bytes(data))

    def reverse(self, data):
        return self._brotli.compress(bytes(data))

Classes

class brotli

Brotli compression and decompression.

Expand source code Browse git
class brotli(Unit):
    """
    Brotli compression and decompression.
    """

    @Unit.Requires('brotlipy', ['all'])
    def _brotli():
        import brotli
        return brotli

    def process(self, data):
        return self._brotli.decompress(bytes(data))

    def reverse(self, data):
        return self._brotli.compress(bytes(data))

Ancestors

Subclasses

Class variables

var required_dependencies
var console
var optional_dependencies

Methods

def reverse(self, data)
Expand source code Browse git
def reverse(self, data):
    return self._brotli.compress(bytes(data))

Inherited members