FindUsagesHandlerBase (@NotNull final PsiElement element) { if (element instanceof PyFunction) { final TypeEvalContext context = TypeEvalContext.userInitiated(element.getProject(), null); final Collection<PsiElement> superMethods = PySuperMethodsSearch.search((PyFunction)element, true, context).findAll(); if (superMethods.size() > 0) { final PsiElement next = superMethods.iterator().next(); if (next instanceof PyFunction && !isInObject((PyFunction)next)) { List<PsiElement> allMethods = new ArrayList<>(); allMethods.add(element); allMethods.addAll(superMethods); return new PyFunctionFindUsagesHandler(element, allMethods); } } return new PyFunctionFindUsagesHandler(element); } if (element instanceof PyClass) { return new PyClassFindUsagesHandler((PyClass)element); } return null; }