3

Lets say I have the following function with a docstring:

def foo(*args):
    """
    do some fooness

    +----------------------------+----------------------------------------------------+
    | kind                       | ndb property                                       |
    +============================+====================================================+
    | :func:`unicode`            | :class:`google.appengine.ext.ndb.StringProperty`   |
    +----------------------------+----------------------------------------------------+
    | :class:`datetime.datetime` | :class:`google.appengine.ext.ndb.DateTimeProperty` |
    +----------------------------+----------------------------------------------------+

    Args:
        args: some arguments

    """

The table lines are too long. So flake8 complains about this.

In order to fix this I came up with the following:

def foo(*args):
    ("""
    do some fooness

    """
    '\n    +----------------------------+----------------------------------------------------+'  # noqa
    '\n    | kind                       | ndb property                                       |'  # noqa
    '\n    +============================+====================================================+'  # noqa
    '\n    | :func:`unicode`            | :class:`google.appengine.ext.ndb.StringProperty`   |'  # noqa
    '\n    +----------------------------+----------------------------------------------------+'  # noqa
    '\n    | :class:`datetime.datetime` | :class:`google.appengine.ext.ndb.DateTimeProperty` |'  # noqa
    '\n    +----------------------------+----------------------------------------------------+'  # noqa
    """    

    Args:
        args: some arguments

    """)

This works, but I think it's really ugly. Is there a less ugly solution to this problem?

0

Browse other questions tagged or ask your own question.