コード例 #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
 internal SharedDatabaseState(SharedDatabaseState inner) {
     _inner = inner;
     _langVersion = _inner.LanguageVersion;
     if (_inner.BuiltinModule != null) {
         _builtinName = _inner.BuiltinModule.Name;
     } else {
         _builtinName = (_langVersion.Major == 3) ? BuiltinName3x : BuiltinName2x;
     }
 }
コード例 #3
0
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
 ) {
     _factory = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
     );
 }
コード例 #4
0
 internal SharedDatabaseState(SharedDatabaseState inner)
 {
     _inner       = inner;
     _langVersion = _inner.LanguageVersion;
     if (_inner.BuiltinModule != null)
     {
         _builtinName = _inner.BuiltinModule.Name;
     }
     else
     {
         _builtinName = (_langVersion.Major == 3) ? BuiltinName3x : BuiltinName2x;
     }
 }
コード例 #5
0
 private PythonTypeDatabase(
     PythonInterpreterFactoryWithDatabase factory,
     string databaseDirectory,
     bool isDefaultDatabase
     )
 {
     _factory     = factory;
     _sharedState = new SharedDatabaseState(
         factory.Configuration.Version,
         databaseDirectory,
         defaultDatabase: isDefaultDatabase
         );
 }
コード例 #6
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);
        }