Esempio n. 1
0
        public PythonTypeDatabase(
            PythonInterpreterFactoryWithDatabase factory,
            IEnumerable <string> databaseDirectories = null,
            PythonTypeDatabase innerDatabase         = null
            )
        {
            if (innerDatabase != null && factory.Configuration.Version != innerDatabase.LanguageVersion)
            {
                throw new InvalidOperationException("Language versions do not match");
            }

            _factory = factory;
            if (innerDatabase != null)
            {
                _sharedState = new SharedDatabaseState(innerDatabase._sharedState);
            }
            else
            {
                _sharedState = new SharedDatabaseState(_factory.Configuration.Version);
            }

            if (databaseDirectories != null)
            {
                foreach (var d in databaseDirectories)
                {
                    LoadDatabase(d);
                }
            }

            _sharedState.ListenForCorruptDatabase(this);
        }
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
 ) {
     _factory = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
     );
 }
Esempio n. 3
0
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
     )
 {
     _factory     = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
         );
 }
        public PythonTypeDatabase(
            PythonInterpreterFactoryWithDatabase factory,
            IEnumerable<string> databaseDirectories = null,
            PythonTypeDatabase innerDatabase = null
        ) {
            if (innerDatabase != null && factory.Configuration.Version != innerDatabase.LanguageVersion) {
                throw new InvalidOperationException("Language versions do not match");
            }

            _factory = factory;
            if (innerDatabase != null) {
                _sharedState = new SharedDatabaseState(innerDatabase._sharedState);
            } else {
                _sharedState = new SharedDatabaseState(_factory.Configuration.Version);
            }

            if (databaseDirectories != null) {
                foreach (var d in databaseDirectories) {
                    LoadDatabase(d);
                }
            }

            _sharedState.ListenForCorruptDatabase(this);
        }
 public PythonTypeDatabase CloneWithNewFactory(PythonInterpreterFactoryWithDatabase newFactory) {
     return new PythonTypeDatabase(newFactory, null, this);
 }
 public static PythonTypeDatabase CreateDefaultTypeDatabase(PythonInterpreterFactoryWithDatabase factory) {
     return new PythonTypeDatabase(factory, BaselineDatabasePath, isDefaultDatabase: true);
 }
Esempio n. 7
0
 public PythonTypeDatabase CloneWithNewFactory(PythonInterpreterFactoryWithDatabase newFactory)
 {
     return(new PythonTypeDatabase(newFactory, null, this));
 }
Esempio n. 8
0
 public static PythonTypeDatabase CreateDefaultTypeDatabase(PythonInterpreterFactoryWithDatabase factory)
 {
     return(new PythonTypeDatabase(factory, BaselineDatabasePath, isDefaultDatabase: true));
 }
Esempio n. 9
0
 /// <summary>
 /// Returns a new interpreter created with the specified factory.
 /// </summary>
 /// <remarks>
 /// This is intended for use by derived classes only. To get an
 /// interpreter instance, use <see cref="CreateInterpreter"/>.
 /// </remarks>
 public virtual IPythonInterpreter MakeInterpreter(PythonInterpreterFactoryWithDatabase factory)
 {
     return(new CPythonInterpreter(factory));
 }
 /// <summary>
 /// Returns a new interpreter created with the specified factory.
 /// </summary>
 /// <remarks>
 /// This is intended for use by derived classes only. To get an
 /// interpreter instance, use <see cref="CreateInterpreter"/>.
 /// </remarks>
 public virtual IPythonInterpreter MakeInterpreter(PythonInterpreterFactoryWithDatabase factory) {
     return new CPythonInterpreter(factory);
 }