HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/rich/__pycache__/panel.cpython-37.pyc
B

L��gN)�@sddlmZmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZmZdd	lmZdd
lmZmZddlmZmZer�ddlmZmZmZmZGd
d�de�Ze dk�rddlmZe�Z!ddlm"Z"mZddlmZeddde"dd�Z#e!�$�e!�$e#�dS)�)�
TYPE_CHECKING�Optional�)�AlignMethod)�ROUNDED�Box)�cell_len)�JupyterMixin)�Measurement�measure_renderables)�Padding�PaddingDimensions)�Segment)�Style�	StyleType)�Text�TextType)�Console�ConsoleOptions�RenderableType�RenderResultc@seZdZdZefddddddddddddd�d	eeeeeeeee	e	e
e
eeeeee	dd
�dd�Z
eefdddddddddd
�	d	eeeeeeeee	e
e
eeedd�dd��Zeeed�dd��Zeeed�dd��Zdddd�dd�Zdddd�dd�ZdS)�Panela�A console renderable that draws a border around its contents.

    Example:
        >>> console.print(Panel("Hello, World!"))

    Args:
        renderable (RenderableType): A console renderable object.
        box (Box, optional): A Box instance that defines the look of the border (see :ref:`appendix_box`.
            Defaults to box.ROUNDED.
        safe_box (bool, optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
        expand (bool, optional): If True the panel will stretch to fill the console
            width, otherwise it will be sized to fit the contents. Defaults to True.
        style (str, optional): The style of the panel (border and contents). Defaults to "none".
        border_style (str, optional): The style of the border. Defaults to "none".
        width (Optional[int], optional): Optional width of panel. Defaults to None to auto-detect.
        height (Optional[int], optional): Optional height of panel. Defaults to None to auto-detect.
        padding (Optional[PaddingDimensions]): Optional padding around renderable. Defaults to 0.
        highlight (bool, optional): Enable automatic highlighting of panel title (if str). Defaults to False.
    N�centerT�none)rrF)�title�title_align�subtitle�subtitle_align�safe_box�expand�style�border_style�width�height�padding�	highlightr)�
renderable�boxrrrrrrr r!r"r#r$r%�returncCsX||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_|
|_||_
dS)N)r&r'rrrrrrr r!r"r#r$r%)�selfr&r'rrrrrrr r!r"r#r$r%�r*�:/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/rich/panel.py�__init__&szPanel.__init__)	rrrrrr r!r"r$)r&r'rrrrrr r!r"r$r(c	Cs ||||||||||	|
|dd�S)z2An alternative constructor that sets expand=False.F)
rrrrrr r!r"r$rr*)�clsr&r'rrrrrr r!r"r$r*r*r+�fitGsz	Panel.fit)r(cCs^|jrZt|jt�rt�|j�n|j��}d|_|j�dd�|_d|_	|�
�|�d�|SdS)N��
� Tr)r�
isinstance�strr�from_markup�copy�end�plain�replace�no_wrap�expand_tabs�pad)r)�
title_textr*r*r+�_titlegs

zPanel._titlecCs^|jrZt|jt�rt�|j�n|j��}d|_|j�dd�|_d|_	|�
�|�d�|SdS)Nr/r0r1Tr)rr2r3rr4r5r6r7r8r9r:r;)r)�
subtitle_textr*r*r+�	_subtitlews

zPanel._subtitlerrr)�console�optionsr(ccs�t�|j�}t|�r t|j|�n|j}|�|j�}||�|j�}|jdkrR|j	nt
|j	|j�}|jdkrp|jn|j}|jj
||d�}	ttttttd�dd�}
|j}|dk	r�|�|�|jr�|dn|j||�|d�d�j}|jp�|jp�d}
|
r�|
d8}
|dk	�r t
|j	dt||jd��}|d}|j||
|jd�}|j|||d�}t|	j|�}t|	j �|�}t�!�}|dk�s�|d	k�r�t|	�"|dg�|�Vn\|
||d	|j#|	j$|�}t|	j%|	j$|�V|�&||�|d	��EdHt|	j$|	j'|�V|Vx*|D]"}|V|EdH|V|V�qW|j(}|dk	�rB|�|�|dk�sV|d	k�rpt|	�)|dg�|�Vn\|
||d	|j*|	j+|�}t|	j,|	j+|�V|�&||�|d	��EdHt|	j+|	j-|�V|VdS)
N)�safe)�textr"�align�	characterr r(cSs�|��}|�|�|t|j�}|r�|dkrFtj||||fddd�S|dkr~|d}tj|||f|||||fddd�Stj|||f|ddd�S|S)acGets new aligned text.

            Args:
                text (Text): Title or subtitle text.
                width (int): Desired width.
                align (str): Alignment.
                character (str): Character for alignment.
                style (Style): Border style

            Returns:
                Text: New text instance
            �leftTr/)r9r6r�)r5�truncaterr7rZassemble)rCr"rDrEr Zexcess_spacerFr*r*r+�
align_text�s0



z*Panel.__rich_console__.<locals>.align_textrG)rA)r"r#r%)r �).r�unpackr$�anyr&Z	get_styler r!r"�	max_width�minrr'�
substituter�intr3rr=Zstylize_beforer�measure�update_width�maximumr#�maxr�updater%Zrender_linesrZmid_leftZ	mid_right�lineZget_topr�topZtop_left�renderZ	top_rightr?Z
get_bottomrZbottomZbottom_leftZbottom_right)r)r@rAZ_paddingr&r r!r"rr'rIr<Zchild_widthZchild_heightZ
child_options�linesZ
line_startZline_end�new_linerVr>r*r*r+�__rich_console__�s|
*





zPanel.__rich_console__r
c
Csz|j}t�|j�\}}}}||}|r0|j|gn|jg}|jdkrjt||�|j|d�|�j	|d}	n|j}	t
|	|	�S)NrG)r=rrKr$r&r"rrRrMrSr
)
r)r@rAr=�_�rightrFr$Zrenderablesr"r*r*r+�__rich_measure__s
(zPanel.__rich_measure__)�__name__�
__module__�__qualname__�__doc__rrrrr�boolrrPr
r,�classmethodr.�propertyrr=r?r[r^r*r*r*r+rsH6,r�__main__)r)�DOUBLEr)rz
Hello, World!z
rich.Panelz
white on blue)rr r'r$N)%�typingrrrDrr'rr�cellsrZjupyterr	rQr
rr$rr
�segmentrr rrrCrrr@rrrrrr_�crg�p�printr*r*r*r+�<module>s6