MCPcopy Index your code
hub / github.com/ipython/ipython / _import_funcs_classes

Method _import_funcs_classes

docs/sphinxext/apigen.py:216–232  ·  view source on GitHub ↗

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

(self, uri)

Source from the content-addressed store, hash-verified

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

Callers 1

find_funcs_classesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected