boolean (@NotNull PsiElement element) { if (!(element instanceof PyClass)) { return false; } ScopeOwner scopeOwner = PsiTreeUtil.getParentOfType(element, ScopeOwner.class); if (scopeOwner instanceof PyFile) { String className = ((PyClass) element).getName(); String fileName = FileUtilRt.getNameWithoutExtension(scopeOwner.getName()); return fileName.equalsIgnoreCase(className); } return false; }