o �J�h(R�@sddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZddlmZdZd Zd Zd Zd d �Zefdd�ZGdd�d�ZdEdd�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&_edFd'd(��Zej*dGd*d+��Z+e ,dHdId1d2��Z,e,j*  ,dHdJd4d+��Z+e   ,dKdLd6d7��Z-e-j*   ,dKdMd8d+��Z+   ,dKdNd:d;�Z.d<Z/d=Z0d>Z1dZ2e3�Z4d?d@�Z5dAdB�Z6dCdD�Z7dS)O�)� 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�XC:\pinokio\api\whisper-webui.git\app\env\lib\site-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"Ztext_gen� margin_charZ indent_str�textrrr�emit6s�  �z_ExceptionPrintContext.emit�N)r� __module__� __qualname__r#r%r1rrrrr-srr�type[BaseException]rr�tb�TracebackType | None�return�Nonec Cs tj�d�t�|||���dS)N�)�sys�stderr�write�join� traceback�format_exception)rrr6rrr�exceptiongroup_excepthookDs rAc@s<eZdZdddddd�ddd�Zddd�dd�Zdd�ZdS)�PatchedTracebackExceptionNTF)�limit� lookup_lines�capture_locals�compact�_seen�exc_typer5� exc_valuer� exc_tracebackr7rC� int | NonerD�boolrErFrG�set[int] | Noner8r9c 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 |d d�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)�r rF)rCrDrEr � __notes__z urllib.error� HTTPErrorrr$)rN� �namez. Did you mean: 'z'?F)rCrDrErGT)rDrErG)-r;� version_infor�add�idr?� StackSummary�extract�walk_tb�stackrHr�_str�getattrrO�KeyError�modules�getr,� issubclass� SyntaxError�filename�linenor-r0�offset�msg� end_lineno� end_offset� NameError�AttributeError�_compute_suggestion_errorr�__suppress_context__�pop� __cause__rB�type� __traceback__� __context__r � exceptions�append�extend�zip)r"rHrIrJrCrDrErFrG�kwargs�is_recursive_callrP�lno�end_lno� suggestion�frame�queue�te�e�cause� need_context�contextrp�excZtexcrrrr#Ks� �  ��  �� �  �  "� �� ��  �� ��z"PatchedTracebackException.__init__��chain�_ctxc ks��|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): �+)r/FTz...z+-z z+---------------- z ---------------- r��sr:zand z more exceptionr z&+------------------------------------ )rrl�_cause_messagerorj�_context_messagerq�reversedr1rprY�format�format_exception_onlyr�max_group_depth�len�max_group_widthr �ranger%)r"r�r�rt�outputr�� chained_msg� chained_excrdZ is_toplevelZnum_excs�n�i�last_exc� truncated�title� remaining�pluralrrrr��s�� ��     �    � �� ���z PatchedTracebackException.formatcks��|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 rO)r)rHr?rrZr4r3r,r-r_r`�'traceback_exception_format_syntax_error�2traceback_exception_original_format_exception_onlyrO� collections�abc�Sequencer�split�repr)r"rt�stype�smodr�rrrr�3s.�      � �z/PatchedTracebackException.format_exception_only)rHr5rIrrJr7rCrKrDrLrErLrFrLrGrMr8r9)rr3r4r#r�r�rrrrrBJs� YrB�_format_syntax_errorr)Zapport_excepthookZpartial_apport_excepthook)� ModuleTypeZexceptiongroup_fake_sys�__excrtr� List[str]cKsttt|�|ddd����S)NT)rF)�listrBrmr�)r�rtrrrr��s  ��r�rmcKst|�Sr2)r�)r�rrtrrr�_�sr�TrC� Optional[int]r�rLcKs$ttt|�||j|dd�j|d��S)NT)rCrF�r�)r�rBrmrnr�)r�rCr�rtrrrr@�s���r@rcKs t|||�Sr2)r@)r�rr6rCr�rtrrrr��s �filecKsD|durtj}tt|�||j|d�j|d�D] }t||dd�qdS)N)rCr�r:)r��end)r;r<rBrmrnr��print)r�rCr�r�rtrrrr�print_exception�s� ��r�cCst||||�dSr2)r�)r�rr6rCr�r�rrrr��s � Any | NonecCst��d}t||||�dS)Nr)r;�exc_infor�)rCr�r�rrrr� print_exc�s r�i��(r$cCs$||krdS|��|��krtStS)Nr)�lower� _CASE_COST� _MOVE_COST)Zch_aZch_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)NrR�objrN�r)r[r,r-rh� _SENTINELr��dir� Exceptionrg�tb_next�tb_framer��f_locals� f_globals� f_builtinsr��_MAX_CANDIDATE_ITEMS�_MAX_STRING_SIZEr��min�_levenshtein_distance) rIr6Z wrong_namer��dryZwrong_name_lenZ best_distancerxZ possible_nameZ max_distanceZcurrent_distancerrrri�sV     �  � � �ricCsR||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�bZmax_cost�pre�post�row�resultZbindexZbchar�distance�minimum�index� substituteZ insert_deleterrrr�sR((�  88�    �  �r�)rr5rrr6r7r8r9)r�rrtrr8r�)r�rmrrrtrr8r�r() r�rrCr�r�rLrtrr8r�)r�rmrrr6rrCr�r�rLrtrr8r�)NNT) r�rrCr�r�rr�rLrtrr8r9)r�rmrrr6rrCr�r�rr�rLr8r9)rCr�r�r�r�rLr8r9)8� __future__r�collections.abcr�r;r.r?� functoolsr�typesr�typingrrr� _exceptionsr r�r�r�r�rr-rrrA�TracebackExceptionrBr�Z#traceback_exception_original_formatr�r�r[r�� excepthook�__excepthook__r#r�Zapport_python_hookZfake_sys�__dict__�update�registerr�r@r�r�r�r�r�r��objectr�r�rir�rrrr�<module>s�    ��  �� ������   � � ��  �  1
Memory