void (@NotNull Project project, Editor editor, @NotNull PyFunction function) { final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(function); PyExpression returnType = SpecifyTypeInPy3AnnotationsIntention.annotateReturnType(project, function, false); if (returnType != null) { builder.replaceElement(returnType, returnType.getText()); } PyParameter[] params = function.getParameterList().getParameters(); for (int i = params.length - 1; i >= 0; i--) { if (params[i] instanceof PyNamedParameter && !params[i].isSelf()) { params[i] = SpecifyTypeInPy3AnnotationsIntention.annotateParameter(project, editor, (PyNamedParameter)params[i], false); } } for (int i = params.length - 1; i >= 0; i--) { if (params[i] instanceof PyNamedParameter) { if (!params[i].isSelf()) { params[i] = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(params[i]); PyAnnotation annotation = ((PyNamedParameter)params[i]).getAnnotation(); if (annotation != null) { PyExpression annotationValue = annotation.getValue(); if (annotationValue != null) { builder.replaceElement(annotationValue, annotationValue.getText()); } } } } } startTemplate(project, function, builder); }