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

L��g�s�@s�ddlmZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZmZmZmZmZddlmZddlmZmZmZmZm Z m!Z!dd	lm"Z#dd
lm$Z$ddl%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=ddl>m?Z?dd	l@m"Z"ddlAmBZBe�C�dkZDdZEdZFddddddeEeFdddddd �
ee.eeGeGeeHeIeIeGeGeIeeIeIeeeHefeGeeeJeJee
gefd!�d"d#�ZKeGd$d%�d%��ZLeGd&d'�d'��ZMeGd(d)�d)��ZNeGd*d+�d+��ZOGd,d-�d-e6�ZPGd.d/�d/�ZQeRd0k�r�dd1l-m.Z.e.�Z-ddlZedd2�d3d4�ZSedd2�d5d6�ZTdd7�d8d9�ZUeU�dS):�)�absolute_importN)�	dataclass�field)�walk_tb)�
ModuleType�
TracebackType)
�Any�Callable�Dict�Iterable�List�Optional�Sequence�Tuple�Type�Union)�guess_lexer_for_filename)�Comment�Keyword�Name�Number�Operator�String)�Text)�Token)�
ClassNotFound�)�pretty)�	loop_last)�Columns)�Console�ConsoleOptions�ConsoleRenderable�RenderResult�group)�	Constrain)�RegexHighlighter�ReprHighlighter)�Panel)�render_scope)�Style)�Syntax)�Theme�Windows�
�P�d�FT�)
�console�width�extra_lines�theme�	word_wrap�show_locals�locals_max_length�locals_max_string�locals_hide_dunder�locals_hide_sunder�
indent_guides�suppress�
max_frames)r3r4r5r6r7r8r9r:r;r<r=r>r?�returnc
s�|dkrtdd�n|��jr(�dkr(dn��tttttdd����������	�
���
f
dd��tdd��fdd	�}
yt�}|
|�tj	St
k
r�tj	}�t_	|SXdS)
a"Install a rich traceback handler.

    Once installed, any tracebacks will be printed with syntax highlighting and rich formatting.


    Args:
        console (Optional[Console], optional): Console to write exception to. Default uses internal Console instance.
        width (Optional[int], optional): Width (in characters) of traceback. Defaults to 100.
        extra_lines (int, optional): Extra lines of code. Defaults to 3.
        theme (Optional[str], optional): Pygments theme to use in traceback. Defaults to ``None`` which will pick
            a theme appropriate for the platform.
        word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
        show_locals (bool, optional): Enable display of local variables. Defaults to False.
        locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to 10.
        locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
        locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True.
        locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False.
        indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True.
        suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.

    Returns:
        Callable: The previous exception handler that was replaced.

    NT)�stderr)�type_�value�	tracebackr@cs6�
�tj|||���	�����t�����d��dS)N)r4r5r6r7r8r9r:r;r<r=r>r?)�print�	Traceback�from_exception�bool)rBrCrD)
r5r=r;r<r9r:r?r8r>r6�traceback_consoler4r7r2�>/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/rich/traceback.py�
excepthookas"zinstall.<locals>.excepthook)�ipr@csbi��j�ttdd���fdd�}dd�tttdd����fdd����_|�_�fd	d
��_dS)N)�args�kwargsr@cs|��||�dS)zEwrap the default ip.showtraceback to store info for ip._showtracebackNr2)rMrN)�default_showtraceback�tb_datar2rJ�ipy_show_traceback~szCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_tracebackF)�	is_syntax)rMrRrNr@csv���}|rdn|d}��dd�}��d|r2dnd�}x t|�D]}|dkrPP|j}qBW�|d|d|�i�dS)z2Internally called traceback from ip._showtracebackN�Zrunning_compiled_codeF�	tb_offsetrr)Z
_get_exc_info�get�range�tb_next)rRrMrNZ	exc_tuple�tbZcompiledrT�_)rKrLrPr2rJ�ipy_display_traceback�s
zFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_tracebackcs�|ddi|��S)NrRTr2)rMrN)rZr2rJ�<lambda>�sz9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>)Z
showtracebackrrHZ_showtracebackZshowsyntaxerror)rLrQ)rK)rOrLrZrPrJ�ipy_excepthook_closurezsz'install.<locals>.ipy_excepthook_closure)r Z
is_jupyterr�
BaseExceptionr
rrZget_ipython�sysrK�	Exception)r3r4r5r6r7r8r9r:r;r<r=r>r?r\rLZold_excepthookr2)rKr5r=r;r<r9r:r?r8r>r6rIr4r7rJ�install0s )*)r`c@sLeZdZUeed<eed<eed<dZeed<dZee	ee
jfed<dS)�Frame�filename�lineno�name��lineN�locals)�__name__�
__module__�__qualname__�str�__annotations__�intrfrgr
r
r�Noder2r2r2rJra�s

rac@s6eZdZUeed<eed<eed<eed<eed<dS)�_SyntaxError�offsetrbrfrc�msgN)rhrirjrmrlrkr2r2r2rJro�s

roc@sPeZdZUeed<eed<dZeeed<dZe	ed<e
ed�Ze
eed<dS)	�Stack�exc_type�	exc_valueN�syntax_errorF�is_cause)�default_factory�frames)rhrirjrkrlrur
rorvrHr�listrxrrar2r2r2rJrr�s

rrc@seZdZUeeed<dS)�Trace�stacksN)rhrirjrrrrlr2r2r2rJrz�s
rzc@seZdZdgZdS)�PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)rhrirjZ
highlightsr2r2r2rJr|�sr|c@speZdZdZdddddd�Zd$dd	dd
d
eedd
dddd
�eeee	e	ee
eee	e	eeeee
e
efe	d�
dd�Zedd	dd
d
eedd
dddd
�eeeeeee	e	ee
eee	e	eeeee
e
efe	dd�dd��Zed
eedd
d�eeeeeee	e	eeed�	dd��Zeeed�dd�Ze�eed�dd��Zee
e
e
d�dd ��Ze�eed!�d"d#��Z dS)%rFa�A Console renderable that renders a traceback.

    Args:
        trace (Trace, optional): A `Trace` object produced from `extract`. Defaults to None, which uses
            the last exception.
        width (Optional[int], optional): Number of characters used to traceback. Defaults to 100.
        extra_lines (int, optional): Additional lines of code to render. Defaults to 3.
        theme (str, optional): Override pygments theme used in traceback.
        word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
        show_locals (bool, optional): Enable display of local variables. Defaults to False.
        indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True.
        locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to 10.
        locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
        locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True.
        locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False.
        suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
        max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.

    �text�pythonZcythonZpyrex)rez.pyz.pxdz.pyxz.pxiNr0r1FTr2)r4r5r6r7r8r9r:r;r<r=r>r?)
�tracer4r5r6r7r8r9r:r;r<r=r>r?cCs|dkrHt��\}}}|dks.|dks.|dkr6td��|j||||d�}||_||_||_t�|pdd�|_	||_
||_||_||_
||_|	|_|
|_g|_xb|D]Z}t|t�s�|jdk	s�t|�d���tj�|j�}n|}tj�tj�|��}|j�|�q�W|
dk�rtd|
�nd|_dS)Nz9Value for 'trace' required if not called in except: block)r8Z	ansi_darkz+ must be a module with '__file__' attributer�)r^�exc_info�
ValueError�extractrr4r5r+Z	get_themer6r7r8r=r9r:r;r<r>�
isinstancerk�__file__�AssertionError�os�path�dirname�normpath�abspath�append�maxr?)�selfrr4r5r6r7r8r9r:r;r<r=r>r?rsrtrDZsuppress_entityr�r2r2rJ�__init__�s8

zTraceback.__init__)rsrtrDr4r5r6r7r8r9r:r;r<r=r>r?r@cCs<|j|||||	|
||d�}||||||||
|	|
||||d�
S)aeCreate a traceback from exception info

        Args:
            exc_type (Type[BaseException]): Exception type.
            exc_value (BaseException): Exception value.
            traceback (TracebackType): Python Traceback object.
            width (Optional[int], optional): Number of characters used to traceback. Defaults to 100.
            extra_lines (int, optional): Additional lines of code to render. Defaults to 3.
            theme (str, optional): Override pygments theme used in traceback.
            word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
            show_locals (bool, optional): Enable display of local variables. Defaults to False.
            indent_guides (bool, optional): Enable indent guides in code and locals. Defaults to True.
            locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
                Defaults to 10.
            locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
            locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True.
            locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False.
            suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
            max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.

        Returns:
            Traceback: A Traceback instance that may be printed.
        )r8r9r:r;r<)r4r5r6r7r8r=r9r:r;r<r>r?)r�)�clsrsrtrDr4r5r6r7r8r9r:r;r<r=r>r?Zrich_tracebackr2r2rJrG$s.+zTraceback.from_exception)r8r9r:r;r<)	rsrtrDr8r9r:r;r<r@c	s�g}	d}
ddlm}ttd�dd�}�x�t||j�||�|
d�}
t|t�rxt|j	pTd|j
p\d|jpdd|jpld	|j
d
�|
_|	�|
�|
jj}ttttfttttfd���fdd
�}x�t|�D]�\}}|jj}|r�|�d�s�tj�|�s�tj�||�}|j�dd��rq�t|�pd||jj|�rB��fdd�||j� ��D�ndd�}||�|j�dd�r�|
jdd�=q�Wt!|dd�}|�r�|j"}|}|j#}d}
q(|j$}|�r�t!|dd��s�|j"}|}|j#}d}
q(Pq(Wt%|	d�}|S)a�Extract traceback information.

        Args:
            exc_type (Type[BaseException]): Exception type.
            exc_value (BaseException): Exception value.
            traceback (TracebackType): Python Traceback object.
            show_locals (bool, optional): Enable display of local variables. Defaults to False.
            locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
                Defaults to 10.
            locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
            locals_hide_dunder (bool, optional): Hide locals prefixed with double underscore. Defaults to True.
            locals_hide_sunder (bool, optional): Hide locals prefixed with single underscore. Defaults to False.

        Returns:
            Trace: A Trace instance which you can use to construct a `Traceback`.
        Fr)�_IMPORT_CWD)�_objectr@cSs"yt|�Stk
rdSXdS)z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>N)rkr_)r�r2r2rJ�safe_str�sz#Traceback.extract.<locals>.safe_str)rsrtrv�?re)rprbrcrfrq)�iter_localsr@c3sV�s�s|EdHdSx:|D]2\}}�r4|�d�r4q�rD|�d�rDq||fVqWdS)z-Extract locals from an iterator of key pairs.N�__rY)�
startswith)r��keyrC)r;r<r2rJ�
get_locals�s
z%Traceback.extract.<locals>.get_locals�<Z_rich_traceback_omitcs"i|]\}}tj|��d�|�qS))�
max_length�
max_string)rZtraverse)�.0r�rC)r9r:r2rJ�
<dictcomp>�sz%Traceback.extract.<locals>.<dictcomp>N)rbrcrdrg�_rich_traceback_guard�	__cause__T�__suppress_context__)r{)&Zpip._vendor.richr�rrkrrrhr��SyntaxErrorrorprbrcr}rqrur�rxrr�objectr�f_code�co_filenamer�r�r��isabs�join�f_localsrUra�co_name�items�getattr�	__class__�
__traceback__�__context__rz)r�rsrtrDr8r9r:r;r<r{rvr�r��stackr�r��
frame_summaryZline_norb�frame�causerr2)r;r<r9r:rJr�jsj

 	$
zTraceback.extract)r3�optionsr@ccs�|j}|��}|j}t|t�|t�|t�|tj�|t	�|t
�tdd�|t�|t�tdd�|t	�|tj
�|tj
�|tj
�|tj�|t�|t�|tj
�tdd�d�dd�}t�}�x:tt|jj��D�]$\}}	|	j�rt|�|	�d|ddd	d
�}
t|
|j�}
|�|��|
VWdQRX|	jdk	�r�|�|��.tt|�|	j�|ddd	|jd�|j�VWdQRXt�|	j�d
�df||	jj ��Vn>|	j!�r�t�|	j�d
�df||	j!��Vnt�|	j�df�V|s�|	j"�r�t�#d�Vq�t�#d�Vq�WdS)NT)Zdim)Zbold)rz
pygments.textzpygments.stringzpygments.functionzpygments.numberzrepr.indentzrepr.strz
repr.bracezrepr.numberzrepr.bool_truezrepr.bool_falsez	repr.nonezscope.borderzscope.equalsz	scope.keyzscope.key.specialF)Zinheritz7[traceback.title]Traceback [dim](most recent call last)ztraceback.border)rr)�title�style�border_style�expand�paddingztraceback.border.syntax_error)r�r�r�r�r4z: ztraceback.exc_typezI
[i]The above exception was the direct cause of the following exception:
zH
[i]During handling of the above exception, another exception occurred:
)$r6Zget_background_styleZget_style_for_tokenr,�	TextTokenrrrZFunctionrrr*rZConstantZ	Delimiterrr'r�reversedrr{rxr(�
_render_stackr%r4Z	use_themeru�_render_syntax_errorr�assemblersrqrtrv�from_markup)r�r3r�r6Zbackground_styleZtoken_styleZtraceback_theme�highlighter�lastr�Zstack_renderabler2r2rJ�__rich_console__�sv

zTraceback.__rich_console__)rur@ccs�t�}t�}|jdkrVtj�|j�rVtjd|j��dfdt|j	�dfdd�}||�V||j
���}d|_t
|jd	t|��}|�d
||�|tjdd|ddd�7}|VdS)
Nz<stdin>� zpygments.string)�:z
pygments.textzpygments.numberz
pygments.text)r�Trzbold underline�
u[traceback.offset]▲[/])r'r|rbr�r��existsrr�rkrcrf�rstripZno_wrap�minrp�lenZstylizer�)r�rur��path_highlighterr}Zsyntax_error_textrpr2r2rJr�5s$


zTraceback._render_syntax_error)rb�coder@cCs�tj�|�d}|sP|�d�}|dkr2|d|�n|}|�d�rPd|��krPdSy|j�|�pht||�j	St
k
r|dSXdS)N���r�z#!r~r})r�r��splitext�indexr��lower�LEXERSrUrrdr)r�rbr��extZnew_line_index�
first_liner2r2rJ�_guess_lexerLs
zTraceback._guess_lexer)r�r@c
#s\t�}�j}ttd�dd�}tttd��fdd�}d}�jdkrbt�jdt|j	��jd�}d	}�x�t
|j	�D�]�\}}	|r�||kr�d
}qt|r�|dk	s�t�tdt|��d�d
dd�Vd	}|dk}
|	j
�t�fdd��jD��}tj�|	j
��r,tj|t|	j
dd��dt|	j�dfd|	jdfdd�}n$tjd|	jdfdt|	j�dfdd�}|	j
�d��sj|
�sjdV|V|	j
�d��r�||	�EdHqt|styb||	j
�}
|
�s�wt��|	j
|
�}t|
||d
|	j�j|	j�jf|	jh�jd�jd	d�
}dVWn:tk
�r.}zt�d|��df�VWdd}~XYqtX|	j�rNt|f||	��dd �n|VqtWdS)!N)rbr@cSsd�t�|��S)z�Read files, and cache results on filename.

            Args:
                filename (str): Filename to read

            Returns:
                str: Contents of file
            re)r��	linecache�getlines)rbr2r2rJ�	read_codeas	z*Traceback._render_stack.<locals>.read_code)r�r@c3s&|jr"t|jd�j�j�jd�VdS)Nrg)r�r=r�r�)rgr)r=r9r:)r�)r�r2rJ�
render_localslsz.Traceback._render_stack.<locals>.render_localsrrSFTz
... z frames hidden ...�centerztraceback.error)Zjustifyr�c3s|]}��|�VqdS)N)r�)r�r�)�frame_filenamer2rJ�	<genexpr>�sz*Traceback._render_stack.<locals>.<genexpr>zpygments.string)r�)r�z
pygments.textzpygments.numberz in zpygments.functionz
pygments.textzin r�re�X)r6Zline_numbersZ
line_rangeZhighlight_linesr7Z
code_widthr=�dedentr�r)r�)r|r6rkrarr"r?rVr�rx�	enumerater�rrb�anyr>r�r�r�r�rcrdr�r�r+r5r7r=r_rgr)r�r�r�r6r�r�Zexclude_framesZexcludedZframe_indexr��firstZ
suppressedr}r�Z
lexer_name�syntax�errorr2)r�r�rJr�\s�






$zTraceback._render_stack)N)!rhrirj�__doc__r��LOCALS_MAX_LENGTH�LOCALS_MAX_STRINGr
rzrmrkrHrrrr��classmethodrrr]rrGr�r r!r#r�r$ror�r�rrr�r2r2r2rJrF�s`D$@3rLrF�__main__)r )�ar@cCsd}t||�dS)Nr)rE)r�Zoner2r2rJ�bar�sr�cCs"d}ddddhdd�}t|�dS)NTz
Paul AtreideszVladimir HarkonnenzThufir HawatzDuncan Idaho)NFT)�
charactersZatomic_types)r�)r�r�Zzedr2r2rJ�foo�sr�)r@cCs@y"ytd�WntYnXWntjdd�YnXdS)NrT)r8)r�Zslfkjsldkfjr3�print_exceptionr2r2r2rJr��sr�)V�
__future__rr�r��platformr^ZdataclassesrrrDr�typesrr�typingrr	r
rrr
rrrrZpip._vendor.pygments.lexersrZpip._vendor.pygments.tokenrrrrrrrr�rZpip._vendor.pygments.utilrrerZ_loopr�columnsrr3r r!r"r#r$Z	constrainr%r�r&r'Zpanelr(Zscoper)r�r*r�r+r}r6r,�system�WINDOWSr�r�rmrkrHr]r`rarorrrzr|rFrhr�r�r�r2r2r2rJ�<module>sx0
 <$p