def _get_parent_smtbl(self, code, cfg): cfg = cfg_dict[code] prefix = cfg.prefix.rsplit('.', 1) mod_path = getabspath(cfg.codeobj.co_filename) mp_dotted = os.path.splitext(mod_path)[0].replace('/', '.') if len(prefix) == 2 and mp_dotted.endswith(prefix[0]): return module_symtables[mod_path] else: return smtbl
def from_code(path): path = getabspath(path) module_name = getmodulename(path) res = ModuleObject(cfg_wrapper.import_module(path), module_name, path) # prev_state = _state # CallableObject._set_state(RootState) res.call(0) res._set_attrs() # CallableObject._set_state(prev_state) import_table[path] = res return res