Example #1
0
def transform_list_to_table(l: lists.HeaderContentList) -> table.Table:
    rows = []
    for item in l.items:
        assert isinstance(item, lists.HeaderContentListItem)
        header_cell = cell([Paragraph([item.header])])
        value_cell = cell(item.content_paragraph_items)
        rows.append([header_cell, value_cell])
    return table.Table(table.TableFormat(),
                       rows)
Example #2
0
def result_sub_dir_files_table() -> docs.ParagraphItem:
    def row(name: str, file_name: str) -> List[TableCell]:
        return [
            docs.cell(docs.paras(name)),
            docs.cell(
                docs.paras(
                    file_name_text(sds.SUB_DIRECTORY__RESULT + '/' +
                                   file_name)))
        ]

    rows = [
        row(misc_texts.EXIT_CODE.singular, sds.RESULT_FILE__EXITCODE),
        row(misc_texts.STDOUT, sds.RESULT_FILE__STDOUT),
        row(misc_texts.STDERR, sds.RESULT_FILE__STDERR),
    ]

    return table.Table(table.TableFormat(first_column_is_header=True), rows)
Example #3
0
def plain_table(rows: List[List[TableCell]],
                column_separator: str = '  ') -> ParagraphItem:
    return table.Table(table.TableFormat(column_separator), rows)
Example #4
0
def first_row_is_header_table(rows: List[List[TableCell]],
                              column_separator: str = '  ') -> ParagraphItem:
    return table.Table(
        table.TableFormat(column_separator, first_row_is_header=True), rows)