List<RatedResolveResult> (PyFromImportStatement importStatement, @NotNull QualifiedName qName) { PsiFile file = importStatement.getContainingFile().getOriginalFile(); String name = qName.getComponents().get(0); final List<RatedResolveResult> results = new ArrayList<>(); final List<PsiElement> candidates = importStatement.resolveImportSourceCandidates(); for (PsiElement candidate : candidates) { if (!candidate.isValid()) { throw new PsiInvalidElementAccessException(candidate, "Got an invalid candidate from resolveImportSourceCandidates(): " + candidate.getClass()); } if (candidate instanceof PsiDirectory) { final var packageElement = PyUtil.getPackageElement((PsiDirectory)candidate, importStatement); if (packageElement != importStatement.getContainingFile()) { candidate = packageElement; } } results.addAll(resolveChildren(candidate, name, file, false, true, false, false)); } return updateRatedResults(PyStubPackages.removeRuntimeModulesForWhomStubModulesFound(results)); }