void (@NotNull final Project project, @NotNull final PyFunction generatedMethod, final AbstractVariableData @NotNull [] variableData, final boolean isMethod, final boolean isClassMethod, final boolean isStaticMethod) { final Map<String, String> map = createMap(variableData); // Rename parameters for (PyParameter parameter : generatedMethod.getParameterList().getParameters()) { final String name = parameter.getName(); final String newName = map.get(name); if (name != null && newName != null && !name.equals(newName)) { final Map<PsiElement, String> allRenames = new HashMap<>(); allRenames.put(parameter, newName); final UsageInfo[] usages = RenameUtil.findUsages(parameter, newName, false, false, allRenames); try { RenameUtil.doRename(parameter, newName, usages, project, new RefactoringElementListenerComposite()); } catch (IncorrectOperationException e) { RenameUtil.showErrorMessage(e, parameter, project); return; } } } // Change signature according to pass settings and final PyFunctionBuilder builder = new PyFunctionBuilder("foo", generatedMethod); if (isClassMethod) { builder.parameter("cls"); } else if (isMethod && !isStaticMethod) { builder.parameter("self"); } for (AbstractVariableData data : variableData) { if (data.isPassAsParameter()) { builder.parameter(data.getName()); } } final PyParameterList pyParameterList = builder.buildFunction().getParameterList(); generatedMethod.getParameterList().replace(pyParameterList); }