Object[] (String completionPrefix, PsiElement location, ProcessingContext context) { final List<LookupElement> result = new ArrayList<>(); for (PsiElement resolveResult : ResolveResultList.getElements(myImportedModule.multiResolve())) { if (resolveResult instanceof PyFile) { final PyModuleType moduleType = new PyModuleType((PyFile)resolveResult); final TypeEvalContext typeEvalContext = TypeEvalContext.codeCompletion(location.getProject(), location.getContainingFile()); result.addAll(moduleType.getCompletionVariantsAsLookupElements(location, context, false, false, typeEvalContext)); } else if (resolveResult instanceof PsiDirectory dir) { if (PyUtil.isPackage(dir, location)) { if (ResolveImportUtil.getPointInImport(location) != PointInImport.NONE) { result.addAll(PyModuleType.getSubModuleVariants(dir, location, null)); } else { result.addAll(PyModuleType.collectImportedSubmodulesAsLookupElements(dir, location, context.get(CTX_NAMES))); } } } } return ArrayUtil.toObjectArray(result); }