PyFoam.IPythonHelpers.PermanentStorage module
PermanentStorage
Store data permanently in the metadata of a notebook
- class PyFoam.IPythonHelpers.PermanentStorage.PermanentStorage[source]
Bases:
objectAccess the stored values in the notebook
To make sure that only one object is created (so that multiple objects can’t interfer) it is created as a singleton. See: A python singleton: http://code.activestate.com/recipes/52558/
- __dict__ = mappingproxy({'__module__': 'PyFoam.IPythonHelpers.PermanentStorage', '__doc__': "Access the stored values in the notebook\n\n To make sure that only one object is created (so that multiple objects\n can't interfer) it is created as a singleton. See:\n A python singleton: http://code.activestate.com/recipes/52558/", '_data': {}, '_PermanentStorage__permanentStorage': <class 'PyFoam.IPythonHelpers.PermanentStorage.PermanentStorage.__permanentStorage'>, '_PermanentStorage__instance': None, '__init__': <function PermanentStorage.__init__>, '__getattr__': <function PermanentStorage.__getattr__>, '__setattr__': <function PermanentStorage.__setattr__>, '__getitem__': <function PermanentStorage.__getitem__>, '__delitem__': <function PermanentStorage.__delitem__>, '__iter__': <function PermanentStorage.__iter__>, '__contains__': <function PermanentStorage.__contains__>, '__setitem__': <function PermanentStorage.__setitem__>, '__call__': <function PermanentStorage.__call__>, '__dict__': <attribute '__dict__' of 'PermanentStorage' objects>, '__weakref__': <attribute '__weakref__' of 'PermanentStorage' objects>, '__annotations__': {}})
- __instance = None
- __module__ = 'PyFoam.IPythonHelpers.PermanentStorage'
- class __permanentStorage
Bases:
objectActual implementation of the storage
- __call__(name, f, call=True)
Get value or evaluate it. :param name: name of the item to get/set :param f: function to evaluate if the item is not present. If item is not callable (strings for instance) it is set ‘as-is’ :param call: Use f() if possible (otherwise f)
- __contains__(key)
- __delitem__(attr)
Remove the property from the metadata
- __dict__ = mappingproxy({'__module__': 'PyFoam.IPythonHelpers.PermanentStorage', '__doc__': 'Actual implementation of the storage ', '_permanentStorage__storePath': 'IPython.notebook.metadata.pyFoam.storedData', '_permanentStorage__outputHandle': '\n function handle_output(out){\n console.log(out);\n var res = null;\n // if output is a print statement\n if(out.msg_type == "stream"){\n res = out.content.data;\n }\n // if output is a python object\n else if(out.msg_type === "pyout"){\n res = out.content.data["text/plain"];\n }\n // if output is a python error\n else if(out.msg_type == "pyerr"){\n res = out.content.ename + ": " + out.content.evalue;\n }\n // if output is something we haven\'t thought of\n else{\n res = "[out type not implemented]";\n }\n console.log(res);\n }\n var callbacks = {\'iopub\' : {\'output\' : handle_output}};\n ', '__init__': <function PermanentStorage.__permanentStorage.__init__>, '__getitem__': <function PermanentStorage.__permanentStorage.__getitem__>, '__setitem__': <function PermanentStorage.__permanentStorage.__setitem__>, '__delitem__': <function PermanentStorage.__permanentStorage.__delitem__>, '__iter__': <function PermanentStorage.__permanentStorage.__iter__>, 'iterkeys': <function PermanentStorage.__permanentStorage.iterkeys>, 'keys': <function PermanentStorage.__permanentStorage.keys>, '__contains__': <function PermanentStorage.__permanentStorage.__contains__>, '__call__': <function PermanentStorage.__permanentStorage.__call__>, '_permanentStorage__displayModes': <function PermanentStorage.__permanentStorage.__displayModes>, 'autowriteOn': <function PermanentStorage.__permanentStorage.autowriteOn>, 'autowriteOff': <function PermanentStorage.__permanentStorage.autowriteOff>, 'autoreadOn': <function PermanentStorage.__permanentStorage.autoreadOn>, 'autoreadOff': <function PermanentStorage.__permanentStorage.autoreadOff>, '__dict__': <attribute '__dict__' of '__permanentStorage' objects>, '__weakref__': <attribute '__weakref__' of '__permanentStorage' objects>, '__annotations__': {}})
- __getitem__(attr)
- __init__()
Make sure that there is a subdictionary in the notebook-metadata
- __iter__()
- __module__ = 'PyFoam.IPythonHelpers.PermanentStorage'
- __setitem__(attr, value)
Set property in the metadata
- __weakref__
list of weak references to the object (if defined)
- _permanentStorage__displayModes()
- _permanentStorage__outputHandle = '\n function handle_output(out){\n console.log(out);\n var res = null;\n // if output is a print statement\n if(out.msg_type == "stream"){\n res = out.content.data;\n }\n // if output is a python object\n else if(out.msg_type === "pyout"){\n res = out.content.data["text/plain"];\n }\n // if output is a python error\n else if(out.msg_type == "pyerr"){\n res = out.content.ename + ": " + out.content.evalue;\n }\n // if output is something we haven\'t thought of\n else{\n res = "[out type not implemented]";\n }\n console.log(res);\n }\n var callbacks = {\'iopub\' : {\'output\' : handle_output}};\n '
- _permanentStorage__storePath = 'IPython.notebook.metadata.pyFoam.storedData'
- autoreadOff()
The ()-operator should not automatically get the value from the metadata
- autoreadOn()
The ()-operator should automatically get the value from the metadata
- autowriteOff()
The ()-operator should not automatically set the value in the metadata
- autowriteOn()
The ()-operator should automatically set the value in the metadata
- iterkeys()
- keys()
- __weakref__
list of weak references to the object (if defined)
- _data = {}