Writing Docstrings - Samuel-Buteau/universal-battery-database GitHub Wiki

Generally, we follow Google's Python Style Guide. This applies for Docstrings. A simple template is given as follows.

""" Description for the class/method/function

Description can extend over multiple lines.
Sections are created with a section header and a colon followed
by a block of indented text.

Example:
    Given examples using ``Example`` or ``Examples`` sections.
    Sections support any reStructuredText formatting, including
    literal blocks::

        $ python example_google.py

Attributes:
    attribute1 (type): Description for attribute1.
    attribute1 (type): Description for attribute1.

Args:
    arg1 (type): Description for arg1.
    arg2 (type): Description for arg2.

Returns:
    type: Description for return value.

Raises:
    ErrorName: Description of error.

Todo:
    For module TODOs.
"""