Import * from uri, and separate out functions and classes.
(self, uri)
| 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``""" |