docs: __start__/__end__ consistency (#1874)

* changes

* skip mermaid

* retries fix

* viz error

* changes
This commit is contained in:
Isaac Francisco
2024-09-30 13:55:53 -07:00
committed by GitHub
parent d29747906d
commit 17dc1108a3
18 changed files with 110 additions and 108 deletions
@@ -62,6 +62,9 @@ def is_magic_command(code: str) -> bool:
def is_comment(code: str) -> bool:
return code.strip().startswith("#")
def is_mermaid_command(code: str) -> bool:
return "draw_mermaid_png" in code.strip()
def add_vcr_to_notebook(
notebook: nbformat.NotebookNode, cassette_prefix: str
@@ -84,6 +87,10 @@ def add_vcr_to_notebook(
if all(are_magic_lines):
continue
# skip if using mermaid
if any(is_mermaid_command(line) for line in lines):
continue
if any(are_magic_lines):
raise ValueError(
"Cannot process code cells with mixed magic and non-magic code."