PyFunction (@NotNull final String methodName, final AbstractVariableData @NotNull [] variableData, @NotNull final PsiElement expression, @Nullable final PyUtil.MethodFlags flags, boolean isAsync) { final PyFunctionBuilder builder = new PyFunctionBuilder(methodName, expression); addDecorators(builder, flags); addFakeParameters(builder, variableData); if (isAsync) { builder.makeAsync(); } final String text; if (expression instanceof PyYieldExpression) { text = String.format("(%s)", expression.getText()); } else { text = expression.getText(); } builder.statement("return " + text); return builder.buildFunction(); }