itacart.serialization.tree_blob.decode_tree

itacart.serialization.tree_blob.decode_tree(blob)[source]

Decode a TreeBlob into a compositional index.

Round-trips to the canonical form of the original, not necessarily to its input spelling.

Parameters:

blob (bytes) – The binary blob.

Return type:

str

Returns:

The compositional index string in canonical prefix form.

Raises:

MalformedBlobError – If the blob fails structural validation.

Example

>>> decode_tree(encode_tree("NE(0625/0451(2,1))"))
'NE(0625/0451(1,2))'