MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / write_ipynb_meta

Function write_ipynb_meta

tools/docs_and_notebooks_check.py:551–564  ·  view source on GitHub ↗

Write a notebook using nbformat. Note: nbformat writes JSON in a canonical form; it *will* rewrite the file, so expect diffs if the notebook wasn't previously normalized to the same style.

(path: Path, nb: Any)

Source from the content-addressed store, hash-verified

549
550
551def write_ipynb_meta(path: Path, nb: Any) -> None:
552 """
553 Write a notebook using nbformat.
554
555 Note: nbformat writes JSON in a canonical form; it *will* rewrite the file,
556 so expect diffs if the notebook wasn't previously normalized to the same style.
557 """
558 # Validate before writing (optional but recommended)
559 nbformat.validate(nb)
560
561 # Use a stable indentation to reduce churn (choose 2 if your repo tends that way)
562 text = nbformat.writes(nb, version=4, indent=2, ensure_ascii=False)
563
564 path.write_text(text + "\n", encoding="utf-8")
565
566
567def parse_dlc_meta(raw: Any) -> tuple[DLCMeta | None, bool]:

Callers 2

update_filesFunction · 0.85
normalize_notebooksFunction · 0.85

Calls 1

validateMethod · 0.45

Tested by

no test coverage detected