Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/clint/textui/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clint/textui/__pycache__/formatters.cpython-37.pyc

B

���U
�@sLdZddlmZddlmZmZddlmZmZdZ	dd	d
�Z
ddd
�ZdS)zb
clint.textui.formatters
~~~~~~~~~~~~~~~~~~~~~~~

Core TextUI functionality for text formatting.

�)�absolute_import�)�
ColoredString�clean�)�tsplit�schunk)�
�
z
� cCsht|t�}tt|�t�}xDt|�D]8\}}t|��|d|�}|rR|�t|�|�}|||<q"Wd�	|�S)z(Returns given string with right padding.rr	)
�
isinstancerr�str�NEWLINES�	enumerater�ljust�replace�join)�string�cols�padding�is_color�stack�i�	substring�_sub�r�H/opt/alt/python37/lib/python3.7/site-packages/clint/textui/formatters.py�	min_widths
rr	cCst|t�}|r|�d�}|j}t|t�}x t|�D]\}}|��||<q2Wg}�x�|D�]�}	dg}
d}�x`|	D�]F}t|
|�t|�|kr�|
||7<|
|d7<qnt|�|k�rtt|
|�r�|
|�	�|
|<|
�
d�|d7}t||�}
x�t|
�D]p\}}|dt|
�k�sL|
||7<|
|�	�|
|<|
�
d�|d7}n |
||7<|
|d7<�q�Wqn|
|�	�|
|<|
�
d�|d7}|
||7<|
|d7<qnW|
|�	�|
|<tt
|
�}
|�
|�|
��qVWd�|�}|�r|�|�}|S)a�Returns a freshly formatted
    :param string: string to be formatted
    :type string: basestring or clint.textui.colorred.ColoredString
    :param cols: max width the text to be formatted
    :type cols: int
    :param separator: separator to break rows
    :type separator: basestring

        >>> formatters.max_width('123 5678', 8)
        '123 5678'
        >>> formatters.max_width('123 5678', 7)
        '123 
5678'

    �rrrr	)rr�_new�srrr�split�len�rstrip�appendr�mapr
r)rr�	separatorr�string_copyrrr�_stack�row�_row�_row_i�word�chunks�chunk�_srrr�	max_width$sR










r0N)r)r	)�__doc__�
__future__r�coloredrr�utilsrrrrr0rrrr�<module>	s