(module: Module, target: str)
| 326 | |
| 327 | |
| 328 | def get_subattr(module: Module, target: str): |
| 329 | # todo : remove this import |
| 330 | from .node import ModuleNode |
| 331 | |
| 332 | if target == "": |
| 333 | return module |
| 334 | *prefix, name = target.split(".") |
| 335 | for item in prefix: |
| 336 | module = getattr(module, item) |
| 337 | if not isinstance(module, (Module, ModuleNode)): |
| 338 | raise AttributeError("`{}` is not an Module".format(item)) |
| 339 | return getattr(module, name) |