bugwarrior/docs/generate_service_template.py
def make_table(grid):
    """ Make a RST-compatible table

    From http://stackoverflow.com/a/12539081

    """
    cell_width = 2 + max(
        reduce(
            lambda x, y: x+y, [[len(item) for item in row] for row in grid], []
        )
    )
    num_cols = len(grid[0])
    rst = table_div(num_cols, cell_width, 0)
    header_flag = 1
    for row in grid:
        rst = rst + '| ' + '| '.join(
            [normalize_cell(x, cell_width-1) for x in row]
        ) + '|\n'
        rst = rst + table_div(num_cols, cell_width, header_flag)
        header_flag = 0
    return rst
def make_table(grid):
    """ Make a RST-compatible table

    From http://stackoverflow.com/a/12539081

    """
    cell_width = 2 + max(
        reduce(
            lambda x, y: x+y, [[len(item) for item in row] for row in grid], []
        )
    )
    num_cols = len(grid[0])
    rst = table_div(num_cols, cell_width, 0)
    header_flag = 1
    for row in grid:
        rst = rst + '| ' + '| '.join(
            [normalize_cell(x, cell_width-1) for x in row]
        ) + '|\n'
        rst = rst + table_div(num_cols, cell_width, header_flag)
        header_flag = 0
    return rst
Make a RST-compatible table

    From http://stackoverflow.com/a/12539081