void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); PsiElement importStatement = descriptor.getPsiElement(); if (importStatement instanceof PyImportStatement) { for (PyImportElement importElement : ((PyImportStatement)importStatement).getImportElements()) { PyReferenceExpression importReference = importElement.getImportReferenceExpression(); if (importReference != null) { if ("__builtin__".equals(importReference.getName())) { importReference.replace(elementGenerator.createExpressionFromText(LanguageLevel.getDefault(), "builtins")); } if ("builtins".equals(importReference.getName())) { importReference.replace(elementGenerator.createExpressionFromText(LanguageLevel.getDefault(), "__builtin__")); } } } } }