Skip to content

Add template_docstring decorator which allow to template Python docstring.

Cyril Moineau requested to merge templated_doc_decorator into dev

This MR add a new decorator which allow to template the docstring. this is usefull to interpret python into the docstring. this can be used to avoid having deprecated documentation.

Usage example:

@aidge_core.utils.template_docstring("available_board", ", ".join(AVAILABLE_BOARDS.keys()))
def export(export_folder: str,
           graphview: aidge_core.GraphView,
           scheduler: aidge_core.Scheduler = None,
           board: str = "stm32h7") -> None:
    """Generate a STM32 export of an :py:class:`aidge_core.GraphView`.

    :param board: String describing the type of board you want to export to, can be one of these values: [{available_board}], defaults to "stm32h7"
    :type board: str, optional
    """

this will result in the following docstring:

"""
:param board: String describing the type of board you want to export to, can be one of [stm32h7], defaults to "stm32h7"
"""
Edited by Maxence Naud

Merge request reports

Loading