void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement psiElement = descriptor.getPsiElement(); psiElement = PsiTreeUtil.getParentOfType(psiElement, PyClass.class); if (psiElement != null) { PyClass pyClass = (PyClass) psiElement; PyExpression[] superClassExpressions = pyClass.getSuperClassExpressions(); PyElementGenerator generator = PyElementGenerator.getInstance(project); if (superClassExpressions.length == 0) { pyClass.replace(generator.createFromText(LanguageLevel.getDefault(), PyClass.class, "class " + pyClass.getName() + "(" + PyNames.OBJECT + "):\n " + pyClass.getStatementList().getText())); } else { StringBuilder stringBuilder = new StringBuilder("class "); stringBuilder.append(pyClass.getName()).append("("); for (PyExpression expression: superClassExpressions) { stringBuilder.append(expression.getText()).append(", "); } stringBuilder.append(PyNames.OBJECT).append(":\n "); stringBuilder.append(pyClass.getStatementList().getText()); pyClass.replace(generator.createFromText(LanguageLevel.getDefault(), PyClass.class, stringBuilder.toString())); } } }