Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def convert_to_vertical_table(sections):
    # Any section that only has a single row is
    # inverted, so:
    # header1 | header2 | header3
    # val1    | val2    | val2
    #
    # becomes:
    #
    # header1 | val1
    # header2 | val2
    # header3 | val3
    for i, section in enumerate(sections):
        if len(section.rows) == 1 and section.headers:
            headers = section.headers
            new_section = Section()
            new_section.title = section.title
            new_section.indent_level = section.indent_level
            for header, element in zip(headers, section.rows[0]):
                new_section.add_row([header, element])
            sections[i] = new_section
        


src/a/w/aws-cli-HEAD/tests/unit/test_table.py   aws-cli(Download)
import unittest
 
from awscli.table import Section, MultiTable, convert_to_vertical_table
 
 
    def test_convert_section_to_vertical(self):
        self.table.add_title('foo')
        self.table.add_row_header(['key1', 'key2', 'key3'])
        self.table.add_row(['val1', 'val2', 'val3'])
        convert_to_vertical_table(self.table._sections)