void (@NotNull PyFunction function, @NotNull Processor<? super PyCallExpression> processor) { final PsiFile file = function.getContainingFile(); final String name = function.getName(); if (file != null && name != null) { // Text search is faster than ReferencesSearch in LocalSearchScope final String text = file.getText(); for (int pos = text.indexOf(name); pos != -1; pos = text.indexOf(name, pos + 1)) { final PsiReference ref = file.findReferenceAt(pos); if (ref != null && ref.isReferenceTo(function)) { final PyCallExpression expr = PsiTreeUtil.getParentOfType(file.findElementAt(pos), PyCallExpression.class); if (expr != null && !processor.process(expr)) { return; } } } } }