Show More
@@ -13,12 +13,16 b' warn("The `IPython.html` package has been deprecated. "' | |||||
13 |
|
13 | |||
14 | from IPython.utils.shimmodule import ShimModule |
|
14 | from IPython.utils.shimmodule import ShimModule | |
15 |
|
15 | |||
16 | sys.modules['IPython.html.widgets'] = ShimModule( |
|
16 | _widgets = sys.modules['IPython.html.widgets'] = ShimModule( | |
17 | src='IPython.html.widgets', mirror='ipython_widgets') |
|
17 | src='IPython.html.widgets', mirror='ipython_widgets') | |
18 |
|
18 | |||
19 |
|
|
19 | _html = ShimModule( | |
20 | src='IPython.html', mirror='jupyter_notebook') |
|
20 | src='IPython.html', mirror='jupyter_notebook') | |
21 |
|
21 | |||
|
22 | # hook up widgets | |||
|
23 | _html.widgets = _widgets | |||
|
24 | sys.modules['IPython.html'] = _html | |||
|
25 | ||||
22 | if __name__ == '__main__': |
|
26 | if __name__ == '__main__': | |
23 | from jupyter_notebook import notebookapp as app |
|
27 | from jupyter_notebook import notebookapp as app | |
24 | app.launch_new_instance() |
|
28 | app.launch_new_instance() |
@@ -68,6 +68,18 b' class ShimModule(types.ModuleType):' | |||||
68 | def __spec__(self): |
|
68 | def __spec__(self): | |
69 | """Don't produce __spec__ until requested""" |
|
69 | """Don't produce __spec__ until requested""" | |
70 | return __import__(self._mirror).__spec__ |
|
70 | return __import__(self._mirror).__spec__ | |
|
71 | ||||
|
72 | def __dir__(self): | |||
|
73 | return dir(__import__(self._mirror)) | |||
|
74 | ||||
|
75 | @property | |||
|
76 | def __all__(self): | |||
|
77 | """Ensure __all__ is always defined""" | |||
|
78 | mod = __import__(self._mirror) | |||
|
79 | try: | |||
|
80 | return mod.__all__ | |||
|
81 | except AttributeError: | |||
|
82 | return [name for name in dir(mod) if not name.startswith('_')] | |||
71 |
|
83 | |||
72 | def __getattr__(self, key): |
|
84 | def __getattr__(self, key): | |
73 | # Use the equivalent of import_item(name), see below |
|
85 | # Use the equivalent of import_item(name), see below |
General Comments 0
You need to be logged in to leave comments.
Login now