itacart.serialization.tree_blob.iter_leaves

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

Stream encoded leaf nodes without decoding to text.

Parameters:

blob (bytes) – The binary blob.

Yields:

bytes – Encoded leaf node bytes.

Raises:

MalformedBlobError – If the blob fails structural validation.

Return type:

Iterator[bytes]

Example

>>> len(list(iter_leaves(encode_tree("NE(0625/0451(1,2))"))))
2