boolean (@NotNull PsiElement element, @NotNull ResolveState state) { final PsiNamedElement namedElement = PyUtil.as(element, PsiNamedElement.class); if (namedElement != null && myName.equals(namedElement.getName())) { return tryAddResult(element, null); } final PyImportedNameDefiner importedNameDefiner = PyUtil.as(element, PyImportedNameDefiner.class); if (importedNameDefiner != null) { final List<RatedResolveResult> results = resolveInImportedNameDefiner(importedNameDefiner); if (!results.isEmpty()) { boolean cont = true; for (RatedResolveResult result : results) { final PsiElement resolved = result.getElement(); if (resolved != null) { cont = tryAddResult(resolved, importedNameDefiner) && cont; } } return cont; } final PyImportElement importElement = PyUtil.as(element, PyImportElement.class); if (importElement != null) { final String importName = importElement.getVisibleName(); if (myName.equals(importName)) { return tryAddResult(null, importElement); } } } return myOwner == null || myOwner == ScopeUtil.getScopeOwner(element); }