예제 #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);
        }
예제 #2
0
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
 ) {
     _factory = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
     );
 }
예제 #3
0
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
     )
 {
     _factory     = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
         );
 }
예제 #4
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);
        }
예제 #5
0
 public PythonTypeDatabase CloneWithNewFactory(PythonInterpreterFactoryWithDatabase newFactory) {
     return new PythonTypeDatabase(newFactory, null, this);
 }
예제 #6
0
 public static PythonTypeDatabase CreateDefaultTypeDatabase(PythonInterpreterFactoryWithDatabase factory) {
     return new PythonTypeDatabase(factory, BaselineDatabasePath, isDefaultDatabase: true);
 }
예제 #7
0
 public PythonTypeDatabase CloneWithNewFactory(PythonInterpreterFactoryWithDatabase newFactory)
 {
     return(new PythonTypeDatabase(newFactory, null, this));
 }
예제 #8
0
 public static PythonTypeDatabase CreateDefaultTypeDatabase(PythonInterpreterFactoryWithDatabase factory)
 {
     return(new PythonTypeDatabase(factory, BaselineDatabasePath, isDefaultDatabase: true));
 }
예제 #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);
 }