private static void updateSysPath(@NotNull final Sdk sdk) throws InvalidSdkException { long start_time = System.currentTimeMillis(); final List<String> sysPath = PythonSdkType.getSysPath(sdk.getHomePath()); final VirtualFile file = PyUserSkeletonsUtil.getUserSkeletonsDirectory(); if (file != null) { sysPath.add(file.getPath()); } ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { updateSdkPath(sdk, sysPath); } }); LOG.info("Updating sys.path took " + (System.currentTimeMillis() - start_time) + " ms"); }
@NotNull public static List<PyFile> find( @NotNull String name, @NotNull Project project, boolean includeNonProjectItems) { final List<PyFile> results = new ArrayList<PyFile>(); final GlobalSearchScope scope = includeNonProjectItems ? PyProjectScopeBuilder.excludeSdkTestsScope(project) : GlobalSearchScope.projectScope(project); final Collection<VirtualFile> files = FileBasedIndex.getInstance().getContainingFiles(NAME, name, scope); for (VirtualFile virtualFile : files) { final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (psiFile instanceof PyFile) { if (!PyUserSkeletonsUtil.isUnderUserSkeletonsDirectory(psiFile)) { results.add((PyFile) psiFile); } } } return results; }