
    ܍~c                           G d  d          Z dS )c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
SimpleTablezRA minimal implementation of PrettyTable
    for distribution with cloud-init.
    c                     || _         g | _        dgt          | j                   z  | _        |                     |           d S )N    )fieldsrowslencolumn_widthsupdate_column_widths)selfr   s     7/usr/lib/python3/dist-packages/cloudinit/simpletable.py__init__zSimpleTable.__init__   sE    	  S3t{#3#33!!&)))))    c                     t          |          D ]5\  }}t          t          |          | j        |                   | j        |<   6d S N)	enumeratemaxr   r	   )r   valuesivalues       r   r
   z SimpleTable.update_column_widths   sS    !&)) 	K 	KHAu$'E

D4Fq4I$J$JDq!!	K 	Kr   c                     t          |          t          | j                  k    rt          d          d |D             }| j                            |           |                     |           d S )Nztoo many valuesc                 ,    g | ]}t          |          S  )str).0r   s     r   
<listcomp>z'SimpleTable.add_row.<locals>.<listcomp>   s    111#e**111r   )r   r   	TypeErrorr   appendr
   )r   r   s     r   add_rowzSimpleTable.add_row   so    v;;T[))))-...11&111	   !!&)))))r   c                 V    dd                     d | j        D                       z   dz   S )z+Returns a horizontal divider for the table.+c                     g | ]
}d |dz   z  S )-   r   )r   ws     r   r   z%SimpleTable._hdiv.<locals>.<listcomp>%   s     FFFaC1q5MFFFr   )joinr	   r   s    r   _hdivzSimpleTable._hdiv"   s4     #((FF43EFFFGGG#M	
r   c                 l     dd                      fdt          |          D                       z   dz   S )zReturns a formatted row.|c                 \    g | ](\  }}|                     j        |         d z             )S )r#   )centerr	   )r   r   colr   s      r   r   z$SimpleTable._row.<locals>.<listcomp>-   sF       3 JJt1!4q899  r   )r%   r   )r   rows   ` r   _rowzSimpleTable._row(   sY     hh   "+C..    		
r   c                                                                             j                                                    g}| fd j        D                                               gz   z  }d                    |          S )zReturns a string representation of the table with lines around.

        +-----+-----+
        | one | two |
        +-----+-----+
        |  1  |  2  |
        |  01 |  10 |
        +-----+-----+
        c                 :    g | ]}                     |          S r   )r.   )r   rr   s     r   r   z'SimpleTable.__str__.<locals>.<listcomp>@   s#    2221$))A,,222r   
)r'   r.   r   r   r%   )r   liness   ` r   __str__zSimpleTable.__str__5   sq     tyy55tzz||D2222	222djjll^CCyyr   c                 *    |                                  S r   )r4   r&   s    r   
get_stringzSimpleTable.get_stringC   s    ||~~r   N)__name__
__module____qualname____doc__r   r
   r   r'   r.   r4   r6   r   r   r   r   r   	   s         * * *K K K* * *
 
 

 
 
         r   r   N)r   r   r   r   <module>r;      s7   ; ; ; ; ; ; ; ; ; ;r   