private static object ImportTopRelative(PythonModule mod, string name, string full, List path) { object newmod = ImportFromPath(mod.SystemState, name, full, path); if (newmod != null) { mod.SetImportedAttr(mod, SymbolTable.StringToId(name), newmod); } return newmod; }
private static object ImportNestedModule(PythonModule mod, string name) { object ret; if (TryGetNestedModule(mod, name, out ret)) { return ret; } string baseName; List path = ResolveSearchPath(mod, out baseName); string fullName = CreateFullName(baseName, name); if (TryGetExistingModule(mod.SystemState, fullName, out ret)) { return ret; } if (path != null) { ret = ImportFromPath(mod.SystemState, name, fullName, path); if (ret != null) { mod.SetImportedAttr(mod, SymbolTable.StringToId(name), ret); return ret; } } throw Ops.ImportError("cannot import {0} from {1}", name, mod.ModuleName); }