a
    <BìjŒ  ã                   @   sø  d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZmZm Z m!Z!m"Z" d d	lm#Z$ d d
lm%Z% d dl&m'Z' ddl(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ddlAmBZBmCZC dd	lDm#Z# ddlEmFZF ejGdkZHdZIdZJeCeCeeeKeKeKf  dœdd„ZLdddd dd!d!eIeJd"dd"d#dd$œee0 eeK eeK eKeeM eNeNeKeKeNeeN eNeeeMef  eKeeeO eOee gef d%œd&d'„ZPeG d(d)„ d)ƒƒZQeG d*d+„ d+ƒƒZReG d,d-„ d-ƒƒZSeG d.d/„ d/ƒƒZTG d0d1„ d1e9ƒZUG d2d3„ d3ƒZVeWd4k�rôePd"d5� d dlZedd6œd7d8„ZXedd6œd9d:„ZYdd;œd<d=„ZZeZƒ  dS )>é    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           	      c   sx   | \}}|\}}||kr&|||fV  nNt t||d ƒƒD ]:\}}}|rT||dfV  q8|rf|d|fV  q8|ddfV  q8dS )z­Yield start and end positions per line.

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

    Returns:
        Iterable of (LINE, COLUMN1, COLUMN2).
    r   éÿÿÿÿr   N)r   Úrange)	r4   r5   Úline1Úcolumn1Zline2Úcolumn2ÚfirstÚlastÚline_no© r?   úY/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pip/_vendor/rich/traceback.pyÚ_iter_syntax_lines7   s    rA   é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_frames)rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   r6   c                    s¸   | du rt dd�n| ‰ˆjr(ˆdu r(dnˆ‰tt ttt ddœ‡ ‡‡‡‡‡‡‡‡	‡
‡‡‡‡fdd„‰tddœ‡fdd	„}ztƒ }||ƒ tj	W S  t
y²   tj	}ˆt_	| Y S 0 dS )
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Ú	tracebackr6   c                    s<   t j| ||ˆˆ ˆˆ
ˆˆˆˆˆtˆƒˆˆ	ˆd�}ˆ |¡ d S )N©rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   )Ú	TracebackÚfrom_exceptionÚboolÚprint)rT   rU   rV   Zexception_traceback)rG   rH   rP   rN   rO   rL   rM   rR   rK   rQ   rI   Útraceback_consolerF   rJ   r?   r@   Ú
excepthook†   s&    ðzinstall.<locals>.excepthook)Úipr6   c                    sb   i ‰ˆj ‰ ttd dœ‡ ‡fdd„}ddœtttd dœ‡‡‡fdd„‰ˆˆ_|ˆ_ ‡fd	d
„ˆ_d S )N)ÚargsÚkwargsr6   c                     s   |‰ˆ | i |¤Ž dS )zEwrap the default ip.showtraceback to store info for ip._showtracebackNr?   ©r_   r`   )Údefault_showtracebackÚtb_datar?   r@   Úipy_show_traceback£   s    zCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_tracebackF)Ú	is_syntax)r_   re   r`   r6   c                    s~   ˆ  ¡ }| rdn|d }ˆ dd¡}ˆ d¡}|du rB|r>dnd}t|ƒD ]}|du rZ qb|j}qJˆ |d |d |ƒ i ‰dS )z2Internally called traceback from ip._showtracebackNé   Zrunning_compiled_codeFÚ	tb_offsetr   r   )Z_get_exc_infoÚgetr8   Útb_next)re   r_   r`   Z	exc_tupleÚtbZcompiledrg   Ú_)r]   r^   rc   r?   r@   Úipy_display_traceback©   s    
zFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_tracebackc                     s   ˆ | ddi|¤ŽS )Nre   Tr?   ra   )rl   r?   r@   Ú<lambda>Æ   s   ÿÿÿz9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>)Zshowtracebackr   rZ   Z_showtracebackZshowsyntaxerror)r^   rd   )r]   )rb   r^   rl   rc   r@   Úipy_excepthook_closureŸ   s    ÿþz'install.<locals>.ipy_excepthook_closure)r"   Z
is_jupyterr   ÚBaseExceptionr   r   r   Zget_ipythonÚsysr]   Ú	Exception)rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rn   r^   Úold_excepthookr?   )rG   r]   rH   rP   rN   rO   rL   rM   rR   rK   rQ   rI   r\   rF   rJ   r@   ÚinstallS   s*    +ÿÿýü*+rs   c                   @   st   e Zd ZU eed< eed< eed< dZeed< dZee	ee
jf  ed< dZeeeeef eeef f  ed< dS )	ÚFrameÚfilenameÚlinenoÚnameÚ ÚlineNÚlocalsÚlast_instruction)Ú__name__Ú
__module__Ú__qualname__ÚstrÚ__annotations__Úintry   rz   r   r
   r   ÚNoder{   r   r?   r?   r?   r@   rt   Ö   s   
rt   c                   @   sL   e Zd ZU eed< eed< eed< eed< eed< eed�Ze	e ed< dS )	Ú_SyntaxErrorÚoffsetru   ry   rv   Úmsg©Údefault_factoryÚnotesN)
r|   r}   r~   r�   r€   r   r   Úlistrˆ   r   r?   r?   r?   r@   rƒ   à   s   
rƒ   c                   @   sˆ   e Zd ZU eed< eed< dZee ed< dZe	ed< e
ed�Zee ed< e
ed�Zee ed	< dZe	ed
< e
ed�Zed ed< dS )ÚStackÚexc_typeÚ	exc_valueNÚsyntax_errorFÚis_causer†   Úframesrˆ   Úis_groupÚTraceÚ
exceptions)r|   r}   r~   r   r€   r�   r   rƒ   rŽ   rZ   r   r‰   r�   r   rt   rˆ   r�   r’   r?   r?   r?   r@   rŠ   ê   s   
rŠ   c                   @   s   e Zd ZU ee ed< dS )r‘   ÚstacksN)r|   r}   r~   r   rŠ   r€   r?   r?   r?   r@   r‘   ö   s   
r‘   c                   @   s   e Zd ZdgZdS )ÚPathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)r|   r}   r~   Z
highlightsr?   r?   r?   r@   r”   û   s   r”   c                   @   sŒ  e Zd ZdZddddddœZd%dd	d
dddeeddddddœee ee	 ee	 e	ee
 eee	e	eeeeee
ef  e	dœdd„Zedd	d
dddeeddddddœee eee ee	 ee	 e	ee
 eee	e	eeeeee
ef  e	d dœdd„ƒZedeeddddœee eee ee	e	eeeee  edœ
dd„ƒZeeedœdd„Zeƒ eedœdd„ƒZee
e
e
dœd d!„ƒZeƒ e ed"œd#d$„ƒZ!dS )&rX   a  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.
        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ÚpythonZcythonZpyrex)rx   z.pyz.pxdz.pyxz.pxiNrB   rC   rD   FTr?   rW   )ÚtracerF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   c                C   s  |d u rHt  ¡ \}}}|d u s.|d u s.|d u r6tdƒ‚| j||||d�}|| _|| _|| _|| _t 	|pjd¡| _
|| _|| _|| _|| _|	| _|
| _|| _g | _|D ]Z}t|tƒsÚ|jd usÊJ |›d�ƒ‚tj |j¡}n|}tj tj |¡¡}| j |¡ q¤|dk�rtd|ƒnd| _d S )Nz9Value for 'trace' required if not called in except: block©rK   Z	ansi_darkz+ must be a module with '__file__' attributer   é   )rp   Úexc_infoÚ
ValueErrorÚextractr—   rF   rG   rH   r.   Z	get_themerI   rJ   rK   rP   rL   rM   rN   rO   rQ   Ú
isinstancer   Ú__file__ÚosÚpathÚdirnameÚnormpathÚabspathÚappendÚmaxrR   )Úselfr—   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   r‹   rŒ   rV   Zsuppress_entityr    r?   r?   r@   Ú__init__  sB    ÿÿ
ÿþzTraceback.__init__)r‹   rŒ   rV   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   r6   c                C   s>   | 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.
        )rK   rL   rM   rN   rO   )rF   rG   rH   rI   rJ   rK   rP   rL   rM   rN   rO   rQ   rR   )rœ   )Úclsr‹   rŒ   rV   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   Zrich_tracebackr?   r?   r@   rY   S  s4    -øòzTraceback.from_exception)rK   rL   rM   rN   rO   Ú_visited_exceptions)
r‹   rŒ   rV   rK   rL   rM   rN   rO   r©   r6   c          !         s  g }
d}ddl m} t|ddƒp"g }|	du r2tƒ n|	}ttdœdd„}t||jƒ||ƒ||d	�}tj	d
krÆt
|ttfƒrÆd|_|jD ]@}||v r’q„| |¡ |j tjt|ƒ||j|ˆˆ ˆ|d�¡ q„t
|tƒ�rt|jpÜd|jpäd|jpìd|jpôd|j|d�|_|
 |¡ |jj}tttt f  tttt f  dœ‡ ‡fdd„}t!|ƒD �]0\}}|j"j#}d}tj	d
k�rÔ|j$d }t%t&|j" '¡ ||d ƒƒ}|\}}}}|du�rÔ|du�rÔ|du�rÔ|du�rÔ||f||ff}|�r| (d¡�st)j* +|¡�st)j* ,||¡}|j- .dd¡�r�qJt/|�p d||j"j0|�rL‡‡fdd„||j- 1¡ ƒD ƒnd|d�}||ƒ |j- .dd¡�rJ|jdd…= �qJ|�sôt|ddƒ}|du�rº||u�rº|j2}|}|j}d}qF|j3}|du�rôt|ddƒ�sô|j2}|}|j}d}qF�qôqFt4|
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_CWDZ	__notes__N)Ú_objectr6   c                 S   s$   z
t | ƒW S  ty   Y dS 0 dS )z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>N)r   rq   )r«   r?   r?   r@   Úsafe_strÆ  s    
z#Traceback.extract.<locals>.safe_str)r‹   rŒ   rŽ   rˆ   )rD   é   T)rK   rL   rN   rO   r©   ú?rx   )r„   ru   rv   ry   r…   rˆ   )Úiter_localsr6   c                 3   sR   ˆ sˆs| E dH  dS | D ]2\}}ˆ r2|  d¡r2qˆrB|  d¡rBq||fV  qdS )z-Extract locals from an iterator of key pairs.NÚ__rk   ©Ú
startswith)r¯   ÚkeyrU   )rN   rO   r?   r@   Ú
get_localsö  s    
z%Traceback.extract.<locals>.get_localsrf   r   ú<Z_rich_traceback_omitc                    s6   i | ].\}}t  |¡st  |¡s|tj|ˆ ˆd �“qS ))Ú
max_lengthÚ
max_string)ÚinspectÚ
isfunctionÚisclassr   Útraverse)Ú.0r³   rU   )rL   rM   r?   r@   Ú
<dictcomp>.  s   úýz%Traceback.extract.<locals>.<dictcomp>)ru   rv   rw   rz   r{   Ú_rich_traceback_guardÚ	__cause__Ú__suppress_context__)r“   )5Zpip._vendor.richrª   ÚgetattrÚsetr   r   rŠ   r|   rp   Úversion_infor�   ZBaseExceptionGroupZExceptionGroupr�   r’   Úaddr¤   rX   rœ   ÚtypeÚ__traceback__ÚSyntaxErrorrƒ   r„   ru   rv   r•   r…   r�   r�   r   r   Úobjectr   Úf_codeÚco_filenameÚf_lastiÚnextr   Zco_positionsr²   rŸ   r    ÚisabsÚjoinÚf_localsrh   rt   Úco_nameÚitemsÚ	__class__Ú__context__r‘   )!r¨   r‹   rŒ   rV   rK   rL   rM   rN   rO   r©   r“   rŽ   rª   rˆ   Úgrouped_exceptionsr¬   ÚstackÚ	exceptionr¤   r´   Úframe_summaryr>   ru   r{   Zinstruction_indexZinstruction_positionZ
start_lineZend_lineZstart_columnZ
end_columnÚframeÚcauser—   r?   )rN   rO   rL   rM   r@   rœ   œ  sä    ÿü


øÿú	
þ
ýÿûÿþýüþ÷ú
ïÿ
zTraceback.extract)rE   Úoptionsr6   c                 #   s  ˆj }| ¡ ‰ |j}t|tƒ|tƒ|tƒ|tjƒ|t	ƒ|t
ƒtdd� |tƒ|tƒtdd� |t	ƒ|tjƒ|tjƒ|tjƒ|tjƒ|tƒ|tƒ|tjƒtdd� dœdd�‰tƒ ‰tƒ tttdœ‡ ‡‡‡‡‡fdd	„ƒ‰ttˆjjƒƒD ]\}}ˆ||ƒV  qèd S )
NT)Zdim)Zbold)r   úpygments.textúpygments.stringúpygments.functionúpygments.numberzrepr.indentzrepr.strz
repr.bracezrepr.numberzrepr.bool_truezrepr.bool_falsez	repr.nonezscope.borderzscope.equalsz	scope.keyzscope.key.specialF)Zinherit)rÕ   r=   r6   c           	   
   3   sØ  | j r\tˆ | ¡dˆ dddd�}t|ˆjƒ}ˆ ˆ¡� |V  W d   ƒ n1 sR0    Y  | jd urÜˆ ˆ¡�8 ttˆ | j¡ˆ dddˆjd�ˆjƒV  W d   ƒ n1 s®0    Y  t 	| j
› d�d	fˆ| jjƒ¡V  n>| j�rt 	| j
› d�d	fˆ| jƒ¡V  nt 	| j
› d	f¡V  | jD ]}t 	d
ˆ|ƒ¡V  �q | j�r¬t| jdƒD ]\\}}g }t|jƒD ]\}}| ˆ||ƒ¡ �qddV  ttt|Ž d|› �dd�ˆjƒV  �qN|�sÔ| j�rÈt d¡V  nt d¡V  d S )Nz7[traceback.title]Traceback [dim](most recent call last)ztraceback.borderT)r   r   )ÚtitleÚstyleÚborder_styleÚexpandÚpaddingztraceback.border.syntax_error)rà   rá   râ   rã   rF   z: ztraceback.exc_type)z[NOTE] ztraceback.noter   rx   zSub-exception #ztraceback.group.border)rß   rá   zI
[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(   rF   Z	use_themer�   Ú_render_syntax_errorr   Úassembler‹   r…   rŒ   rˆ   r�   Ú	enumerater’   r    r“   r¤   r%   rŽ   Úfrom_markup)	rÕ   r=   Zstack_renderableZnoteZgroup_noZgroup_exceptionrÔ   Z
group_lastZgroup_stack©Zbackground_stylerE   ÚhighlighterÚrender_stackr¦   Ztraceback_themer?   r@   rë   z  sv    ú$

ú÷$
þþ
ýú
	ÿÿz0Traceback.__rich_console__.<locals>.render_stack)rI   Zget_background_styleZget_style_for_tokenr0   Ú	TextTokenr   r   r   ZFunctionr   r   r-   r   ÚConstantZ	Delimiterr   r*   r'   rŠ   rZ   r&   r    Úreversedr—   r“   )r¦   rE   rÚ   rI   Ztoken_styler=   rÕ   r?   ré   r@   Ú__rich_console__[  s8    ðí"CzTraceback.__rich_console__)r�   r6   c                 c   s´   t ƒ }tƒ }|jdkrVtj |j¡rVtjd|j› �dfdt|j	ƒdfdd�}||ƒV  ||j
 ¡ ƒ}d|_t|jd	 t|ƒƒ}| d
||¡ |tjdd|  d dd�7 }|V  d S )Nz<stdin>ú rÜ   ©ú:rÛ   rÞ   rÛ   ©rà   Tr   zbold underlineÚ
u   [traceback.offset]â–²[/])r*   r”   ru   rŸ   r    Úexistsr   ræ   r   rv   ry   ÚrstripZno_wrapÚminr„   ÚlenZstylizerè   )r¦   r�   rê   Úpath_highlighterr•   Zsyntax_error_textr„   r?   r?   r@   rå   Á  s(    
ü
þzTraceback._render_syntax_error)ru   Úcoder6   c                 C   s„   t j |¡d }|sP| d¡}|dkr2|d |… n|}| d¡rPd| ¡ v rPdS z| j |¡pht||ƒj	W S  t
y~   Y dS 0 d S )Nr7   rô   z#!r–   r•   )rŸ   r    ÚsplitextÚindexr²   ÚlowerÚLEXERSrh   r   rw   r   )r¨   ru   rú   ÚextZnew_line_indexÚ
first_liner?   r?   r@   Ú_guess_lexerØ  s    
zTraceback._guess_lexer)rÕ   r6   c                 #   s  t ƒ }ˆj}ttt dœ‡fdd„}d }ˆjdkrRtˆjd t|jƒˆjd  ƒ}d}t	|jƒD �]š\}}|r|||v r|d}q`|r¬|d usŒJ ‚t
dt|ƒ› d	�d
dd�V  d}|dk}	|j‰ t‡ fdd„ˆjD ƒƒ}
tj |j¡�rt
j|t
|jdd�ƒdt|jƒdfd|jdfdd�}n$t
jd|jdfdt|jƒdfdd�}|j d¡�sV|	�sVdV  |V  |j d¡�rz||ƒE d H  q`|
s`zrt |j¡}d |¡}|�s W q`ˆ |j|¡}t|||d|jˆj |jˆj f|jhˆjˆjˆjdd�
}dV  W n< t�y, } z"t
 d|› �df¡V  W Y d }~q`d }~0 0 |j d u�rØ|j \}}t!||ƒD ]ˆ\}}}zH|dk�r„||d  }t|ƒt| "¡ ƒ }|dk�ržt||d  ƒ}W n t#�yº   Y �qNY n0 |j$d||f||fd� �qN|j%�röt&|g||ƒ¢dd�n|V  q`d S ) N)rØ   r6   c                 3   s&   | j r"t| j dˆ jˆ jˆ jd�V  d S )Nrz   )rß   rP   r¶   r·   )rz   r,   rP   rL   rM   )rØ   )r¦   r?   r@   Úrender_localsí  s    ûz.Traceback._render_stack.<locals>.render_localsr   rf   FTz
... z frames hidden ...Úcenterztraceback.error)Zjustifyrà   c                 3   s   | ]}ˆ   |¡V  qd S )Nr±   )r¼   r    )Úframe_filenamer?   r@   Ú	<genexpr>  ó    z*Traceback._render_stack.<locals>.<genexpr>rÜ   ró   rñ   rÞ   z in rÝ   rÛ   zin rµ   rx   )rI   Zline_numbersZ
line_rangeZhighlight_linesrJ   rG   rP   Údedentrô   r   r7   ztraceback.error_range)rà   r4   r5   )rã   )'r”   rI   rt   r   r$   rR   r8   rø   r�   rç   r   ru   ÚanyrQ   rŸ   r    rõ   ræ   r   rv   rw   r²   Ú	linecacheÚgetlinesrÎ   r  r.   rH   rJ   rG   rP   rq   r{   rA   ÚlstripÚ
IndexErrorZstylize_rangerz   r!   )r¦   rÕ   rù   rI   r  Zexclude_framesZexcludedZframe_indexrØ   r<   Z
suppressedr•   Z
code_linesrú   Z
lexer_nameÚsyntaxÚerrorr4   r5   r9   r:   r;   ry   r?   )r  r¦   r@   rä   è  sÆ    

þýú	û


þó
ÿ


ý
ùÿþû÷zTraceback._render_stack)N)"r|   r}   r~   Ú__doc__rþ   ÚLOCALS_MAX_LENGTHÚLOCALS_MAX_STRINGr   r‘   r�   r   rZ   r   r   r   r§   Úclassmethodr   r   ro   r   rY   r   rœ   r"   r#   r&   rï   r'   rƒ   rå   r  rŠ   rä   r?   r?   r?   r@   rX   ÿ   sÈ   û
 þðð5îíHõ
ô @þfrX   Ú__main__r˜   )Úar6   c                 C   s   d}t ||  ƒ d S )Nr   )r[   )r  Zoner?   r?   r@   Úbarm  s    r  c                 C   s   d}h d£ddœ}t | ƒ d S )NT>   zVladimir HarkonnenzDuncan IdahozThufir HawatzPaul Atreides)NFT)Ú
charactersZatomic_types)r  )r  r¾   Zzedr?   r?   r@   Úfoos  s
    ù	r  )r6   c                   C   s   t dƒ d S )Nr   )r  r?   r?   r?   r@   r  €  s    r  )[r¸   r	  rŸ   rp   Zdataclassesr   r   Ú	itertoolsr   rV   r   Útypesr   r   Útypingr   r	   r
   r   r   r   r   r   r   r   r   Zpip._vendor.pygments.lexersr   Zpip._vendor.pygments.tokenr   r   r   r   r   r   r   rì   r   Zpip._vendor.pygments.utilr   rx   r   Z_loopr   r    Úcolumnsr!   rE   r"   r#   r$   r%   r&   r'   Z	constrainr(   rê   r)   r*   Zpanelr+   Zscoper,   rà   r-   r  r.   r/   r•   rI   r0   ÚplatformÚWINDOWSr  r  r�   rA   r   rZ   ro   rs   rt   rƒ   rŠ   r‘   r”   rX   r|   r  r  r  r?   r?   r?   r@   Ú<module>   s¬   4  
þñð 		    n

þ