Skip to content

scan_notebook_cells

Public callable

Scan multiple notebook cells and append cell references to lineage steps.

Parameters:

Name Type Description Default
cells list of str

Cell source strings in notebook execution order.

required

Returns:

Type Description
list of dict of str to Any

Combined lineage steps with cell:<index> entries in code_refs.

Source code in src/fabricops_kit/lineage.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
def scan_notebook_cells(cells: list[str]) -> list[dict[str, Any]]:
    """Scan multiple notebook cells and append cell references to lineage steps.

    Parameters
    ----------
    cells : list of str
        Cell source strings in notebook execution order.

    Returns
    -------
    list of dict of str to Any
        Combined lineage steps with ``cell:<index>`` entries in ``code_refs``.
    """
    out: list[dict[str, Any]] = []
    for idx, cell in enumerate(cells):
        for step in scan_notebook_lineage(cell):
            step["code_refs"].append(f"cell:{idx}")
            out.append(step)
    return out