Commit a2a6cccf authored by Syrtis Major's avatar Syrtis Major Committed by GitHub

Merge pull request #1 from syrte/magic_import_all

IPython magic only import things in `"__all__"`
parents af4737d7 cf14c484
......@@ -93,9 +93,17 @@ class CythonMagics(Magics):
self._pyximport_installed = False
def _import_all(self, module):
for k,v in module.__dict__.items():
if not k.startswith('__'):
self.shell.push({k:v})
mdict = module.__dict__
if '__all__' in mdict:
for k in mdict['__all__']:
if k in mdict:
self.shell.push({k:mdict[k]})
else:
raise AttributeError("'module' object has no attribute '%s'" % k)
else:
for k, v in mdict.items():
if not k.startswith('__'):
self.shell.push({k:v})
@cell_magic
def cython_inline(self, line, cell):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment