MCPcopy Create free account
hub / github.com/ipython/ipython / _import_funcs_classes

Method _import_funcs_classes

docs/sphinxext/apigen.py:217–229  ·  view source on GitHub ↗

Import * from uri, and separate out functions and classes.

(self, uri)

Source from the content-addressed store, hash-verified

215 return FuncClsScanner().scan(mod)
216
217 def _import_funcs_classes(self, uri):
218 """Import * from uri, and separate out functions and classes."""
219 ns = {}
220 exec('from %s import *' % uri, ns)
221 funcs, classes = [], []
222 for name, obj in ns.items():
223 if inspect.isclass(obj):
224 cls = Obj(name=name, has_init='__init__' in obj.__dict__)
225 classes.append(cls)
226 elif inspect.isfunction(obj):
227 funcs.append(name)
228
229 return sorted(funcs), sorted(classes, key=lambda x: x.name)
230
231 def find_funcs_classes(self, uri):
232 """Find the functions and classes defined in the module ``uri``"""

Callers 1

find_funcs_classesMethod · 0.95

Calls 1

ObjClass · 0.70

Tested by

no test coverage detected