Skip to content

_parser

Warning: The parser is currently an internal concern and changes will not necessarily be reflected in semver.

_parser

Parse notebooks.

Notebook

Notebook(filepath: Path)

The relevant bits of an ipython Notebook.

ATTRIBUTE DESCRIPTION
codecells

The code cells excluding any identified as test cells.

TYPE: SourceList

testcells

The code cells which are identified as containing tests, based upon the presence of the %%ipytestmagic.

TYPE: SourceList

codecells instance-attribute

codecells: SourceList = muggle()

The code cells excluding any identified as test cells

testcells instance-attribute

testcells: SourceList = muggle()

The code cells which are identified as containing tests, based upon the presence of the %%ipytestmagic.

SourceList

A list with non-continuous indices for storing the contents of cells.

  • use a full slice sourcelist[:], not list(sourcelist) to get contents.
  • supports .ids() analog to a mapping.keys(), yielding only cell-ids with source.

__getitem__

__getitem__(index: SupportsIndex) -> str
__getitem__(index: slice) -> list[str]
__getitem__(index)

Behaves as you would expect for a list with the following exceptions.

  • If provided with a single index: Raises an IndexError if the element at index does not contain any relevant source.
  • If provided with a slice: Returns only those items, which contain relevant source.

ids

ids() -> Generator[int, None, None]

Analog to mapping .keys(), yielding only cell-ids with source.

muggle

muggle() -> Self

Comment out any ipython magics.