CodecPipeline

digraph inheritance9b2c7a8dd0 { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "Codec" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="The base class for all codecs"]; "Logger" -> "Codec" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CodecPipeline" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="The codec class used when encoding/decoding data with multiple encoders"]; "Codec" -> "CodecPipeline" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Logger" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="The taurus logger class. All taurus pertinent classes should inherit"]; "Object" -> "Logger" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Object" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; }
class CodecPipeline(format)[source]

Bases: taurus.core.util.codecs.Codec, list

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
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

Return type

sequence[str, obj]

Returns

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

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

Return type

sequence[str, obj]

Returns

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