
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
\¼me¸  ã               @   s   G d d„ dƒZ dS )c               @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚSimpleTablezRA minimal implementation of PrettyTable
    for distribution with cloud-init.
    c             C   s,   || _ g | _dgt| j ƒ | _| j|ƒ d S )Né    )ÚfieldsÚrowsÚlenÚcolumn_widthsÚupdate_column_widths)Úselfr   © r	   ú!/usr/lib/python3.6/simpletable.pyÚ__init__   s    zSimpleTable.__init__c             C   s4   x.t |ƒD ]"\}}tt|ƒ| j| ƒ| j|< q
W d S )N)Ú	enumerateÚmaxr   r   )r   ÚvaluesÚiÚvaluer	   r	   r
   r      s    z SimpleTable.update_column_widthsc             C   sB   t |ƒt | jƒkrtdƒ‚dd„ |D ƒ}| jj|ƒ | j|ƒ d S )Nztoo many valuesc             S   s   g | ]}t |ƒ‘qS r	   )Ústr)Ú.0r   r	   r	   r
   ú
<listcomp>   s    z'SimpleTable.add_row.<locals>.<listcomp>)r   r   Ú	TypeErrorr   Úappendr   )r   r   r	   r	   r
   Úadd_row   s
    zSimpleTable.add_rowc             C   s   ddj dd„ | jD ƒƒ d S )z+Returns a horizontal divider for the table.ú+c             S   s   g | ]}d |d  ‘qS )ú-é   r	   )r   Úwr	   r	   r
   r   %   s    z%SimpleTable._hdiv.<locals>.<listcomp>)Újoinr   )r   r	   r	   r
   Ú_hdiv"   s    zSimpleTable._hdivc                s$   ddj ‡ fdd„t|ƒD ƒƒ d S )zReturns a formatted row.ú|c                s$   g | ]\}}|j ˆ j| d  ƒ‘qS )r   )Úcenterr   )r   r   Úcol)r   r	   r
   r   .   s   z$SimpleTable._row.<locals>.<listcomp>)r   r   )r   Úrowr	   )r   r
   Ú_row(   s    
zSimpleTable._rowc                sF   ˆ j ƒ ˆ jˆ jƒˆ j ƒ g}|‡ fdd„ˆ jD ƒˆ j ƒ g 7 }dj|ƒS )zÍReturns a string representation of the table with lines around.

        +-----+-----+
        | one | two |
        +-----+-----+
        |  1  |  2  |
        |  01 |  10 |
        +-----+-----+
        c                s   g | ]}ˆ j |ƒ‘qS r	   )r!   )r   Úr)r   r	   r
   r   @   s    z'SimpleTable.__str__.<locals>.<listcomp>Ú
)r   r!   r   r   r   )r   Úlinesr	   )r   r
   Ú__str__5   s    
"zSimpleTable.__str__c             C   s   | j ƒ S )N)r%   )r   r	   r	   r
   Ú
get_stringC   s    zSimpleTable.get_stringN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r!   r%   r&   r	   r	   r	   r
   r   	   s   	r   N)r   r	   r	   r	   r
   Ú<module>	   s    