boolean (@Nullable PsiElement element, @Nullable PyImportedNameDefiner definer) { PsiElement psiElement = definer != null ? definer : element; if (element instanceof PyTypeParameter) return false; if (inSameScope(psiElement, myLocation)) { if (PsiTreeUtil.isAncestor(psiElement, myLocation, false) || PyDefUseUtil.isDefinedBefore(psiElement, myLocation) || inDifferentBranchesOfSameIfStatement(psiElement, myLocation)) { if (myOwner == null) { myOwner = ScopeUtil.getScopeOwner(psiElement); } addResult(element, definer); } return true; } return super.tryAddResult(element, definer); }