angr.utils.lazy_import 源代码

from __future__ import annotations
import importlib.util
import sys


[文档] def lazy_import(name): spec = importlib.util.find_spec(name) loader = importlib.util.LazyLoader(spec.loader) spec.loader = loader module = importlib.util.module_from_spec(spec) sys.modules[name] = module loader.exec_module(module) return module