Skip to content

Instantly share code, notes, and snippets.

@samj1912
Last active October 14, 2019 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samj1912/ec4bd35bbf059b0828b50a573603ef67 to your computer and use it in GitHub Desktop.
Save samj1912/ec4bd35bbf059b0828b50a573603ef67 to your computer and use it in GitHub Desktop.
Before and after running code through pygmend

Before

def test():
    """This is an example of a module level function. Function parameters should be documented in the ``Args`` section. The name
    of each parameter is required. The type and description of each parameter
    is optional, but should be included if not obvious.

    If \*args or \*\*kwargs are accepted,
    they should be listed as ``*args`` and ``**kwargs``.

    The format for a parameter is::

name (type): description
The description may span multiple lines. Following
lines should be indented. The "(type)" is optional.

Multiple paragraphs are supported in parameter
descriptions.

    Args:
    param1 (int): The first parameter.
        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
    Second line of description should be indented.
        *args: Variable length argument list.
    **kwargs: Arbitrary keyword arguments.
Returns:
        bool: True if successful, False otherwise.

The return type is optional and may be specified at the beginning of
        the ``Returns`` section followed by a colon.

        The ``Returns`` section may span multiple lines and paragraphs.
Following lines should be indented to match the first line.

        The ``Returns`` section supports any reStructuredText formatting,
        including literal blocks::

            {
                'param1': param1,
                'param2': param2
            }
    Raises:
        AttributeError: The ``Raises`` section is a list of all exceptions
    that are relevant to the interface.
        ValueError: If `param2` is equal to `param1`.
    """

After

def test():
    """This is an example of a module level function.

    Function parameters should be documented in the ``Args`` section. The name
    of each parameter is required. The type and description of each parameter
    is optional, but should be included if not obvious.

    If \*args or \*\*kwargs are accepted, they should be listed as ``*args``
    and ``**kwargs``.

    The format for a parameter is::
        name (type): description The description may span multiple lines.
        Following lines should be indented. The "(type)" is optional.

        Multiple paragraphs are supported in parameter descriptions.

    Args:
        param1 (int): The first parameter.
        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
            Second line of description should be indented.
        *args: Variable length argument list.
        **kwargs: Arbitrary keyword arguments.

    Returns:
        bool: True if successful, False otherwise.

        The return type is optional and may be specified at the beginning of
        the ``Returns`` section followed by a colon.

        The ``Returns`` section may span multiple lines and paragraphs.
        Following lines should be indented to match the first line.

        The ``Returns`` section supports any reStructuredText formatting,
        including literal blocks::

        { 'param1': param1, 'param2': param2 }

    Raises:
        AttributeError: The ``Raises`` section is a list of all exceptions that
            are relevant to the interface.
        ValueError: If `param2` is equal to `param1`.

    """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment