boolean (@NotNull PsiNameIdentifierOwner element, @NotNull PsiElement originalElement) { // Target expressions in the same scope are treated as the same variable if ((element instanceof PyTargetExpression) && originalElement instanceof PyTargetExpression) { return false; } // Renaming an __init__ method results in renaming its class else if (PyUtil.isInitMethod(element)) { return false; } return true; }