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

x.__init__(…) initializes x; see help(type(x)) for 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__ = dict_proxy({'addMarkdown': <function addMarkdown>, '__module__': 'PyFoam.IPythonHelpers.Notebook', '_cells': <function _cells>, 'addCode': <function addCode>, 'raw': <property object>, '__iter__': <function __iter__>, 'pyFoamMetaData': <function pyFoamMetaData>, 'addRaw': <function addRaw>, '__dict__': <attribute '__dict__' of 'Notebook' objects>, '__weakref__': <attribute '__weakref__' of 'Notebook' objects>, '__init__': <function __init__>, 'reset': <function reset>, 'name': <property object>, '_Notebook__addCell': <function __addCell>, 'writeToFile': <function writeToFile>, 'addHeading': <function addHeading>, '__doc__': 'Class that represents an IPython-notebook in memory', '__len__': <function __len__>})
__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=u'python', **kwargs)[source]
addHeading(title, level=1, **kwargs)[source]
addMarkdown(text, **kwargs)[source]
addRaw(text, **kwargs)[source]
name
pyFoamMetaData()[source]

Our very own metadata-dictionary

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