openstack/rally's parse_docstrings()
(permalink)
take a function's docstring in reStructuredText (reST) format as an input and returns 4 values-short_description, long_description, params and returns
For e.g. if the function and its docstring is
def sample(self, task, deployment=None):
"""Start benchmark task.
Implement sample function's long description.
:param task: Path to the input task file.
:param deployment: UUID or name of the deployment
:returns: NIL
"""
Then parse_docstrings() function will return-
{ "short_description" : "Start benchmark task.",
"long_description" : "Implement sample function's long description.",
"params": [ { "name" : "task", "doc": "Path to the unput task file" },
{ "name" : "deployment", "doc" : "UUID or name of the deployment" } ]
"returns" : "NIL"
}
You can modify the above function as per your needs.