HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/exceptiongroup/__pycache__/_formatting.cpython-310.pyc
o

���g�Q�@s ddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZddlmZdZd	Zd
ZdZdd
�Zefdd�ZGdd�d�ZdDdd�ZGdd�dej�ZejjZejjZe ejdd�Z!ej"ej#ur�ej$ej_$ejej_ejej_ee_"e ej"dd�d vr�ej$ej_$ejej_ejej_dd!l	m%Z%ddl&Z&e%d"�Z'e'j(�)ej(�ee'_#e'e&_edEd%d&��Zej*dFd(d)��Z+e		*dGdHd/d0��Z,e,j*		*dGdId2d)��Z+e			*dJdKd5d6��Z-e-j*			*dJdLd7d)��Z+			*dJdMd9d:�Z.d;Z/d<Z0d=Z1dZ2e3�Z4d>d?�Z5d@dA�Z6dBdC�Z7dS)N�)�annotationsN)�singledispatch)�
TracebackType)�Any�List�Optional�)�BaseExceptionGroup��
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

cCs8t|d�}|dus|s|�d�}|S|�d|�d�}|S)N�	exception�
z: )�_safe_string)�etype�value�valuestr�line�r�E/usr/local/lib/python3.10/dist-packages/exceptiongroup/_formatting.py�_format_final_exc_lines

�rcCs2z||�WStyd|�d|j�d�YSw)N�<� z
() failed>)�
BaseException�__name__)r�what�funcrrrr&s

�rc@s&eZdZdd�Zdd�Zddd�ZdS)	�_ExceptionPrintContextcCst�|_d|_d|_dS)NrF)�set�seen�exception_group_depth�
need_close��selfrrr�__init__.s
z_ExceptionPrintContext.__init__cCsdd|jS)Nr�)rr!rrr�indent3sz_ExceptionPrintContext.indentNccsl�|durd}|��}|jr||d7}t|t�r%t�||dd��VdS|D]}t�||dd��Vq'dS)N�|rcS�dS�NTr�rrrr�<lambda>>�z-_ExceptionPrintContext.emit.<locals>.<lambda>cSr'r(rr)rrrr*Ar+)r%r�
isinstance�str�textwrap)r"�text_gen�margin_char�
indent_str�textrrr�emit6s�
�z_ExceptionPrintContext.emit�N)r�
__module__�__qualname__r#r%r3rrrrr-srr�type[BaseException]rr�tb�TracebackType | None�return�Nonec	Cs tj�d�t�|||���dS)N�)�sys�stderr�write�join�	traceback�format_exception)rrr8rrr�exceptiongroup_excepthookDs rCc@s<eZdZdddddd�ddd�Zddd�dd�Zdd�ZdS)�PatchedTracebackExceptionNTF)�limit�lookup_lines�capture_locals�compact�_seen�exc_typer7�	exc_valuer�
exc_tracebackr9rE�
int | NonerF�boolrGrHrI�set[int] | Noner:r;c	CsRi}	tjdkr||	d<|du}
|durt�}|�t|��tjjt�|�|||d�|_	||_
t|d�|_z	t
|dd�|_Wn'tydt
tj�dd�dd�}tjdd	�d
krat||�rad|_n�Ynw|r�t|t�r�|j|_|j}|dur{t|�nd|_|j|_|j|_|j|_tjdkr�|j}
|
dur�t|
�nd|_|j|_n#|r�t|ttf�r�t
|dd�dur�t||�}|r�|jd|�d
�7_|r�|j	D]}|j q�|dur�|j!nd|_!|
�s�||fg}|�r�|�"�\}}|�r|j#du�rt|j#�|v�rt$t%|j#�|j#|j#j&||||d�}nd}|�r"|du�o |du�o |j!}nd}|�rJ|j'du�rJ|�rJt|j'�|v�rJt$t%|j'�|j'|j'j&||||d�}nd}|�rqt|t(��rqg}|j)D]}t$t%|�||j&|||d�}|�*|��qZnd}||_#||_'||_)|�r�|�*|j#|j#f�|�r�|�*|j'|j'f�|�r�|�+t,|j)|j)��|s�dSdSdS)N)�rrH)rErFrGr�	__notes__zurllib.error�	HTTPErrorrr$)rP��namez. Did you mean: 'z'?F)rErFrGrIT)rFrGrI)-r=�version_infor�add�idrA�StackSummary�extract�walk_tb�stackrJr�_str�getattrrQ�KeyError�modules�getr,�
issubclass�SyntaxError�filename�linenor-r2�offset�msg�
end_lineno�
end_offset�	NameError�AttributeError�_compute_suggestion_errorr�__suppress_context__�pop�	__cause__rD�type�
__traceback__�__context__r	�
exceptions�append�extend�zip)r"rJrKrLrErFrGrHrI�kwargs�is_recursive_callrR�lno�end_lno�
suggestion�frame�queue�te�e�cause�need_context�contextrr�exc�texcrrrr#Ks�
���	
���

�
"�
����

����z"PatchedTracebackException.__init__��chain�_ctxc	cs��|durt�}g}|}|r9|r8|jdurt}|j}n|jdur)|js)t}|j}nd}d}|�||f�|}|sn|�d|f�t|�D�]#\}}|durU|�|�EdH|j	dur{|j
rp|�d�EdH|�|j
���EdH|�|���EdHqD|j
tkr�|�dt�d��EdHqD|j
dk}|r�|j
d7_
|j
r�|jd|r�dndd�EdH|�|j
���EdH|�|���EdHt|j	�}	|	tkr�|	}
ntd}
d	|_t|
�D]�}||
dk}|r�d
|_tdur�|tk}
nd	}
|
s�|d�nd}|��|dk�rdnd
d|�d�V|j
d7_
|
�s%|j	|j||d�EdHn|	t}|dk�r0dnd}|�d|�d|�d��EdH|�rR|j�rR|��dVd	|_|j
d8_
q�|�rh|j
dk�seJ�d|_
qDdS)Nz#Traceback (most recent call last):
z... (max_group_depth is z)
rrz3Exception Group Traceback (most recent call last):
�+)r0FTz...z+-z  z+---------------- z ----------------
r��sr<zand z more exceptionr
z&+------------------------------------
)rrn�_cause_messagerqrl�_context_messagers�reversedr3rrr[�format�format_exception_onlyr�max_group_depth�len�max_group_widthr �ranger%)r"r�r��outputr��chained_msg�chained_excrf�is_toplevel�num_excs�n�i�last_exc�	truncated�title�	remaining�pluralrrrr��s��
��



�

�
��
���z PatchedTracebackException.formatccs��|jdurt�d|j�VdS|jj}|jj}|dvr)t|t�s#d}|d|}t|jt	�s7t||j�Vnt
durDt
||�EdHnt|�EdHt|jt
jj�rm|jD]}t|d�}dd�|�d�D�EdHqVdS|jdur}t|jd	td
�VdSdS)a�Format the exception part of the traceback.
        The return value is a generator of strings, each ending in a newline.
        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emits several lines that (when
        printed) display detailed information about where the syntax
        error occurred.
        The message indicating which exception occurred is always the last
        string in the output.
        N)�__main__�builtinsz	<unknown>�.�notecSsg|]}|d�qS)r
r)�.0rrrr�
<listcomp>RszCPatchedTracebackException.format_exception_only.<locals>.<listcomp>r
rQ)r)rJrArr\r6r5r,r-rarb�'traceback_exception_format_syntax_error�2traceback_exception_original_format_exception_onlyrQ�collections�abc�Sequencer�split�repr)r"�stype�smodr�rrrr�3s.�




�
�z/PatchedTracebackException.format_exception_only)rJr7rKrrLr9rErMrFrNrGrNrHrNrIrOr:r;)rr5r6r#r�r�rrrrrDJs�YrD�_format_syntax_errorr)�apport_excepthook�partial_apport_excepthook)�
ModuleType�exceptiongroup_fake_sys�__exc�	List[str]cCsttt|�|ddd����S)NT)rH)�listrDror�)r�rrrr��s��r�rocCst|�Sr4)r�)r�rrrr�_�sr�TrE�
Optional[int]r�rNcCs$ttt|�||j|dd�j|d��S)NT)rErH�r�)r�rDrorpr�)r�rEr�rrrrB�s���rBrcCst|||�Sr4)rB)r�rr8rEr�rrrr��s�filercCsD|durtj}tt|�||j|d�j|d�D]	}t||dd�qdS)N)rEr�r<)r��end)r=r>rDrorpr��print)r�rEr�r�rrrr�print_exception�s�
��r�cCst||||�dSr4)r�)r�rr8rEr�r�rrrr��s	�
Any | NonecCst��d}t||||�dS)Nr)r=�exc_infor�)rEr�r�rrrr�	print_exc�sr�i��(r$cCs$||krdS|��|��krtStS)Nr)�lower�
_CASE_COST�
_MOVE_COST)�ch_a�ch_brrr�_substitution_cost�s
r�cCsXt|dd�}|dust|t�sdSt|t�r6t|dt�}|tur"dS|j}zt|�}Wn6ty5YdSwt|t�s=J�|durCdS|j	durP|j	}|j	dusH|j
}t|j�t|j
�t|j�}t|�tkrjdSt|�}|tkrtdS|}d}|D]/}	|	|kr�qzt|	�|dtd}
t|
|d�}
t||	|
�}||
kr�qz|r�||kr�|	}|}qz|S)NrT�objrP�r)r]r,r-rj�	_SENTINELr��dir�	Exceptionri�tb_next�tb_framer��f_locals�	f_globals�
f_builtinsr��_MAX_CANDIDATE_ITEMS�_MAX_STRING_SIZEr��min�_levenshtein_distance)rKr8�
wrong_namer��dr{�wrong_name_len�
best_distancerz�
possible_name�max_distance�current_distancerrrrk�sV
�

���rkcCsR||krdSd}||d�r4||d�r4||||kr4|d7}||d�r4||d�r4||||ks||d�}||d�}d}|d|pGd�r~|d|pOd�r~||d||dkr~|d8}|d|pgd�r~|d|pod�r~||d||dks^|d|p�d�}|d|p�d�}|r�|s�tt|�t|�St|�tks�t|�tkr�|dSt|�t|�kr�||}}t|�t|�t|kr�|dSttttt|�dt��}d}tt|��D]G}||}|t}	}tj}
tt|��D]&}|	t|||�}||}	t||	�t}
t|
|�}|||<||
k�r|}
q�|
|k�r&|dSq�|S)Nrr)	r�r�r�r�r�r=�maxsizer�r�)�a�b�max_cost�pre�post�row�result�bindex�bchar�distance�minimum�index�
substitute�
insert_deleterrrr�sR((�88�


�
�r�)rr7rrr8r9r:r;)r�rr:r�)r�rorrr:r�r()r�rrEr�r�rNr:r�)r�rorrr8rrEr�r�rNr:r�)NNT)
r�rrEr�r�rr�rNr:r;)r�rorrr8rrEr�r�rr�rNr:r;)rEr�r�r�r�rNr:r;)8�
__future__r�collections.abcr�r=r.rA�	functoolsr�typesr�typingrrr�_exceptionsr	r�r�r�r�rr-rrrC�TracebackExceptionrDr��#traceback_exception_original_formatr�r�r]r��
excepthook�__excepthook__r#r��apport_python_hook�fake_sys�__dict__�update�registerr�rBr�r�r�r�r�r��objectr�r�rkr�rrrr�<module>s���

����������
���1