@Override
  public Object @NotNull [] getVariants() {
    final List<LookupElement> result = new ArrayList<>();

    final PyFile containingFile = (PyFile)getElement().getContainingFile().getOriginalFile();

    final List<String> dunderAll = containingFile.getDunderAll();
    final Set<String> seenNames = new HashSet<>();
    if (dunderAll != null) {
      seenNames.addAll(dunderAll);
    }

    containingFile.processDeclarations(new PsiScopeProcessor() {
      @Override
      public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
        if (element instanceof PsiNamedElement && !(element instanceof LightNamedElement)) {
          final String name = ((PsiNamedElement)element).getName();
          if (name != null && PyUtil.getInitialUnderscores(name) == 0 && !seenNames.contains(name)) {
            seenNames.add(name);
            result.add(toLookupElement(name, element, true));
          }
        }
        else if (element instanceof PyImportElement) {
          final String visibleName = ((PyImportElement)element).getVisibleName();
          if (visibleName != null && !seenNames.contains(visibleName)) {
            seenNames.add(visibleName);
            result.add(toLookupElement(visibleName, element, false));
          }
        }
        return true;
      }
    }, ResolveState.initial(), null, containingFile);

    result.addAll(PyModuleType.getSubModuleVariants(containingFile.getParent(), getElement(), seenNames));

    return ArrayUtil.toObjectArray(result);
  }
@Override
  public Object @NotNull [] getVariants()