internal PythonAnalyzer(IPythonInterpreterFactory factory, IPythonInterpreter pythonInterpreter) { _interpreterFactory = factory; _langVersion = factory.GetLanguageVersion(); _disposeInterpreter = pythonInterpreter == null; _interpreter = pythonInterpreter ?? factory.CreateInterpreter(); _builtinName = _langVersion.Is3x() ? SharedDatabaseState.BuiltinName3x : SharedDatabaseState.BuiltinName2x; _modules = new ModuleTable(this, _interpreter); _modulesByFilename = new ConcurrentDictionary <string, ModuleInfo>(StringComparer.OrdinalIgnoreCase); _modulesWithUnresolvedImports = new HashSet <ModuleInfo>(); _itemCache = new Dictionary <object, AnalysisValue>(); Limits = AnalysisLimits.GetDefaultLimits(); _queue = new Deque <AnalysisUnit>(); _defaultContext = _interpreter.CreateModuleContext(); _evalUnit = new AnalysisUnit(null, null, new ModuleInfo("$global", new ProjectEntry(this, "$global", String.Empty, null), _defaultContext).Scope, true); AnalysisLog.NewUnit(_evalUnit); try { LoadInitialKnownTypes(); } catch (Exception ex) { if (ex.IsCriticalException()) { throw; } // This will be rethrown in LoadKnownTypesAsync _loadKnownTypesException = ExceptionDispatchInfo.Capture(ex); } }
internal PythonAnalyzer(IPythonInterpreterFactory factory) { InterpreterFactory = factory; LanguageVersion = factory.GetLanguageVersion(); Interpreter = factory.CreateInterpreter(); _pathResolver = new PathResolver(LanguageVersion); _builtinName = BuiltinTypeId.Unknown.GetModuleName(LanguageVersion); Modules = new ModuleTable(this, Interpreter); ModulesByFilename = new ConcurrentDictionary <string, ModuleInfo>(StringComparer.OrdinalIgnoreCase); Limits = AnalysisLimits.GetDefaultLimits(); Queue = new Deque <AnalysisUnit>(); _defaultContext = Interpreter.CreateModuleContext(); _evalUnit = new AnalysisUnit(null, null, new ModuleInfo("$global", new ProjectEntry(this, "$global", String.Empty, null, null), _defaultContext).Scope, true); AnalysisLog.NewUnit(_evalUnit); }
internal PythonAnalyzer(IPythonInterpreterFactory factory, IPythonInterpreter pythonInterpreter) { _interpreterFactory = factory; _langVersion = factory.GetLanguageVersion(); _disposeInterpreter = pythonInterpreter == null; _interpreter = pythonInterpreter ?? factory.CreateInterpreter(); _builtinName = BuiltinTypeId.Unknown.GetModuleName(_langVersion); _modules = new ModuleTable(this, _interpreter); _modulesByFilename = new ConcurrentDictionary <string, ModuleInfo>(StringComparer.OrdinalIgnoreCase); _modulesWithUnresolvedImports = new HashSet <ModuleInfo>(); _itemCache = new Dictionary <object, AnalysisValue>(); Limits = AnalysisLimits.GetDefaultLimits(); Queue = new Deque <AnalysisUnit>(); _defaultContext = _interpreter.CreateModuleContext(); _evalUnit = new AnalysisUnit(null, null, new ModuleInfo("$global", new ProjectEntry(this, "$global", String.Empty, null, null), _defaultContext).Scope, true); AnalysisLog.NewUnit(_evalUnit); }