factor_agent.gate.vocabulary.resolve#

resolve(path, roots=None)[source]#

Import the object at path: the longest importable module prefix, then attributes.

With roots, the path may not leave the modules under them: no attribute hop may go through a module outside them (KunQuant.jit.cfake .subprocess.run is refused, though its prefix is KunQuant’s), and the object must be defined in one of them (its __module__), so a name an allowed module imported from elsewhere is refused too.

Raises:
ImportError, AttributeError

If no prefix imports or an attribute is missing; the ImportError subclass _OutsideModules if the path leaves roots.