Iterable<LocalQuickFix> (@NotNull PyElement node, @NotNull PsiReference reference, String refName) { if (reference instanceof PyImportReference) { // TODO: Ignore references in the second part of the 'from ... import ...' expression final QualifiedName qname = QualifiedName.fromDottedString(refName); final List<String> components = qname.getComponents(); if (!components.isEmpty()) { final String packageName = components.get(0); final Module module = ModuleUtilCore.findModuleForPsiElement(node); final Sdk sdk = PythonSdkUtil.findPythonSdk(module); if (module != null && sdk != null && PyPackageUtil.packageManagementEnabled(sdk, false, true)) { return StreamEx .of(packageName, PyPsiPackageUtil.PACKAGES_TOPLEVEL.getOrDefault(packageName, "")) .filter(PyPIPackageUtil.INSTANCE::isInPyPI) .map(pkg -> new PyPackageRequirementsInspection.InstallPackageQuickFix(pkg)); } } } return Collections.emptyList(); }