Expand docstring to include 'attributes', 'raises', 'notes'.
Answered
I'm hoping to be able to customize the docstring that's auto-populated to allow content like attributes, yields, raises, notes, etc. Is there a way to do this? If not, where would I need to go in the code to make the changes myself? Specifically where in the code is my function processed to generate the docstring? I've provided an example of what I'm hoping the docstring is able to generate.
Ultimately I want to work with something similar to the autodocstring plugin in VSCode which allows things like attributes and yields to be defined using regex.
def foo(var1, var2, long_var_name='hi'): r"""Summarize the function in one line. Several sentences providing an extended description. Refer to variables using back-ticks, e.g. `var`. Parameters ---------- var1 : array_like Array_like means all those objects -- lists, nested lists, etc. -- that can be converted to an array. We can also refer to variables like `var1`. var2 : int The type above can either refer to an actual Python type (e.g. ``int``), or describe the type of the variable in more detail, e.g. ``(N,) ndarray`` or ``array_like``. long_var_name : {'hi', 'ho'}, optional Choices in brackets, default first when optional. Returns ------- out : str Explanation of `out`.
return out
Please sign in to leave a comment.
Answered in the following comment https://youtrack.jetbrains.com/issue/PY-12327#focus=streamItem-27-3960690.0-0