Skip to main content

Module notebook

Module notebook 

Source
Expand description

Jupyter notebook (.ipynb) text extraction for scanner detection.

A .ipynb file is a JSON document whose human-authored text (code, markdown) and program output live inside JSON string arrays. Scanning the raw JSON makes detection both miss real notices (e.g. a (c) ... line wrapped as "\t(c) Foo, 2012\n",) and emit false positives from JSON array punctuation around source lines. This module decodes the notebook into the plain cell text so license/copyright detection sees the same clean text a reader would.

Like the source-map extractor, this trades exact line-number fidelity (offsets become relative to the extracted text) for correct detection content.

Functions§

extract_notebook_content
Extract the human-readable text from a Jupyter notebook’s cells.
is_notebook
Check whether a file is a Jupyter notebook based on its extension.