private async Task <PythonAnalyzer> CreateAnalyzer(PythonInitializationOptions.Interpreter interpreter, CancellationToken token)
        {
            var factory = ActivateObject <IPythonInterpreterFactory>(interpreter.assembly, interpreter.typeName, interpreter.properties)
                          ?? new AstPythonInterpreterFactory(interpreter.properties);

            var analyzer = await PythonAnalyzer.CreateAsync(factory, token);

            LogMessage(MessageType.Info, $"Created {analyzer.Interpreter.GetType().FullName} instance from {factory.GetType().FullName}");
            return(analyzer);
        }
Example #2
0
        private async Task <PythonAnalyzer> CreateAnalyzer(PythonInitializationOptions.Interpreter interpreter, CancellationToken token)
        {
            var factory = ActivateObject <IPythonInterpreterFactory>(interpreter.assembly, interpreter.typeName, interpreter.properties)
                          ?? new AstPythonInterpreterFactory(interpreter.properties);

            var interp = factory.CreateInterpreter();

            if (interp == null)
            {
                throw new InvalidOperationException(Resources.Error_FailedToCreateInterpreter);
            }

            LogMessage(MessageType.Info, $"Created {interp.GetType().FullName} instance from {factory.GetType().FullName}");

            var analyzer = await PythonAnalyzer.CreateAsync(factory, interp, token);

            return(analyzer);
        }