def napoleon_to_sphinx ( docstring , * * config_params ) : if "napoleon_use_param" not in config_params : config_params [ "napoleon_use_param" ] = False if "napoleon_use_rtype" not in config_params : config_params [ "napoleon_use_rtype" ] = False config = Config ( * * config_params ) return str ( GoogleDocstring ( docstring , config ) )
sphinx proper way to document python function
Convert napoleon docstring to plain sphinx string .
def napoleon_to_sphinx(docstring, **config_params):
    """
    Convert napoleon docstring to plain sphinx string.

    Args:
        docstring (str): Docstring in napoleon format.
        **config_params (dict): Whatever napoleon doc configuration you want.

    Returns:
        str: Sphinx string.
    """
    if "napoleon_use_param" not in config_params:
        config_params["napoleon_use_param"] = False

    if "napoleon_use_rtype" not in config_params:
        config_params["napoleon_use_rtype"] = False

    config = Config(**config_params)

    return str(GoogleDocstring(docstring, config))