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__/markup.cpython-37.pyc
B

L��g �@s�ddlZddlmZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZe�dej�Ze�d�ZGd
d�de
�Ze	eZeegefZeeegefZ e�d�j!fee ed�dd�Z"eeee#eeeefd�dd�Z$d'ee
eefe%eeed�dd�Z&e'dk�r�ddddd gZ(dd!l)m*Z*dd"l+m,Z,e,d#d$d%d&�Z-xe(D]Z.e-�/ee.�e.��q�We*e-�dS)(�N)�literal_eval)�
attrgetter)�Callable�Iterable�List�Match�
NamedTuple�Optional�Tuple�Union�)�_emoji_replace)�EmojiVariant)�MarkupError)�Style)�Span�Textz((\\*)\[([a-z#/@][^[]*?)])z^([\w.]*?)(\(.*?\))?$c@sFeZdZUdZeed<eeed<ed�dd�Zeed�dd��Z	d	S)
�TagzA tag in console markup.�name�
parameters)�returncCs"|jdkr|jS|j�d|j��S)N� )rr)�self�r�;/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/rich/markup.py�__str__szTag.__str__cCs.|jdkrd|j�d�Sd|j�d|j�d�S)z*Get the string representation of this tag.N�[�]�=)rr)rrrr�markup!sz
Tag.markupN)
�__name__�
__module__�__qualname__�__doc__�str�__annotations__r	r�propertyrrrrrrs
rz(\\*)(\[[a-z#/@][^[]*?]))r�_escapercCs"tttd�dd�}|||�}|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$)rr'r-rrr�escape0s

r.)rrccsd}t}t}x�t�|�D]�}|��\}}}|��\}}	||krR||||�dfV|r�|t|�d�\}
}|
r�|d|
dfV||
d7}|r�||t|�d�dfV|	}q|�d�\}}
}|d|||
r�|nd�fV|	}qW|t|�kr�|||d�dfVdS)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�positionZ_divmod�_Tagr(Z	full_textZescapesZtag_text�start�endr+�escapedr,�equalsrrrr�_parseFs,r<�T)r�style�emoji�
emoji_variantrcs6t}d|kr(t|r|||d�n||d�St|d�}|j}tj}g��j�g}|j}	t}
t}tt	t
tfd���fdd�}�xZt|�D�]L\}
}}|dk	r�|�dd�}||r�||�n|�q�|dk	r�|j
�d	��r�|j
d
d���}|�r4||�}y||�\}}Wn0tk
�r0td|j�d|
�d
��d�YnXn8y��\}}Wn(tk
�rjtd|
�d��d�YnX|j
�d��r�|j�rnd}|j��}t�|�}|dk	�r�|��\}}|dk�r�dn|}yt|�}Wn|tk
�r}z"td|�d|j�d|j����Wdd}~XYn<tk
�rJ}ztd|j�d|���d�Wdd}~XYnX|�rr|t|t��rd|n|ff}nd}|	|
|t|�t|j
|id���n|	|
|t|�t|���q�|||j
�|j�}��t|�|f�q�Wt|�}x6��r���\}}t|�}|�r�|	|
|||���q�Wt|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)Zdefault_variant)r>)�
style_namercs@x2tt��d�D] \}\}}|j|kr�|�SqWt|��dS)z"Pop tag matching given style name.rN)�	enumerate�reversedr�KeyError)rA�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�@r=z()zerror parsing z in z; r)�meta���r8)�key)"r
r�appendr�	normalizerHrrr$r
�intr<�replacer�
startswith�striprDrr�
IndexErrorr�
RE_HANDLERr(r*r�SyntaxError�msg�	Exception�
isinstance�tupler4�sortedr�spans)rr>r?r@Z
emoji_replacer,rPrQr^Zappend_spanZ_Spanr7rJr6Z
plain_textrGrAr8Zopen_tagZhandler_namerZ
handler_matchZmatch_parametersZmeta_params�errorZnormalized_tagZtext_lengthr)rHrIr�rendergs�




,
r`�__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)�TableZMarkupZResult)rr)�padding)r=TN)0�re�astr�operatorr�typingrrrrrr	r
rr
r?r�errorsrr>rr,rr�compile�VERBOSEr1rWrr$Z_ReStringMatchZ_ReSubCallableZ_EscapeSubMethod�subr.rRr<�boolr`r ZMARKUPZpip._vendor.richrbZpip._vendor.rich.tablercZgridrZadd_rowrrrr�<module>sF(
&#x