PyFoam.IPythonHelpers.Notebook module

Read and create IPython-Notebooks

class PyFoam.IPythonHelpers.Notebook.Cell(classes=(), pyFoam={}, **kwargs)[source]

Bases: dict

Wrapper for the dictionaries that represent notebook cells. Mostly for conveniently querying metadata

__dict__ = mappingproxy({'__module__': 'PyFoam.IPythonHelpers.Notebook', '__doc__': 'Wrapper for the dictionaries that represent notebook cells.\n Mostly for conveniently querying metadata', '__init__': <function Cell.__init__>, 'meta': <function Cell.meta>, 'isClass': <function Cell.isClass>, '__dict__': <attribute '__dict__' of 'Cell' objects>, '__weakref__': <attribute '__weakref__' of 'Cell' objects>})
__init__(classes=(), pyFoam={}, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'PyFoam.IPythonHelpers.Notebook'
__weakref__

list of weak references to the object (if defined)

isClass(name)[source]

Checks whether a cell is of a specific class. If a string is passed the string is checked. Otherwise it is assumed that it is a container and the

meta()[source]
class PyFoam.IPythonHelpers.Notebook.Notebook(input=None, nbformat=3, nbformat_minor=0, name=None)[source]

Bases: object

Class that represents an IPython-notebook in memory

_Notebook__addCell(**kwargs)
__dict__ = mappingproxy({'__module__': 'PyFoam.IPythonHelpers.Notebook', '__doc__': 'Class that represents an IPython-notebook in memory', '__init__': <function Notebook.__init__>, 'raw': <property object>, 'name': <property object>, '_cells': <function Notebook._cells>, 'reset': <function Notebook.reset>, '__iter__': <function Notebook.__iter__>, '__len__': <function Notebook.__len__>, '_Notebook__addCell': <function Notebook.__addCell>, 'pyFoamMetaData': <function Notebook.pyFoamMetaData>, 'addHeading': <function Notebook.addHeading>, 'addCode': <function Notebook.addCode>, 'addMarkdown': <function Notebook.addMarkdown>, 'addRaw': <function Notebook.addRaw>, 'writeToFile': <function Notebook.writeToFile>, '__dict__': <attribute '__dict__' of 'Notebook' objects>, '__weakref__': <attribute '__weakref__' of 'Notebook' objects>})
__init__(input=None, nbformat=3, nbformat_minor=0, name=None)[source]
Parameters

input – If this is a string then it is interpreted as

a filename. Otherwise as a filehandle. If unset then an empty notebook is contructed :param name: name of the notebook. Only used if a new notebook is created

__iter__()[source]
__len__()[source]
__module__ = 'PyFoam.IPythonHelpers.Notebook'
__weakref__

list of weak references to the object (if defined)

_cells()[source]
addCode(input, collapsed=False, language='python', **kwargs)[source]
addHeading(title, level=1, **kwargs)[source]
addMarkdown(text, **kwargs)[source]
addRaw(text, **kwargs)[source]
property name
pyFoamMetaData()[source]

Our very own metadata-dictionary

property raw
reset(new)[source]
writeToFile(fName)[source]