def _indexer(self, root, index_file): # Delay indexing briefly so we don't hammer the system. print(os.environ) settings = sublime.load_settings('Python Import Magic.sublime-settings') locations = settings.get('python_path', LIB_LOCATIONS) print(locations) sublime.status_message('Loading index {0}'.format(root)) if os.path.exists(index_file): log('Loading index for {0}', root) with open(index_file) as fd: index = SymbolIndex.deserialize(fd) else: index = SymbolIndex(locations=locations) paths = self._make_python_path(root, locations=locations) log('Indexing {0} with paths {1}', root, os.path.pathsep.join(paths)) index.build_index(paths) with open(index_file, 'w') as fd: fd.write(index.serialize()) with self._lock: self._indexes[root] = index del self._threads[root] log('Ready for {0}', root, status=True)
def index(request): directory = os.path.dirname(__file__) with open(os.path.join(directory, '..', 'testing', 'test_index.json')) as fd: return SymbolIndex.deserialize(fd)
def index(request): dir = os.path.dirname(__file__) with open(os.path.join(dir, 'test_index.json')) as fd: return SymbolIndex.deserialize(fd)