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__/traceback.cpython-38.pyc
U

�{�e�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	�}
zt�}|
|�tj	WSt
k
r�tj	}�t_	|YSXdS)
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-_0scjqea/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�rNrO)�default_showtraceback�tb_datar2rK�ipy_show_traceback~szCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_tracebackF)�	is_syntax)rNrTrOr@cst���}|rdn|d}��dd�}��d|r2dnd�}t|�D]}|dkrPqX|j}q@�|d|d|�i�dS)z2Internally called traceback from ip._showtracebackN�Zrunning_compiled_codeF�	tb_offsetrr)Z
_get_exc_info�get�range�tb_next)rTrNrOZ	exc_tuple�tbZcompiledrV�_)rLrMrRr2rK�ipy_display_traceback�szFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_tracebackcs�|ddi|��S)NrTTr2rP)r\r2rK�<lambda>�s���z9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>)Z
showtracebackrrIZ_showtracebackZshowsyntaxerror)rMrS)rL)rQrMr\rRrK�ipy_excepthook_closurezs��z'install.<locals>.ipy_excepthook_closure)r Z
is_jupyterr�
BaseExceptionr
rrZget_ipython�sysrL�	Exception)r3r4r5r6r7r8r9r:r;r<r=r>r?r^rM�old_excepthookr2)rLr5r=r;r<r9r:r?r8r>r6rJr4r7rK�install0s*)����()rcc@sLeZdZUeed<eed<eed<dZeed<dZee	ee
jfed<dS)�Frame�filename�lineno�name��lineN�locals)�__name__�
__module__�__qualname__�str�__annotations__�intrirjr
r
r�Noder2r2r2rKrd�s

rdc@s6eZdZUeed<eed<eed<eed<eed<dS)�_SyntaxError�offsetrerirf�msgN)rkrlrmrprornr2r2r2rKrr�s

rrc@sPeZdZUeed<eed<dZeeed<dZe	ed<e
ed�Ze
eed<dS)	�Stack�exc_type�	exc_valueN�syntax_errorF�is_cause)�default_factory�frames)rkrlrmrnrorxr
rrryrIr�listr{rrdr2r2r2rKru�s

ruc@seZdZUeeed<dS)�Trace�stacksN)rkrlrmrruror2r2r2rKr}�s
r}c@seZdZdgZdS)�PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)rkrlrmZ
highlightsr2r2r2rKr�src@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)%rGa�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)rhz.pyz.pxdz.pyxz.pxiNr0r1FTr2rE)
�tracer4r5r6r7r8r9r:r;r<r=r>r?cCs|dkrHt��\}}}|dks.|dks.|dkr6td��|j||||d�}||_||_||_t�|pdd�|_	||_
||_||_||_
||_|	|_|
|_g|_|D]Z}t|t�s�|jdk	s�t|�d���tj�|j�}n|}tj�tj�|��}|j�|�q�|
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�extractr�r4r5r+Z	get_themer6r7r8r=r9r:r;r<r>�
isinstancern�__file__�AssertionError�os�path�dirname�normpath�abspath�append�maxr?)�selfr�r4r5r6r7r8r9r:r;r<r=r>r?rvrwrDZsuppress_entityr�r2r2rK�__init__�sF��
��zTraceback.__init__)rvrwrDr4r5r6r7r8r9r: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�)�clsrvrwrDr4r5r6r7r8r9r:r;r<r=r>r?Zrich_tracebackr2r2rKrH$s2+��zTraceback.from_exceptionr�)	rvrwrDr8r9r:r;r<r@c	s�g}	d}
ddlm}ttd�dd�}t||j�||�|
d�}
t|t�rtt|j	pPd|j
pXd|jp`d|jphd	|j
d
�|
_|	�|
�|
jj}ttttfttttfd���fdd
�}t|�D]�\}}|jj}|r�|�d�s�tj�|�s�tj�||�}|j�dd��rq�t|�pd||jj|�r<��fdd�||j� ��D�ndd�}||�|j�dd�r�|
jdd�=q�t!|dd�}|�r�|j"}|}|j#}d}
q$|j$}|�r�t!|dd��s�|j"}|}|j#}d}
q$�q�q$t%|	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&z
t|�WStk
r YdSXdS)z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>N)rnra)r�r2r2rK�safe_str�s
z#Traceback.extract.<locals>.safe_str)rvrwry�?rh)rsrerfrirt)�iter_localsr@c3sR�s�s|EdHdS|D]2\}}�r2|�d�r2q�rB|�d�rBq||fVqdS)z-Extract locals from an iterator of key pairs.N�__r[��
startswith)r��keyrC)r;r<r2rK�
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:r2rK�
<dictcomp>�s��z%Traceback.extract.<locals>.<dictcomp>N)rerfrgrj�_rich_traceback_guard�	__cause__T�__suppress_context__)r~)&Zpip._vendor.richr�rrnrurkr��SyntaxErrorrrrsrerfr�rtrxr�r{rr�objectr�f_code�co_filenamer�r�r��isabs�join�f_localsrWrd�co_name�items�getattr�	__class__�
__traceback__�__context__r})r�rvrwrDr8r9r:r;r<r~ryr�r��stackr�r��
frame_summaryZline_nore�frame�causer�r2)r;r<r9r:rKr�jsv�
�
�	��	�
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�}tt|jj��D�]$\}}	|	j�rt|�|	�d|ddd	d
�}
t|
|j�}
|�|��|
VW5QRX|	jdk	�r�|�|��.tt|�|	j�|ddd	|jd�|j�VW5QRXt�|	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�dS)NT)Zdim)Zbold)r�
pygments.text�pygments.string�pygments.function�pygments.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*r�ConstantZ	Delimiterrr'r�reversedr�r~r{r(�
_render_stackr%r4Z	use_themerx�_render_syntax_errorr�assemblervrtrwry�from_markup)r�r3r�r6Zbackground_styleZtoken_styleZtraceback_theme�highlighter�lastr�Zstack_renderabler2r2rK�__rich_console__�s����
��
����zTraceback.__rich_console__)rxr@ccs�t�}t�}|jdkrVtj�|j�rVtjd|j��dfdt|j	�dfdd�}||�V||j
���}d|_t
|jd	t|��}|�d
||�|tjdd|ddd�7}|VdS)
Nz<stdin>� r���:r�r�r��r�Trzbold underline�
u[traceback.offset]▲[/])r'rrer�r��existsrr�rnrfri�rstripZno_wrap�minrs�lenZstylizer�)r�rxr��path_highlighterr�Zsyntax_error_textrsr2r2rKr�5s(
�
�zTraceback._render_syntax_error)re�coder@cCs�tj�|�d}|sP|�d�}|dkr2|d|�n|}|�d�rPd|��krPdSz|j�|�pht||�j	WSt
k
r�YdSXdS)N���r�z#!r�r�)r�r��splitext�indexr��lower�LEXERSrWrrgr)r�rer��extZnew_line_index�
first_liner2r2rK�_guess_lexerLs
zTraceback._guess_lexer)r�r@c
#sXt�}�j}ttd�dd�}tttd��fdd�}d}�jdkrbt�jdt|j	��jd�}d	}t
|j	�D�]�\}}	|r�||kr�d
}qp|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��sf|
�sfdV|V|	j
�d��r�||	�EdHqp|spzd||	j
�}
|
�s�Wqp��|	j
|
�}t|
||d
|	j�j|	j�jf|	jh�jd�jd	d�
}dVWn:tk
�r,}zt�d|��df�VW5d}~XYqpX|	j�rLt|f||	��dd �n|VqpdS)!N)rer@cSsd�t�|��S)z�Read files, and cache results on filename.

            Args:
                filename (str): Filename to read

            Returns:
                str: Contents of file
            rh)r��	linecache�getlines)rer2r2rK�	read_codeas	z*Traceback._render_stack.<locals>.read_code)r�r@c3s&|jr"t|jd�j�j�jd�VdS)Nrj)r�r=r�r�)rjr)r=r9r:)r�)r�r2rK�
render_localsls�z.Traceback._render_stack.<locals>.render_localsrrUFTz
... z frames hidden ...�centerztraceback.error)Zjustifyr�c3s|]}��|�VqdS)Nr�)r�r�)�frame_filenamer2rK�	<genexpr>�sz*Traceback._render_stack.<locals>.<genexpr>r�r�r�r�z in r�r�zin r�rh�X)r6Zline_numbersZ
line_rangeZhighlight_linesr7Z
code_widthr=�dedentr�r)r�)rr6rnrdrr"r?rXr�r{�	enumerater�rre�anyr>r�r�r�r�rfrgr�r�r+r5r7r=rarjr)r�r�r�r6r�r�Zexclude_framesZexcludedZframe_indexr��firstZ
suppressedr�r�Z
lexer_name�syntax�errorr2)r�r�rKr�\s�

���	�


��
������zTraceback._render_stack)N)!rkrlrm�__doc__r��LOCALS_MAX_LENGTH�LOCALS_MAX_STRINGr
r}rprnrIrrrr��classmethodrrr_rrHr�r r!r#r�r$rrr�r�rur�r2r2r2rKrG�s��
���3��E��}�NrG�__main__)r )�ar@cCsd}t||�dS)Nr)rF)r�Zoner2r2rK�bar�sr�cCs"d}ddddhdd�}t|�dS)NTz
Paul AtreideszVladimir HarkonnenzThufir HawatzDuncan Idaho)NFT)�
charactersZatomic_types)r�)r�r�Zzedr2r2rK�foo�s��	r�)r@cCs@z"ztd�WntYnXWntjdd�YnXdS)NrTr�)r�Zslfkjsldkfjr3�print_exceptionr2r2r2rKr��sr�)V�
__future__rr�r��platformr`ZdataclassesrrrDr�typesrr�typingrr	r
rrr
rrrrZpip._vendor.pygments.lexersrZpip._vendor.pygments.tokenrrrrrrrr�rZpip._vendor.pygments.utilrrhrZ_loopr�columnsrr3r r!r"r#r$Z	constrainr%r�r&r'Zpanelr(Zscoper)r�r*r�r+r�r6r,�system�WINDOWSr�r�rprnrIr_rcrdrrrur}rrGrkr�r�r�r2r2r2rK�<module>s�0
 ��