List<Runnable> (@NotNull Project project, @NotNull Map<Module, Sdk> moduleSdks) { final List<Runnable> results = new ArrayList<>(); for (Map.Entry<Module, Sdk> moduleToSdk : moduleSdks.entrySet()) { final Module module = moduleToSdk.getKey(); if (module.isDisposed()) continue; final Sdk sdk = moduleToSdk.getValue(); final LanguageLevel languageLevel = PythonSdkUtil.isDisposed(sdk) ? LanguageLevel.getDefault() : PythonRuntimeService.getInstance().getLanguageLevelForSdk(sdk); for (VirtualFile root : PyUtil.getSourceRoots(module)) { addRootIndexingTask(root, results, project, languageLevel, true); } } final LinkedHashSet<Sdk> distinctSdks = new LinkedHashSet<>(moduleSdks.values()); for (Sdk sdk : distinctSdks) { if (PythonSdkUtil.isDisposed(sdk)) continue; final LanguageLevel languageLevel = PythonRuntimeService.getInstance().getLanguageLevelForSdk(sdk); for (VirtualFile root : sdk.getRootProvider().getFiles(OrderRootType.CLASSES)) { if (!root.isValid() || PyTypeShed.INSTANCE.isInside(root)) { continue; } addRootIndexingTask(root, results, project, languageLevel, false); } } return results; }