HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/__pycache__/traceback.cpython-310.pyc
o

��h��#@sddlZddlZddlZddlZddlmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZmZmZm Z m!Z!m"Z"dd	lm#Z$dd
lm%Z%ddl&m'Z'dd
l(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5ddl6m7Z7ddl8m9Z9m:Z:ddl;m<Z<ddl=m>Z>ddl?m@Z@ddlAmBZBmCZCdd	lDm#Z#ddlEmFZFejGdkZHdZIdZJdeCdeCdeeeKeKeKffdd�ZLdd d!d"dd#d#eIeJd$dd$d%d d&�d'ee0d(eeKd)eeKd*eKd+eeMd,eNd-eNd.eKd/eKd0eNd1eeNd2eNd3eeeMefd4eKdeeeOeOee
geffd5d6�ZPeGd7d8�d8��ZQeGd9d:�d:��ZReGd;d<�d<��ZSeGd=d>�d>��ZTGd?d@�d@e9�ZUGdAdB�dB�ZVeWdCk�r�ePd$dD�ddlZdEeddfdFdG�ZXdEeddfdHdI�ZYdLdJdK�ZZeZ�dSdS)M�N)�	dataclass�field)�islice)�walk_tb)�
ModuleType�
TracebackType)�Any�Callable�Dict�Iterable�List�Optional�Sequence�Set�Tuple�Type�Union)�guess_lexer_for_filename)�Comment�Keyword�Name�Number�Operator�String)�Text)�Token)�
ClassNotFound�)�pretty)�loop_first_last�	loop_last)�Columns)�Console�ConsoleOptions�ConsoleRenderable�Group�RenderResult�group)�	Constrain)�RegexHighlighter�ReprHighlighter)�Panel)�render_scope)�Style)�Syntax�SyntaxPosition)�Theme�win32�
�P�start�end�returnc	cs|�|\}}|\}}||kr|||fVdStt||d��D]\}}}|r,||dfVq|r5|d|fVq|ddfVqdS)z�Yield start and end positions per line.

    Args:
        start: Start position.
        end: End position.

    Returns:
        Iterable of (LINE, COLUMN1, COLUMN2).
    r���rN)r�range)	r4r5�line1�column1�line2�column2�first�last�line_no�r@�E/usr/local/lib/python3.10/dist-packages/pip/_vendor/rich/traceback.py�_iter_syntax_lines7s�
�rB�d�X�FTr@)�console�width�
code_width�extra_lines�theme�	word_wrap�show_locals�locals_max_length�locals_max_string�locals_hide_dunder�locals_hide_sunder�
indent_guides�suppress�
max_framesrFrGrHrIrJrKrLrMrNrOrPrQrRrScs�|dur	tdd�n|��jr�durdn��dttdtdttddf���������	�
���
�fdd	��d
tddf�fdd�}zt�}||�tj	WSt
y]tj	}�t_	|YSw)
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.
        code_width (Optional[int], optional): Code width (in characters) of traceback. Defaults to 88.
        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�	tracebackr6cs<tj|||����
�
����t����	�d�}��|�dS)N�
rGrHrIrJrKrLrMrNrOrPrQrRrS)�	Traceback�from_exception�bool�print)rUrVrW�exception_traceback)rHrIrQrOrPrMrNrSrLrRrJ�traceback_consolerGrKr@rA�
excepthook�s&�zinstall.<locals>.excepthook�ipc	sli��j�dtdtddf��fdd�}dd�dtdtdtddf���fd	d
����_|�_�fdd��_dS)
N�args�kwargsr6cs|��|i|��dS)zEwrap the default ip.showtraceback to store info for ip._showtracebackNr@�rarb)�default_showtraceback�tb_datar@rA�ipy_show_traceback�szCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_tracebackF)�	is_syntaxrgcs~���}|rdn|d}��dd�}��d�}|dur!|rdnd}t|�D]}|dur-n|j}q%�|d|d|�i�dS)z2Internally called traceback from ip._showtracebackN��running_compiled_codeF�	tb_offsetrr)�
_get_exc_info�getr8�tb_next)rgrarb�	exc_tuple�tb�compiledrj�_)r_r`rer@rA�ipy_display_traceback�s
zFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_tracebackcs�|ddi|��S)NrgTr@rc)rrr@rA�<lambda>�s���z9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>)�
showtracebackrr[�_showtraceback�showsyntaxerror)r`rf)r_)rdr`rrrerA�ipy_excepthook_closure�s �����z'install.<locals>.ipy_excepthook_closure)r"�
is_jupyterr�
BaseExceptionr
rr�get_ipython�sysr_�	Exception)rFrGrHrIrJrKrLrMrNrOrPrQrRrSrwr`�old_excepthookr@)rHr_rIrQrOrPrMrNrSrLrRrJr^rGrKrA�installSs4+������(�+�r~c@steZdZUeed<eed<eed<dZeed<dZee	ee
jfed<dZee
e
eefe
eeffed<dS)	�Frame�filename�lineno�name��lineN�locals�last_instruction)�__name__�
__module__�__qualname__�str�__annotations__�intr�r�r
r
r�Noder�rr@r@r@rAr�s
,rc@sLeZdZUeed<eed<eed<eed<eed<eed�Ze	eed<dS)	�_SyntaxError�offsetr�r�r��msg��default_factory�notesN)
r�r�r�r�r�r�r�listr�rr@r@r@rAr��s
r�c@s�eZdZUeed<eed<dZeeed<dZe	ed<e
ed�Ze
eed<e
ed�Ze
eed	<dZe	ed
<e
ed�Ze
ded<dS)
�Stack�exc_type�	exc_valueN�syntax_errorF�is_causer��framesr��is_group�Trace�
exceptions)r�r�r�r�r�r�r
r�r�r[rr�r�rrr�r�r�r@r@r@rAr��s
r�c@seZdZUeeed<dS)r��stacksN)r�r�r�rr�r�r@r@r@rAr��s
r�c@seZdZdgZdS)�PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)r�r�r��
highlightsr@r@r@rAr��s
r�c$@s�eZdZdZdddddd�Z	d7dd	d
dddeedddd
dd�
deedee	dee	de	dee
dedede	de	dedededee
e
efde	fdd�Zedd	d
dddeedddd
dd�
deed ed!eedee	dee	de	dee
dedede	de	dedededee
e
efde	d"df"d#d$��Zedeedddd%�deed ed!eedede	de	deded&eeed"efd'd(��Zd)ed*ed"efd+d,�Ze�d-ed"efd.d/��Zed0e
d1e
d"e
fd2d3��Ze�d4e d"efd5d6��Z!dS)8rYaA 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.
        code_width (Optional[int], optional): Number of code characters used to traceback. Defaults to 88.
        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�python�cython�pyrex)r�z.pyz.pxdz.pyxz.pxiNrCrDrEFTr@rX�tracerGrHrIrJrKrLrMrNrOrPrQrRrSc
Cs"|dur$t��\}}}|dus|dus|durtd��|j||||d�}||_||_||_||_t�	|p5d�|_
||_||_||_
||_|	|_|
|_||_g|_|
D]-}t|t�sm|jduseJ|�d���tj�|j�}n|}tj�tj�|��}|j�|�qR|dkr�td|�|_dSd|_dS)Nz9Value for 'trace' required if not called in except: block�rL�	ansi_darkz+ must be a module with '__file__' attributer�)r{�exc_info�
ValueError�extractr�rGrHrIr.�	get_themerJrKrLrQrMrNrOrPrR�
isinstancer��__file__�os�path�dirname�normpath�abspath�append�maxrS)�selfr�rGrHrIrJrKrLrMrNrOrPrQrRrSr�r�rW�suppress_entityr�r@r@rA�__init__s@��
�"zTraceback.__init__r�r�rWr6c
Cs>|j||||	|
|||
d�}||||||||	||
|||
||d�S)a�Create 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.
            code_width (Optional[int], optional): Number of code characters used to traceback. Defaults to 88.
            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.
        )rLrMrNrOrP)
rGrHrIrJrKrLrQrMrNrOrPrRrS)r�)�clsr�r�rWrGrHrIrJrKrLrMrNrOrPrQrRrS�rich_tracebackr@r@rArZSs4-��zTraceback.from_exception)rLrMrNrOrP�_visited_exceptionsr�c!
s�g}
d}ddlm}t|dd�pg}
|	durt�n|	}dtdtfdd	�}	t||j�||�||
d�}tj	dkret
|ttf�red
|_
|jD] }||vrKqD|�|�|j�tjt|�||j|���|d
��qDt
|t�r�t|jpod|jpsd|jpwd|jp{d|j|
d�|_|
�|�|jj}dtttt fdtttt ff��fdd�}t!|�D]�\}}|j"j#}d}tj	dkr�|j$d}t%t&|j"�'�||d��}|\}}}}|dur�|dur�|dur�|dur�||f||ff}|r�|�(d�s�t)j*�+|�s�t)j*�,||�}|j-�.dd��rq�t/|�pd||j"j0|�r��fdd�||j-�1��D�nd|d�}||�|j-�.dd��r5|jdd�=q�|�snt|dd�}|du�rT||u�rT|j2}|}|j}d
}q$|j3}|du�rnt|dd��sn|j2}|}|j}d}q$	t4|
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�	__notes__N�_objectr6cSs zt|�WStyYdSw)z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>)r�r|)r�r@r@rA�safe_str�s

�z#Traceback.extract.<locals>.safe_strT)r�r�r�r�)rE�)rLrMrOrPr��?r�)r�r�r�r�r�r��iter_localsc3sT��s�s|EdHdS|D]\}}�r|�d�rq�r"|�d�r"q||fVqdS)z-Extract locals from an iterator of key pairs.N�__rq��
startswith)r��keyrV)rOrPr@rA�
get_locals�s�
�z%Traceback.extract.<locals>.get_localsrhr�<�_rich_traceback_omitcs6i|]\}}t�|�st�|�s|tj|��d��qS))�
max_length�
max_string)�inspect�
isfunction�isclassr�traverse)�.0r�rV)rMrNr@rA�
<dictcomp>.s����z%Traceback.extract.<locals>.<dictcomp>)r�r�r�r�r��_rich_traceback_guard�	__cause__�__suppress_context__)r�)5�pip._vendor.richr��getattr�setrr�r�r�r{�version_infor��BaseExceptionGroup�ExceptionGroupr�r��addr�rYr��type�
__traceback__�SyntaxErrorr�r�r�r�r�r�r�r�rr�objectr�f_code�co_filename�f_lasti�nextr�co_positionsr�r�r��isabs�join�f_localsrlr�co_name�items�	__class__�__context__r�)!r�r�r�rWrLrMrNrOrPr�r�r�r�r��grouped_exceptionsr��stack�	exceptionr�r��
frame_summaryr?r�r��instruction_index�instruction_position�
start_line�end_line�start_column�
end_column�frame�causer�r@)rOrPrMrNrAr��s���


��

�
	��

������
���
zTraceback.extractrF�optionsc#sF��j}|���|j}tid|t��d|t��d|t��d|tj��d|t	��d|t
�tdd��d	|t��d
|t�tdd��d|t	��d
|tj
��d|tj
��d|tj
��d|tj��d|t��d|t��d|tj
�tdd��dd��t��t�dtdtdtf������fdd���tt�jj��D]
\}}�||�Vq�dS)Nr�
pygments.text�pygments.string�pygments.function�pygments.numberzrepr.indentT)�dimzrepr.strz
repr.brace)�boldzrepr.numberzrepr.bool_truezrepr.bool_falsez	repr.nonezscope.borderzscope.equalsz	scope.keyzscope.key.specialF)�inheritr�r>r6c	
3s��|jr/t��|�d�dddd�}t|�j�}�����|VWd�n1s*wY|jduro�����tt��|j��ddd�jd��j�VWd�n1sXwYt�	|j
�d�d	f�|jj��Vn|jr�t�	|j
�d�d	f�|j��Vn
t�	|j
�d	f�V|j
D]}t�	d
�|��Vq�|jr�t|jd�D],\}}g}t|j�D]\}}|��||��q�dVttt|�d
|��dd��j�Vq�|s�|jr�t�d�VdSt�d�VdSdS)Nz7[traceback.title]Traceback [dim](most recent call last)ztraceback.borderT)rr)�title�style�border_style�expand�paddingztraceback.border.syntax_error)rrrrrGz: ztraceback.exc_type)z[NOTE] ztraceback.noterr�zSub-exception #ztraceback.group.border)rrzI
[i]The above exception was the direct cause of the following exception:
zH
[i]During handling of the above exception, another exception occurred:
)r�r+�
_render_stackr(rG�	use_themer��_render_syntax_errorr�assembler�r�r�r�r��	enumerater�r r�r�r%r��from_markup)	r�r>�stack_renderable�note�group_no�group_exceptionr��
group_last�group_stack��background_stylerF�highlighter�render_stackr��traceback_themer@rArzs~���

���
��
��	
�
��z0Traceback.__rich_console__.<locals>.render_stack)rJ�get_background_style�get_style_for_tokenr0�	TextTokenrrr�Functionrrr-r�Constant�	Delimiterrr*r'r�r[r&r �reversedr�r�)r�rFr�rJ�token_styler>r�r@rrA�__rich_console__[s\����
�����	�

�
�
�

�����&C�zTraceback.__rich_console__r�ccs��t�}t�}|jdkr,tj�|j�r,tjd|j��dfdt|j	�dfdd�}||�V||j
���}d|_t
|jd	t|��}|�d
||�|tjdd|ddd�7}|VdS)
Nz<stdin>� r���:r�r�r��rTrzbold underline�
u[traceback.offset]▲[/])r*r�r�r�r��existsrrr�r�r��rstrip�no_wrap�minr��len�stylizer
)r�r�r�path_highlighterr��syntax_error_textr�r@r@rAr�s*�
�
�
zTraceback._render_syntax_errorr��codecCs�tj�|�d}|s(|�d�}|dkr|d|�n|}|�d�r(d|��vr(dSz
|j�|�p4t||�j	WSt
y?YdSw)Nr7r#z#!r�r�)r�r��splitext�indexr��lower�LEXERSrlrr�r)r�r�r,�ext�new_line_index�
first_liner@r@rA�_guess_lexer�s
�zTraceback._guess_lexerr�c
#s��t�}�j}dtdttf�fdd�}d}�jdkr+t�jdt|j��jd�}d}t	|j�D�]G\}}|r@||vr@d}q2|rX|dusHJ�t
d	t|��d
�ddd
�Vd}|dk}	|j�t�fdd��j
D��}
tj�|j�r�t
j|t
|jdd��dt|j�dfd|jdfdd�}nt
jd|jdfdt|j�dfdd�}|j�d�s�|	s�dV|V|j�d�r�||�EdHq2|
�szz8t�|j�}d�|�}
|
s�Wq2��|j|
�}t|
||d|j�j|j�jf|jh�j�j�jdd�
}dVWnt�y}zt
�d|��df�VWYd}~q2d}~ww|j du�rh|j \}}t!||�D]B\}}}z$|dk�r@||d}t|�t|�"��}|dk�rMt||d�}Wnt#�yYY�q%w|j$d||f||fd��q%|j%�rwt&|g||��dd �n|Vq2dS)!Nr�r6c3s,�|jrt|jd�j�j�jd�VdSdS)Nr�)rrQr�r�)r�r,rQrMrN)r�)r�r@rA�
render_locals�s���z.Traceback._render_stack.<locals>.render_localsrrhFTz
... z frames hidden ...�centerztraceback.error)�justifyrc3s�|]}��|�VqdS�Nr�)r�r�)�frame_filenamer@rA�	<genexpr>s�z*Traceback._render_stack.<locals>.<genexpr>r�r"r r�z in r�r�zin r�r�)rJ�line_numbers�
line_range�highlight_linesrKrHrQ�dedentr#rr7ztraceback.error_range)rr4r5)r)'r�rJrrr$rSr8r(r�r	rr��anyrRr�r�r$rr�r�r�r��	linecache�getlinesr�r4r.rIrKrHrQr|r�rB�lstrip�
IndexError�
stylize_ranger�r!)r�r�r*rJr5�exclude_frames�excluded�frame_indexr�r=�
suppressedr��
code_linesr,�
lexer_name�syntax�errorr4r5r9r:r<r�r@)r9r�rAr�s��

���	�


��
���


��
�
�������zTraceback._render_stackr8)"r�r�r��__doc__r0�LOCALS_MAX_LENGTH�LOCALS_MAX_STRINGr
r�r�r�r[rrrr��classmethodrrryrrZrr�r"r#r&rr'r�rr4r�rr@r@r@rArY�s�
��������	�
���
���
�5�������	�
���
�������H�������	�
�
��?��
�frY�__main__r��acCsd}t||�dS)Nr)r\)rR�oner@r@rA�barmsrTcCsd}hd�dd�}t|�dS)NT>�Duncan Idaho�Thufir Hawat�
Paul Atreides�Vladimir Harkonnen)NFT)�
characters�atomic_types)rT)rRr��zedr@r@rA�fooss
�	r\cCstd�dS)Nr)r\r@r@r@rArL�srL)r6N)[r�r@r�r{�dataclassesrr�	itertoolsrrWr�typesrr�typingrr	r
rrr
rrrrr�pip._vendor.pygments.lexersr�pip._vendor.pygments.tokenrrrrrrrrr�pip._vendor.pygments.utilrr�r�_looprr �columnsr!rFr"r#r$r%r&r'�	constrainr(rr)r*�panelr+�scoper,rr-rKr.r/r�rJr0�platform�WINDOWSrNrOr�rBr�r[ryr~rr�r�r�r�rYr�rTr\rLr@r@r@rA�<module>s�4  
��
���������	�
���
���
�		
n
�
�

�