itacart.serialization.data_tree_blob.read_data_path
- itacart.serialization.data_tree_blob.read_data_path(blob, cell)[source]
A cell’s ancestors that the blob holds, with their values, read in place.
One walk down the tree: a binary search at resolution 1, then one step of constant time per level, each landing on an ancestor. The path is lexical; a prefix that names no cell is walked through and left out.
- Parameters:
- Return type:
list[tuple[str,dict[str,Union[int,float,None]]]] |list[list[tuple[str,dict[str,Union[int,float,None]]]]]- Returns:
(spelling, {name: value})from the quadrant down to the deepest node the blob holds on the cell’s path; the cell itself comes last only when the blob holds it. A list of such paths, aligned with the cells, when more than one was given.- Raises:
InvalidIndexError – If a cell is malformed.
NonExistentCellError – If a cell names no cell.
MalformedBlobError – If the frame is malformed.
Example
>>> n = DataVariable("n", "u32", op="sum", leaf_max=1) >>> blob = encode_data_tree({"NE(0625/0451(3))": {"n": 1}}, [n]) >>> [spelling for spelling, _ in read_data_path(blob, "NE(0625/0451(3))")] ['NE', 'NE(0625/0451)', 'NE(0625/0451(3))']