def extract_info_from_ipynb()

in scripts/internal/update_example_tables.py [0:0]


def extract_info_from_ipynb(file_path):
    with open(file_path, "r") as f:
        notebook = json.load(f)

    first_cell = notebook["cells"][0]
    if first_cell["cell_type"] == "markdown":
        content = "".join(first_cell["source"])
        match = re.search(
            r"<!--\s*---\s*title:\s*(.*?)\s*type:\s*(.*?)\s*---\s*-->",
            content,
            re.DOTALL,
        )
        if match:
            return match.group(1).strip(), match.group(2).strip()
    return None, None