ImportPriorityChoice (@NotNull PsiElement importLocation, @NotNull PsiFileSystemItem toImport) { final VirtualFile vFile = toImport.getVirtualFile(); if (vFile == null) { return new ImportPriorityChoice(UNRESOLVED_SYMBOL_PRIORITY, toImport + " doesn't have an associated virtual file"); } final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(toImport.getProject()); final ProjectFileIndex fileIndex = projectRootManager.getFileIndex(); if (fileIndex.isInContent(vFile) && !fileIndex.isInLibraryClasses(vFile)) { return new ImportPriorityChoice(ImportPriority.PROJECT, vFile + " belongs to the project and not under interpreter paths"); } final Module module = ModuleUtilCore.findModuleForPsiElement(importLocation); final Sdk pythonSdk = module != null ? PythonSdkUtil.findPythonSdk(module) : projectRootManager.getProjectSdk(); if (PythonSdkUtil.isStdLib(vFile, pythonSdk)) { return new ImportPriorityChoice(ImportPriority.BUILTIN, vFile + " is either in lib but not under site-packages," + " or belongs to the root of skeletons," + " or is a .pyi stub definition for stdlib module"); } else { return new ImportPriorityChoice(ImportPriority.THIRD_PARTY, pythonSdk == null ? "SDK for " + vFile + " isn't found" : "Fall back value for " + vFile); } }