Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up docstring formatting #59

Open
jburos opened this issue Feb 24, 2017 · 0 comments
Open

Clean up docstring formatting #59

jburos opened this issue Feb 24, 2017 · 0 comments

Comments

@jburos
Copy link
Member

jburos commented Feb 24, 2017

Currently docstrings are in a variety of formats since I was testing out which could be rendered best by sphinx, to generate online documentation.

A todo item is to clean then up to apply consistent formatting. Now that we have the napoleon sphinx extension installed when generating docs, we can use Google-style docstrings. The older docstrings should be converted to a more legible style.

Style examples (from Napoleon's RTD site):

RST format

This is the "old" style, which we want to move away from.

:param path: The path of the file to wrap
:type path: str
:param field_storage: The :class:`FileStorage` instance to wrap
:type field_storage: FileStorage
:param temporary: Whether or not to delete the file when the File
   instance is destructed
:type temporary: bool
:returns: A buffered writable file descriptor
:rtype: BufferedFileStorage

Google style

This is one of the recommended styles, per Google's style guide.

def func(arg1, arg2):
    """Summary line.

    Extended description of function.

    Args:
        arg1 (int): Description of arg1
        arg2 (str): Description of arg2

    Returns:
        bool: Description of return value

    """
    return True

NumPy style

Another common & more legible style.

def func(arg1, arg2):
    """Summary line.

    Extended description of function.

    Parameters
    ----------
    arg1 : int
        Description of arg1
    arg2 : str
        Description of arg2

    Returns
    -------
    bool
        Description of return value

    """
    return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant