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.10/site-packages/pip/_vendor/rich/__pycache__/markup.cpython-310.pyc
o

��i �@s�ddlZddlmZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZe�dej�Ze�d�ZGd
d�de
�Ze	eZeegefZeeegefZ e�d�j!fdede defdd�Z"dedeee#eeeeffdd�Z$			d&dede
eefde%deedef
dd�Z&e'dkr�gd�Z(dd l)m*Z*dd!l+m,Z,e,d"d#d$d%�Z-e(D]
Z.e-�/ee.�e.�q�e*e-�dSdS)'�N)�literal_eval)�
attrgetter)�Callable�Iterable�List�Match�
NamedTuple�Optional�Tuple�Union�)�_emoji_replace)�EmojiVariant)�MarkupError)�Style)�Span�Textz((\\*)\[([a-z#/@][^[]*?)])z^([\w.]*?)(\(.*?\))?$c@sJeZdZUdZeed<	eeed<	defdd�Zedefdd��Z	d	S)
�TagzA tag in console markup.�name�
parameters�returncCs"|jdur|jS|j�d|j��S)N� �rr��self�r�B/usr/local/lib/python3.10/site-packages/pip/_vendor/rich/markup.py�__str__s��zTag.__str__cCs.|jdurd|j�d�Sd|j�d|j�d�S)z*Get the string representation of this tag.N�[�]�=rrrrr�markup!s

���z
Tag.markupN)
�__name__�
__module__�__qualname__�__doc__�str�__annotations__r	r�propertyr!rrrrrs
rz(\\*)(\[[a-z#/@][^[]*?])r!�_escapercCs$dttdtfdd�}|||�}|S)z�Escapes text so that it won't be interpreted as markup.

    Args:
        markup (str): Content to be inserted in to markup.

    Returns:
        str: Markup with square brackets escaped.
    �matchrcSs|��\}}|�|�d|��S)z!Called by re.sub replace matches.�\)�groups)r*�backslashes�textrrr�escape_backslashes=sz"escape.<locals>.escape_backslashes)rr&)r!r)r/rrr�escape0s
r0ccs�d}t}t}t�|�D]`}|��\}}}|��\}}	||kr)||||�dfV|rU|t|�d�\}
}|
rD|d|
dfV||
d7}|rU||t|�d�dfV|	}q|�d�\}}
}|d|||
re|nd�fV|	}q|t|�kr|||d�dfVdSdS)z�Parse markup in to an iterable of tuples of (position, text, tag).

    Args:
        markup (str): A string containing console markup

    rN�r+r )�divmodr�RE_TAGS�finditerr,�span�len�	partition)r!�position�_divmod�_Tagr*�	full_text�escapes�tag_text�start�endr-�escapedr.�equalsrrrr�_parseFs0��rB�T�style�emoji�
emoji_variantcs
t}d|vrt|r|||d�|d�S||d�St|d�}|j}tj}g��j�g}|j}	t}
t}dtdt	t
tff��fdd�}t|�D�]\}
}}|dur_|�d	d�}||r[||�n|�qD|du�rU|j
�d
��rC|j
dd���}|r�||�}z||�\}}Wn,ty�td|j�d
|
�d��d�wz��\}}Wnty�td|
�d��d�w|j
�d��r6|j�r#d}|j��}t�|�}|dur�|��\}}|dur�dn|}zt|�}Wn3ty�}ztd|�d|j�d|j����d}~wt�y}ztd|j�d|���d�d}~ww|�r"|t|t��r|n|ff}nd}|	|
|t|�t|j
|id���qD|	|
|t|�t|���qD|||j
�|j�}��t|�|f�qDt|�}��ru���\}}t|�}|�rr|	|
|||����s]t|ddd�t d�d�|_!|S)a9Render console markup in to a Text instance.

    Args:
        markup (str): A string containing console markup.
        emoji (bool, optional): Also render emoji code. Defaults to True.

    Raises:
        MarkupError: If there is a syntax error in the markup.

    Returns:
        Text: A test instance.
    r)�default_variant)rD�
style_namercs<tt��d�D]\}\}}|j|kr�|�Sqt|��)z"Pop tag matching given style name.r)�	enumerate�reversedr�KeyError)rH�index�_�tag��pop�style_stackrr�	pop_style�s

�zrender.<locals>.pop_styleNz\[�/rz
closing tag 'z' at position z doesn't match any open tagzclosing tag '[/]' at position z has nothing to close�@rCz()zerror parsing z in z; r)�meta���r>)�key)"r
r�appendr�	normalizerPrrr&r
�intrB�replacer�
startswith�striprKrr!�
IndexErrorr�
RE_HANDLERr*r,r�SyntaxError�msg�	Exception�
isinstance�tupler6�sortedr�spans)r!rDrErF�
emoji_replacer.rXrYrf�append_span�_Spanr:rRr8�
plain_textrNrHr>�open_tag�handler_namer�
handler_match�match_parameters�meta_params�error�normalized_tag�text_lengthrrOr�rendergs���
 
���
���

��������������rs�__main__)z[red]Hello World[/red]zagenta]Hello [b]World[/b]z9[bold]Bold[italic] bold and italic [/bold]italic[/italic]zDClick [link=https://www.willmcgugan.com]here[/link] to visit my Blogz+:warning-emoji: [bold red blink] DANGER![/])�print)�TableZMarkup�Result)rr)�padding)rCTN)0�re�astr�operatorr�typingrrrrrr	r
rr
rEr�errorsrrDrr.rr�compile�VERBOSEr3r_rr&�_ReStringMatch�_ReSubCallable�_EscapeSubMethod�subr0rZrB�boolrsr"ZMARKUP�pip._vendor.richru�pip._vendor.rich.tablerv�gridr!�add_rowrrrr�<module>sd(�

���
�(#��
���
�}�