euporie.core.nbformat
A simple, fast, version of nbformat which avoids validation at start-up.
Implements fast versions of new_notebook and new_code_cell functions which do not perform validation, so do not require jsonschema to be imported.
Other functions are provided as shims which lazily import from the nbformat library, so they do not affect application start-up time.
Functions
|
Return the spec for the specified module. |
|
Convert a dictionary to a NotebookNode. |
|
Create a new code cell, without validation. |
|
Create a new markdown cell. |
|
Create a new notebook, without validation. |
|
Create a new output. |
|
Create a new raw cell. |
|
Create a NotebookNode for an output from a kernel's IOPub message. |
|
Read a notebook from a file, without validation. |
|
Generate a random UUID. |
|
Write a notebook to a file. |
Classes
|
A Mapping is a generic container for associating key/value pairs. |
A dict-like node with attribute-access. |
- class euporie.core.nbformat.NotebookNode
Bases:
dictA dict-like node with attribute-access.
A reimplementation of
nbformat.NotebookNodewhich does not trigger validation.- clear()
Remove all items from the dict.
- copy()
Return a shallow copy of the dict.
- classmethod fromkeys(iterable, value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items()
Return a set-like object providing a view on the dict’s items.
- keys()
Return a set-like object providing a view on the dict’s keys.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- values()
Return an object providing a view on the dict’s values.
- euporie.core.nbformat.new_code_cell(source: str = '', **kwargs: Any) NotebookNode
Create a new code cell, without validation.
- euporie.core.nbformat.new_markdown_cell(source: str = '', **kwargs: Any) NotebookNode
Create a new markdown cell.
- euporie.core.nbformat.new_notebook(**kwargs: Any) NotebookNode
Create a new notebook, without validation.
- euporie.core.nbformat.new_output(output_type: str, data: Any | None = None, **kwargs: Any) NotebookNode
Create a new output.
- euporie.core.nbformat.new_raw_cell(source: str = '', **kwargs: Any) NotebookNode
Create a new raw cell.
- euporie.core.nbformat.output_from_msg(msg: dict[str, Any]) NotebookNode
Create a NotebookNode for an output from a kernel’s IOPub message.