private IPythonModule ImportFromBuiltins(string name) { if (_builtinModuleNames == null || !_builtinModuleNames.Contains(name)) { return(null); } _log?.Log(TraceLevel.Info, "ImportBuiltins", name, _factory.FastRelativePath(Factory.Configuration.InterpreterPath)); try { return(new AstBuiltinPythonModule(name, Factory.Configuration.InterpreterPath)); } catch (ArgumentNullException) { Debug.Fail("No factory means cannot import builtin modules"); return(null); } }
private IPythonModule ImportFromBuiltins(string name) { if (_builtinModuleNames == null && _builtinModule != null) { var bmn = (_builtinModule as AstBuiltinsPythonModule).GetAnyMember("__builtin_module_names__") as AstPythonStringLiteral; _builtinModuleNames = bmn?.Value?.Split(','); } if (_builtinModuleNames == null || !_builtinModuleNames.Contains(name)) { return(null); } _log?.Log(TraceLevel.Info, "ImportBuiltins", name, _factory.FastRelativePath(Factory.Configuration.InterpreterPath)); try { return(new AstBuiltinPythonModule(name, Factory.Configuration.InterpreterPath)); } catch (ArgumentNullException) { Debug.Fail("No factory means cannot import builtin modules"); return(null); } }