def _format_linedata(linedata, indent, indent_width):
    """Format specific linedata into a pleasant layout.

        "linedata" is a list of 2-tuples of the form:
            (<item-display-string>, <item-docstring>)
        "indent" is a string to use for one level of indentation
        "indent_width" is a number of columns by which the
            formatted data will be indented when printed.

    The <item-display-string> column is held to 30 columns.
    """
    lines = []
    WIDTH = 78 - indent_width
    SPACING = 2
    NAME_WIDTH_LOWER_BOUND = 13
    NAME_WIDTH_UPPER_BOUND = 30
    NAME_WIDTH = max([len(s) for s, d in linedata])
    if NAME_WIDTH < NAME_WIDTH_LOWER_BOUND:
        NAME_WIDTH = NAME_WIDTH_LOWER_BOUND
    elif NAME_WIDTH > NAME_WIDTH_UPPER_BOUND:
        NAME_WIDTH = NAME_WIDTH_UPPER_BOUND

    DOC_WIDTH = WIDTH - NAME_WIDTH - SPACING
    for namestr, doc in linedata:
        line = indent + namestr
        if len(namestr) <= NAME_WIDTH:
            line += ' ' * (NAME_WIDTH + SPACING - len(namestr))
        else:
            lines.append(line)
            line = indent + ' ' * (NAME_WIDTH + SPACING)
        line += _summarize_doc(doc, DOC_WIDTH)
        lines.append(line.rstrip())
    return lines
def _format_linedata ( linedata , indent , indent_width ) : lines = [ ] WIDTH = 78 - indent_width SPACING = 2 NAME_WIDTH_LOWER_BOUND = 13 NAME_WIDTH_UPPER_BOUND = 30 NAME_WIDTH = max ( [ len ( s ) for s , d in linedata ] ) if NAME_WIDTH < NAME_WIDTH_LOWER_BOUND : NAME_WIDTH = NAME_WIDTH_LOWER_BOUND elif NAME_WIDTH > NAME_WIDTH_UPPER_BOUND : NAME_WIDTH = NAME_WIDTH_UPPER_BOUND DOC_WIDTH = WIDTH - NAME_WIDTH - SPACING for namestr , doc in linedata : line = indent + namestr if len ( namestr ) <= NAME_WIDTH : line += ' ' * ( NAME_WIDTH + SPACING - len ( namestr ) ) else : lines . append ( line ) line = indent + ' ' * ( NAME_WIDTH + SPACING ) line += _summarize_doc ( doc , DOC_WIDTH ) lines . append ( line . rstrip ( ) ) return lines
Format specific linedata into a pleasant layout.

        "linedata" is a list of 2-tuples of the form:
            (<item-display-string>, <item-docstring>)
        "indent" is a string to use for one level of indentation
        "indent_width" is a number of columns by which the
            formatted data will be indented when printed.

    The <item-display-string> column is held to 30 columns.