(spec, ispkg, addparent)
| 408 | |
| 409 | |
| 410 | def _add_module(spec, ispkg, addparent): |
| 411 | if isinstance(spec, str): |
| 412 | name = spec |
| 413 | mod = create_module(name, ispkg=ispkg) |
| 414 | spec = mod.__spec__ |
| 415 | else: |
| 416 | name = spec.name |
| 417 | mod = importlib.util.module_from_spec(spec) |
| 418 | sys.modules[name] = mod |
| 419 | if addparent is not False and spec.parent: |
| 420 | _ensure_module(spec.parent, True, addparent, bool(addparent)) |
| 421 | return mod |
| 422 | |
| 423 | |
| 424 | def add_module(spec, *, parents=True): |
no test coverage detected
searching dependent graphs…