@Override
  public ResolveResult @NotNull [] multiResolve(boolean incompleteCode) {
    if (myElement instanceof StubBasedPsiElementBase && ((StubBasedPsiElementBase<?>)myElement).getStub() == null ||
        myContext.getTypeEvalContext().maySwitchToAST(myElement)) {
      final ResolveResult[] results = super.multiResolve(incompleteCode);
      boolean shadowed = false;
      for (ResolveResult result : results) {
        final PsiElement element = result.getElement();
        if (element != null && (element.getContainingFile() != myElement.getContainingFile() ||
                                element instanceof PyFunction || element instanceof PyClass)) {
          shadowed = true;
          break;
        }
      }
      if (results.length > 0 && !shadowed) {
        return results;
      }
    }
    // resolve to self if no other target found
    return new ResolveResult[] { new PsiElementResolveResult(myElement) };
  }
@Override
  public ResolveResult @NotNull [] multiResolve(boolean incompleteCode)