HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/__pycache__/align.cpython-310.pyc
o

��hT(�@s@ddlmZddlmZmZmZmZddlmZddl	m
Z
ddlmZddl
mZddlmZer>dd	lmZmZmZmZed
ZedZGdd
�d
e
�ZGdd�de
�Zedkr�ddlmZmZddlmZddlm Z e�Z!e�Ze ee�"e!d��e�#e!d��e�$e!d���ddd
d�Z%e�&ej#e%ddej'd��dSdS)�)�chain)�
TYPE_CHECKING�Iterable�Optional�Literal�)�	Constrain)�JupyterMixin)�Measurement)�Segment)�	StyleType)�Console�ConsoleOptions�RenderableType�RenderResult��left�center�right��top�middle�bottomc@steZdZdZ		d"ddddd�ddded	eed
eededee	d
ee	ddfdd�Z
defdd�Ze
	d#ddddd�ddd	eed
eededee	d
ee	ddfdd��Ze
	d#ddddd�ddd	eed
eededee	d
ee	ddfdd��Ze
	d#ddddd�ddd	eed
eededee	d
ee	ddfdd��Z						d$dd�Zdddddefd d!�ZdS)%�AlignaAlign a renderable by adding spaces if necessary.

    Args:
        renderable (RenderableType): A console renderable.
        align (AlignMethod): One of "left", "center", or "right""
        style (StyleType, optional): An optional style to apply to the background.
        vertical (Optional[VerticalAlignMethod], optional): Optional vertical align, one of "top", "middle", or "bottom". Defaults to None.
        pad (bool, optional): Pad the right with spaces. Defaults to True.
        width (int, optional): Restrict contents to given width, or None to use default width. Defaults to None.
        height (int, optional): Set height of align renderable, or None to fit to contents. Defaults to None.

    Raises:
        ValueError: if ``align`` is not one of the expected values.
    rNT)�vertical�pad�width�height�
renderabler�align�stylerrrr�returncCsf|dvrtd|�d���|dur|dvrtd|�d���||_||_||_||_||_||_||_dS)NrzDinvalid value for align, expected "left", "center", or "right" (not �)rzGinvalid value for vertical, expected "top", "middle", or "bottom" (not )�
ValueErrorrrr rrrr)�selfrrr rrrr�r%�A/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/align.py�__init__!s
�
�
zAlign.__init__cCsd|j�d|j�d�S)NzAlign(z, r")rr�r$r%r%r&�__repr__<szAlign.__repr__c	C�||d|||||d�S)zAlign a renderable to the left.r�r rrrrr%��clsrr rrrrr%r%r&r?��z
Align.leftc	Cr*)z!Align a renderable to the center.rr+r%r,r%r%r&rUr.zAlign.centerc	Cr*)z Align a renderable to the right.rr+r%r,r%r%r&rkr.zAlign.right�consoler
�optionsrrc#s���j�|j�j|d�j}|�t�j�jdur|nt|�j��|jdd��}t	t
�|���t
���\}}t
�
�||��t
���|j|��jdurO|��j�nd�dtt
f������fdd�}�jrrt
d�jpk|j�d���nt
d��dtdtt
f�fd	d
�}�jp�|j}�jr�|dur̈jdkr�||}	t|�||	��}
n-�jdkr�||d
}|||}	t||�|�||	��}
n||}t||�|��}
n|�}
�jr�|��j��t
�|
��}
|
EdHdS)N)r0�rr!c3s��dkr�D]
}|EdH�VqdS�dkr8�jr"td���nd}�D]}|EdH|r2|V�Vq&dS�dkrn�d}td|��}�jrStd�|��nd}�D]}|r^|V|EdH|rh|V�VqWdS�dkr�td���}�D]}|V|EdH�Vq{dSdS)Nrr� r�r)rr)�linerr�	pad_right)r�excess_space�lines�new_liner$r r%r&�generate_segments�sF�
�
��
�
�z1Align.__rich_console__.<locals>.generate_segmentsr2�
�countc3s&�|dkrt|�D]}�Vq	dSdS)Nr��range�r;�_)�
blank_liner%r&�blank_lines�s��z+Align.__rich_console__.<locals>.blank_linesrrr3)r�measurer�maximum�renderrr�min�update�listr�split_lines�	get_shape�	set_shaper4�	max_widthr �	get_stylerr�intrrr�apply_style)r$r/r0r�renderedrr9rA�vertical_height�bottom_space�
iter_segments�	top_spacer%)rr@r6r7r8r$r r&�__rich_console__�sR��
�
 )��

�zAlign.__rich_console__cC�t�|||j�}|S�N�r
�getr�r$r/r0�measurementr%r%r&�__rich_measure__��zAlign.__rich_measure__)rNrV�r/r
r0rr!r)�__name__�
__module__�__qualname__�__doc__�AlignMethodrr�VerticalAlignMethod�boolrMr'�strr)�classmethodrrrrTr
r[r%r%r%r&rs���������	�

���������	���������	���������	���
�\���rc@sheZdZdZ	ddddeeddfdd�Zdefd	d
�Z			
			ddd�Z	ddd
dde
fdd�ZdS)�VerticalCenteraTVertically aligns a renderable.

    Warn:
        This class is deprecated and may be removed in a future version. Use Align class with
        `vertical="middle"`.

    Args:
        renderable (RenderableType): A renderable object.
        style (StyleType, optional): An optional style to apply to the background. Defaults to None.
    Nrrr r!cCs||_||_dSrV)rr )r$rr r%r%r&r'�s
zVerticalCenter.__init__cCsd|j�d�S)NzVerticalCenter(r")rr(r%r%r&r)�szVerticalCenter.__repr__r/r
r0rrc#s��|jdur|�|j�nd}|j|j|jdd�dd�}t�|�\}}t���|jp,|j	j}|t
|�d}||t
|�}	td|�|��dtdttf��fdd	�}
|d
kr^|
|�EdH|D]
}|EdH�Vq`|	d
krx|
|	�EdHdSdS)Nr1F)rr3r2r;r!c3s �t|�D]}�V�VqdSrVr<r>�r@r8r%r&rA	s
��z4VerticalCenter.__rich_console__.<locals>.blank_linesr)
r rL�render_linesrrFrrIr4r�size�lenrMr)r$r/r0r r7r�_heightrrSrQrAr4r%rhr&rT�s(��
�zVerticalCenter.__rich_console__cCrUrVrWrYr%r%r&r[r\zVerticalCenter.__rich_measure__rVr])r^r_r`rarrr'rer)rTr
r[r%r%r%r&rg�s2���
���
����rg�__main__)r
�Group)�ReprHighlighter)�Panelzalign='left'zalign='center'z
align='right'�<zon dark_blue)rr �titlerzon red)rr rN)(�	itertoolsr�typingrrrr�	constrainr�jupyterr	rBr
�segmentrr rr/r
rrrrbrcrrgr^�pip._vendor.rich.consolern�pip._vendor.rich.highlighterro�pip._vendor.rich.panelrp�highlighterrrr�panel�printrr%r%r%r&�<module>sDT9����