CodecPipeline

Inheritance diagram of CodecPipeline
class CodecPipeline(format)[source]

The codec class used when encoding/decoding data with multiple encoders

Example usage:

>>> from taurus.core.util.codecs import CodecPipeline

>>> data = range(100000)
>>> codec = CodecPipeline('bz2_json')
>>> format, encoded_data = codec.encode(("", data))

# decode it
format, decoded_data = codec.decode((format, encoded_data))
print(decoded_data)

Import from taurus.core.util.codecs as:

from taurus.core.util.codecs import CodecPipeline
decode(data, *args, **kwargs)[source]

decodes the given data.

Parameters:

data (sequence[str, obj]) – a sequence of two elements where the first item is the encoding format of the second item object

Returns:

a sequence of two elements where the first item is the encoding format of the second item object

Return type:

sequence[str, obj]

encode(data, *args, **kwargs)[source]

encodes the given data.

Parameters:

data (sequence[str, obj]) – a sequence of two elements where the first item is the encoding format of the second item object

Returns:

a sequence of two elements where the first item is the encoding format of the second item object

Return type:

sequence[str, obj]