void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PyElement[] elements = PySetFunctionToLiteralInspection.getSetCallArguments((PyCallExpression)descriptor.getPsiElement()); PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); PsiElement functionCall = descriptor.getPsiElement(); StringBuilder str = new StringBuilder("{"); for (int i = 0; i != elements.length; ++i) { PyElement e = elements[i]; str.append(e.getText()); if (i != elements.length-1) str.append(", "); } str.append("}"); functionCall.replace(elementGenerator.createFromText(LanguageLevel.forElement(functionCall), PyExpressionStatement.class, str.toString()).getExpression()); }