HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_vendor/rich/__pycache__/tree.cpython-38.pyc
U

�{�e�#�@sddlmZmZmZmZddlmZmZddlm	Z	m
Z
mZmZddl
mZddlmZddlmZddlmZmZmZdd	lmZGd
d�de�Zedk�rdd
lmZddlmZddlm Z ddl!m"Z"ddl#m$Z$e$ddgd�Z%e%j&dddd�e%j&ddd�e%j&dddd�e%�'d d!d"�e%�'d#d$d%�e%�'d&d'd(�e%�'d)d*d+�d,Z(e"e(d-d.dd/�Z)ed0�Z*ed1ddd2�Z+e+j,d3d4d5�Z-e-j,d6d7d5�Z.e.�,ed8e)��e.�,ed9e e*dd:���e-j,d;d<d5�Z/de/_0e j1d=d4d:�Z2e/�,ed>e2��e/�,ed?e%��e	�Ze�3e+�d@S)A�)�Iterator�List�Optional�Tuple�)�
loop_first�	loop_last)�Console�ConsoleOptions�RenderableType�RenderResult)�JupyterMixin)�Measurement)�Segment)�Style�
StyleStack�	StyleType)�Styledc	@s�eZdZdZdddddd�eeeeeedd�d	d
�Zddddd�eeeeeeeedd�d
d�Z	dddd�dd�Z
dddd�dd�ZdS)�Treea�A renderable for a tree structure.

    Args:
        label (RenderableType): The renderable or str for the tree label.
        style (StyleType, optional): Style of this tree. Defaults to "tree".
        guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line".
        expanded (bool, optional): Also display children. Defaults to True.
        highlight (bool, optional): Highlight renderable (if str). Defaults to False.
    �treez	tree.lineTF)�style�guide_style�expanded�	highlight�	hide_rootN)�labelrrrrr�returncCs.||_||_||_g|_||_||_||_dS�N)rrr�childrenrrr)�selfrrrrrr�r �9/tmp/pip-unpacked-wheel-_0scjqea/pip/_vendor/rich/tree.py�__init__s
z
Tree.__init__�rrrr)rrrrrrcCsLt||dkr|jn||dkr"|jn|||dkr4|jn|d�}|j�|�|S)a3Add a child tree.

        Args:
            label (RenderableType): The renderable or str for the tree label.
            style (StyleType, optional): Style of this tree. Defaults to "tree".
            guide_style (StyleType, optional): Style of the guide lines. Defaults to "tree.line".
            expanded (bool, optional): Also display children. Defaults to True.
            highlight (Optional[bool], optional): Highlight renderable (if str). Defaults to False.

        Returns:
            Tree: A new child Tree, which may be further modified.
        Nr#)rrrrr�append)rrrrrr�noder r r!�add)s�zTree.addr	r
r)�console�optionsrc#s�g}|j}|j}t��}|j}t��}||jdd�p6|}	td�\}
}}}
d�dddg�t�t	ttd�����fd	d
�}|||	�g}|t
t|g���t||j��}t||j
��}tddd�}d
}|�r�|�}zt|�\}}WnVtk
�r2|��|�r*|dj
�p
|}	|||	�|d<|��|��Yq�YnX||�|�r\||
|dj
�pT|�|d<|j||j�}	|j||j
�}||j�r�dndd�}|jt|j|��j�jtdd�|D��|jdd��jdk	d�}|d
k�r�|j�sXt|�D]h\}}|�r�j||j|d�EdH|EdH|V|�r�|�r�||�r<|
n||dj
�pL|�|d<�q�|jr�|jr�||�rp|
n||dj
�p�|�|d<|�|t|j�dk�r�|
n||	��|� ||j
��|� ||j��|t
t|j���|d7}q�dS)N�)�default�)�    z|   z+-- z`-- )r,u│   u
├── u
└── )r,u┃   u
┣━━ u
┗━━ )r,u║   u
╠══ u
╚══ )�indexrrcsH�jr�|}n.|jrdn|jr$dnd}��jr4dn||}�||�S)z.Make a Segment for a level of the guide lines.r�r)Z
ascii_only�bold�
underline2Zlegacy_windows)r-r�lineZguide�ZASCII_GUIDESZTREE_GUIDESZ_Segmentr(r r!�
make_guide^s

z)Tree.__rich_console__.<locals>.make_guideF)r/r0r���r.rcss|]}|jVqdSr)Zcell_length)�.0�levelr r r!�	<genexpr>�sz(Tree.__rich_console__.<locals>.<genexpr>)�widthr�height)�pad)Z
post_style)!�popr$rr1�	get_styler�nullr�range�int�iterrrr�next�
StopIteration�currentrZrender_linesrr�update�	max_width�sumr�justifyrZapply_styleZbackground_stylerr�len�push)rr'r(�stackr;rI�new_liner<Z
null_styler�SPACE�CONTINUEZFORKZENDr3�levelsZguide_style_stackZstyle_stackZremove_guide_styles�depthZ
stack_node�lastr%r�prefixZrenderable_lines�firstr1r r2r!�__rich_console__Hs��	

����
���zTree.__rich_console__rcCs�t|g�g}|j}|j}d}d}tj}d}	|r�|�}
zt|
�}Wn tk
r`|	d8}	Yq*YnX||
�||||j�\}}
|	d}t|||�}t|
||�}|j	r*|j
r*|t|j
��|	d7}	q*t||�S)Nrrr+)r@r;r$r�getrArBr�maxrr)rr'r(rJr;rIZminimum�maximum�measurer6Z	iter_treerZmin_measureZmax_measure�indentr r r!�__rich_measure__�s.

zTree.__rich_measure__)�__name__�
__module__�__qualname__�__doc__rr�boolr"rr&rSrYr r r r!rsF���� �b�r�__main__)�Group)�Markdown)�Panel)�Syntax)�Tabler)Zdim)Z
row_stylesZReleasedZcyanT)rZno_wrapZTitleZmagenta)rz
Box Office�rightZgreen)rGrzDec 20, 2019z Star Wars: The Rise of Skywalkerz$952,110,690zMay 25, 2018zSolo: A Star Wars Storyz$393,151,347zDec 15, 2017z!Star Wars Ep. V111: The Last Jediz$1,332,539,889zDec 16, 2016zRogue One: A Star Wars Storyz$1,332,439,889zmclass Segment(NamedTuple):
    text: str = ""
    style: Optional[Style] = None
    is_control: bool = False
�pythonZmonokai)ZthemeZline_numbersz=### example.md
> Hello, World!
>
> Markdown _all_ the things
u🌲 [b green]Rich Tree)rrz:file_folder: RenderablesZred)rz!:file_folder: [bold yellow]Atomiczuu greenu📄 Syntaxu
📄 Markdown)Zborder_stylez&:file_folder: [bold magenta]Containerszbold magentazJust a panelu📄 Panelsu📄 [b magenta]TableN)4�typingrrrrZ_looprrr'r	r
rrZjupyterr
rWr�segmentrrrrrZstyledrrrZZpip._vendor.rich.consoler`Zpip._vendor.rich.markdownraZpip._vendor.rich.panelrbZpip._vendor.rich.syntaxrcZpip._vendor.rich.tablerd�tableZ
add_columnZadd_row�codeZsyntaxZmarkdown�rootr&r%Zsimple_nodeZcontainers_noderZfitZpanel�printr r r r!�<module>sV:
�	�