##// END OF EJS Templates
Backport PR #8303: fix bug in stale profile clean up for clusters...
Backport PR #8303: fix bug in stale profile clean up for clusters "clusters" tab of my notebook wasn't rendering, so checked the log, found the stack trace: ``` [...] File "/usr/local/lib/python3.4/site-packages/ipython-3.0.0-py3.4.egg/IPython/html/services/clusters/handlers.py", line 21, in get ...

File last commit:

r18606:776d1fa8
r21457:330d52a4
Show More
notebooknode.py
21 lines | 535 B | text/x-python | PythonLexer
"""NotebookNode - adding attribute access to dicts"""
from IPython.utils.ipstruct import Struct
class NotebookNode(Struct):
"""A dict-like node with attribute-access"""
pass
def from_dict(d):
"""Convert dict to dict-like NotebookNode
Recursively converts any dict in the container to a NotebookNode
"""
if isinstance(d, dict):
return NotebookNode({k:from_dict(v) for k,v in d.items()})
elif isinstance(d, (tuple, list)):
return [from_dict(i) for i in d]
else:
return d