scistag.jupystag.Notebook¶
- class Notebook(source)[source]¶
Bases:
objectJupyter notebook helper class.
Is able to load a notebook, provide statistics about it and clean it, for example to use it in a pre-commit hook.
- Parameters
source (
str) – The notebooks filename
Methods
Removes temporary data from the notebook such as outputs and execution counters.
Parses the notebook to receive some details about it
Saves the notebook to disk
Attributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
The origin filename
The notebook data
Total cell count
Count of markdown cells
Count of code cells
The total size of the output data
Defines if the Notebook is dirty, e.g.
- clean(clear_outputs=True, clear_metadata=True, clear_counters=True)[source]¶
Removes temporary data from the notebook such as outputs and execution counters.
- Parameters
clear_outputs – Clear all outputs?
clear_metadata – Clear metadata?
clear_counters – Clear counters?
- cell_count¶
Total cell count
- code_cells¶
Count of code cells
- is_dirty¶
Defines if the Notebook is dirty, e.g. has a counter of outputs
- mark_down_cells¶
Count of markdown cells
- name¶
The origin filename
- notebook¶
The notebook data
- output_data_size¶
The total size of the output data