fml_doc_gen.generate_template ============================= .. py:module:: fml_doc_gen.generate_template Attributes ---------- .. autoapisummary:: fml_doc_gen.generate_template.DOCSTRING_TEMPLATE fml_doc_gen.generate_template.DOCSTRING_PARAMETERS_TEMPLATE fml_doc_gen.generate_template.DOCSTRING_PARAMETER_TEMPLATE fml_doc_gen.generate_template.DOCSTRING_OUTPUT_TEMPLATE fml_doc_gen.generate_template.DOCSTRING_PARAMETER_TYPE_PLACEHOLDER Functions --------- .. autoapisummary:: fml_doc_gen.generate_template.generate_template Module Contents --------------- .. py:data:: DOCSTRING_TEMPLATE :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ {function_name}: ### INSERT FUNCTION DEFINITION HERE ### {function_parameters} {function_output} Examples: -------- ### INSERT FUNCTION EXAMPLE USAGES HERE ### """ .. raw:: html
.. py:data:: DOCSTRING_PARAMETERS_TEMPLATE :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ Parameters: ---------- {function_params_str} """ .. raw:: html
.. py:data:: DOCSTRING_PARAMETER_TEMPLATE :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ {param_name}: {param_type} ### INSERT PARAMETER DEFINITION HERE ### """ .. raw:: html
.. py:data:: DOCSTRING_OUTPUT_TEMPLATE :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ Returns: ------- {function_output_type} ### INSERT ADDITIONAL FUNCTION OUTPUT INFORMATION HERE ### """ .. raw:: html
.. py:data:: DOCSTRING_PARAMETER_TYPE_PLACEHOLDER :value: '...' .. py:function:: generate_template(function_signature: fml_doc_gen.func_dto.FunctionDTO) -> str Generates a formatted docstring template for a function based on its name, inputs, and output type. :param function_signature: An object containing metadata about the function, including its name, input parameters, and output type. The `inputs` attribute should be a list of tuples where each tuple contains the name and type of a parameter. :type function_signature: FunctionDTO :returns: A string representing the generated docstring template for the function, formatted with placeholders for detailed parameter and return value descriptions. :rtype: str :raises ValueError: If the `name` attribute of the `function_signature` is empty. .. rubric:: Example >>> function_signature = FunctionDTO( ... name="add_numbers", ... output="int", ... inputs=[("a", "int"), ("b", "int")] ... ) >>> generate_template(function_signature)