
     hb              #          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 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.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZAmBZB dd	lCm"Z" ddlDmEZE ejF        dk    ZGdZHdZIdeBdeBdeeeJeJeJf                  fdZKddd d!dd"d"eHeId#dd#d$dd%d&ee/         d'eeJ         d(eeJ         d)eJd*eeL         d+eMd,eMd-eJd.eJd/eMd0eeM         d1eMd2eeeLef                  d3eJdeeeN         eNee         gef         fd4ZOe G d5 d6                      ZPe G d7 d8                      ZQe G d9 d:                      ZRe G d; d<                      ZS G d= d>e8          ZT G d? d@          ZUeVdAk    r0 eOd#B           d dlZdCeddfdDZWdCeddfdEZXdGdFZY eY             dS dS )H    N)	dataclassfield)islice)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_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              #      K   | \  }}|\  }}||k    r	|||fV  dS t          t          ||dz                       D ]!\  }}}|r||dfV  |r|d|fV  |ddfV  "dS )zYield 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column1line2column2firstlastline_nos	            Y/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pip/_vendor/rich/traceback.py_iter_syntax_linesrB   6   s       NE7NE7~~Wg%%%%%%$3E%4K4K$L$L 	% 	% E4 %w***** %q')))))q"n$$$$	% 	%    d   X      FT )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_framesrH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   c                   	
 | t          d          n| j        r
dn

dt          t                   dt          dt          t
                   ddf	
fdd	t          ddffd
}	 t                      } ||           t          j	        S # t          $ r t          j	        }t          _	        |cY S w xY w)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                     t                               | ||	
t                              }                    |           d S )NrI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   )	Tracebackfrom_exceptionboolprint)rX   rY   rZ   exception_tracebackrJ   rK   rS   rQ   rR   rO   rP   rU   rN   rT   rL   traceback_consolerI   rM   s       rA   
excepthookzinstall.<locals>.excepthook   sv    
 (66!##//1#$677'!! 7 
 
$ 	 344444rC   ipc           	           i  j         dt          dt          dd ffd}dddt          dt          dt          dd f fd _        | _         fd	 _        d S )
Nargskwargsr6   c                      | | i | dS )zEwrap the default ip.showtraceback to store info for ip._showtracebackNrG   )rf   rg   default_showtracebacktb_datas     rA   ipy_show_tracebackzCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_traceback   s&     G!!42622222rC   F)	is_syntaxrl   c                    	                                 }| rdn|d         }
                    dd          }
                    d|rdnd          }t          |          D ]}| n|j        } |d         |d         |           i 
dS )z2Internally called traceback from ip._showtracebackN   running_compiled_codeF	tb_offsetr   r   )_get_exc_infogetr9   tb_next)rl   rf   rg   	exc_tupletbcompiledrp   _rc   rd   rj   s           rA   ipy_display_tracebackzFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_traceback   s    
 ((**I 3<*M$$1B {{#:EBBHKh1EAFFI9%%    :EZJy|Yq\2666GGGrC   c                       | ddi|S )Nrl   TrG   )rf   rg   rx   s     rA   <lambda>z9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>   s(    5J5J6
!6
%+6
 6
 rC   )showtracebackr	   r_   _showtracebackshowsyntaxerror)rd   rk   ri   rx   rj   rc   s   ` @@@rA   ipy_excepthook_closurez'install.<locals>.ipy_excepthook_closure   s     " 0	3c 	3S 	3T 	3 	3 	3 	3 	3 	3 	3 +0	 	 		#'	;>		 	 	 	 	 	 	 	0 2-
 
 
 
rC   )r"   
is_jupyterr   BaseExceptionr   r   r	   get_ipythonsysrc   	Exception)rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   r~   rd   old_excepthookrc   rb   s    `````````````   @@rA   installr   R   sf   V 18t,,,,W (	 -?-G 	 5M"55 M*5 
	5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 52'
3 '
4 '
 '
 '
 '
 '
 '
R	]]r"""~   #	s   $B& &$CCc                       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__intr   r   r   r   r   Noder   r   rG   rC   rA   r   r      s         MMMKKK
IIID#NNN/3FHT#v{*+,333JNhuU38_eCHo%EFGNNNNNrC   r   c                   p    e Zd ZU eed<   eed<   eed<   eed<   eed<    ee          Ze	e         ed<   dS )	_SyntaxErroroffsetr   r   r   msgdefault_factorynotesN)
r   r   r   r   r   r   r   listr   r   rG   rC   rA   r   r      s`         KKKMMM
IIIKKK	HHHuT222E4922222rC   r   c                       e Zd ZU eed<   eed<   dZee         ed<   dZe	ed<    e
e          Zee         ed<    e
e          Zee         ed	<   dZe	ed
<    e
e          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   r_   r   r   r   r   r   r   r   r   rG   rC   rA   r   r      s         MMMNNN+/L(<(///Hd%555FDK555uT222E49222Hd %d ; ; ;JW;;;;;rC   r   c                   &    e Zd ZU ee         ed<   dS )r   stacksN)r   r   r   r   r   r   rG   rC   rA   r   r      s"         KrC   r   c                       e Zd ZdgZdS )PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)r   r   r   
highlightsrG   rC   rA   r   r      s        -.JJJrC   r   c            $          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dee         dee	         dee	         de	dee
         dedede	de	dedededeee
ef                  de	fdZedd	d
dddeedddddddee         ded ee         dee	         dee	         de	dee
         dedede	de	dedededeee
ef                  de	d!d f"d"            Zedeeddd#dee         ded ee         dede	de	deded!efd$            Zd%ed&ed!efd'Z e            d(ed!efd)            Zed*e
d+e
d!e
fd,            Z e            d-ed!efd.            Z dS )0r]   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pythoncythonpyrex)r   z.pyz.pxdz.pyxz.pxiNrD   rE   rF   FTrG   r\   tracerI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   c                   |Et          j                    \  }}}|||t          d          |                     ||||          }|| _        || _        || _        || _        t          j	        |pd          | _
        || _        || _        || _        || _        |	| _        |
| _        || _        g | _        |D ]}t'          |t(                    s9|j        J |d            t,          j                            |j                  }n|}t,          j                            t,          j                            |                    }| j                            |           |dk    rt9          d|          nd| _        d S )Nz9Value for 'trace' required if not called in except: blockrN   	ansi_darkz+ must be a module with '__file__' attributer      )r   exc_info
ValueErrorextractr   rI   rJ   rK   r.   	get_themerL   rM   rN   rS   rO   rP   rQ   rR   rT   
isinstancer   __file__ospathdirnamenormpathabspathappendmaxrU   )selfr   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   r   r   rZ   suppress_entityr   s                       rA   __init__zTraceback.__init__  s   $ =-0\^^*Hi9#4	8I O   LL)YK !  E 

$&%e&:{;;
"&*!2!2"4"4')' 		' 		'Oos33 '#,88%TTT 988w'?@@&7##BGOOD$9$9::DM  &&&&0:Q#a,,,ArC   r   r   rZ   r6   c                n    |                      ||||	|
|||          } | |||||||	||
|||||          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.
        rN   rO   rP   rQ   rR   )rI   rJ   rK   rL   rM   rN   rS   rO   rP   rQ   rR   rT   rU   )r   )clsr   r   rZ   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rich_tracebacks                     rA   r^   zTraceback.from_exceptionP  sz    Z #//11 % 	
 	
 s!##'//11!
 
 
 	
rC   r   c                    g }	d}
ddl m} t          |dd          pg }dt          dt          fd}	 t           ||j                   ||          |
|
          }t          j        dk    rxt          |t          t          f          r\d	|_        |j        D ]M}|j                            t                              t#          |          ||j        |                     Nt          |t&                    r;t)          |j        pd|j        pd|j        pd|j        pd|j        |          |_        |	                    |           |j        j        }dt8          t:          t          t<          f                  dt8          t:          t          t<          f                  ffd}t?          |          D ]p\  }}|j         j!        }d}t          j        dk    rY|j"        dz  }tG          tI          |j         %                                ||dz                       }|\  }}}}|||
|||f||ff}|rT|&                    d          s?tN          j(        )                    |          s tN          j(        *                    ||          }|j+        ,                    dd          rt[          |pd||j         j.        |r/fd ||j+        /                                          D             nd|          } ||           |j+        ,                    dd          r
|j        dd= rt          |dd          }|r|j0        }|}|j        }d	}
|j1        }|r%t          |dd          s|j0        }|}|j        }d}
I	 te          |	          }|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_objectr6   c                 D    	 t          |           S # t          $ r Y dS w xY w)z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>)r   r   )r   s    rA   safe_strz#Traceback.extract.<locals>.safe_str  s7    27||# 2 2 21112s    
T)r   r   r   r   )rF      )rN   rO   rQ   rR   ?r   )r   r   r   r   r   r   iter_localsc              3      K   ss
| E d{V  dS | D ];\  }}r|                     d          rr|                     d          r5||fV  <dS )z-Extract locals from an iterator of key pairs.N__rw   
startswith)r   keyrY   rQ   rR   s      rA   
get_localsz%Traceback.extract.<locals>.get_locals  s       + .@ ********F"- % %JC) !cnnT.B.B ! ) !cnnS.A.A ! u*$$$$% %rC   rn   r   <_rich_traceback_omitc                     i | ]E\  }}t          j        |          t          j        |          -|t          j        |           FS ))
max_length
max_string)inspect
isfunctionisclassr   traverse).0r   rY   rO   rP   s      rA   
<dictcomp>z%Traceback.extract.<locals>.<dictcomp>"  ss        !+U$+$6u$=$= BIQVAWAW %+<+<" " "  rC   )r   r   r   r   r   _rich_traceback_guard	__cause____suppress_context__)r   )3pip._vendor.richr   getattrr	   r   r   r   r   version_infor   BaseExceptionGroupExceptionGroupr   r   r   r]   r   type__traceback__SyntaxErrorr   r   r   r   r   r   r   r   r   r   objectr   f_codeco_filenamef_lastinextr   co_positionsr   r   r   isabsjoinf_localsrr   r   co_nameitems	__class____context__r   )r   r   r   rZ   rN   rO   rP   rQ   rR   r   r   r   r   r   stack	exceptionr   r   frame_summaryr@   r   r   instruction_indexinstruction_position
start_lineend_linestart_column
end_columnframecauser   s        ````                      rA   r   zTraceback.extract  s   < !000000"9k4@@FB	2c 	2c 	2 	2 	2 	2A	!("344"(9--!	  E 7**i*<n)MNN %)EN%.%9  	(//%-- $Y ) ) 7,72C3E3E .  
 
 
 
 )[11 %1$+0q&/63$+0q"-2!& & &" MM%   \(F%%eCK&89%%V,-% % % % % % % +2)*<*< :( :(&w(/; $( #w..(5(=(B%+/)0==??--1 , ,( -" $" #.$0(4&2 (6%z2,(
  GH$7$7$<$< G7==22 G#%7<<X#F#F )--.DeLL %_"&-5 '
"      /9j9O9U9U9W9W.X.X    "%5#  & u )--.EuMM (QQQI{D99E  ?!	 "/	)E WY0FNN  ?!	!/	 V$$$rC   rH   optionsc              #   6   	
K    j         }|                                |j        }t          i d |t                    d |t
                    d |t                    d |t          j                  d |t                    d |t                    t          d          z   d	 |t                    d
 |t                    t          d          z   d |t                    d |t          j                  d |t          j                  d |t          j                  d |t          j                  d |t                    d |t                    d |t          j                  t          d          z   d          
t!                      t#                      dt$          dt&          dt(          f	 
fd            	t+          t-           j        j                            D ]\  }} 	||          V  d S )Nr   pygments.textpygments.stringpygments.functionpygments.numberzrepr.indentT)dimzrepr.strz
repr.brace)boldzrepr.numberzrepr.bool_truezrepr.bool_falsez	repr.nonezscope.borderzscope.equalsz	scope.keyzscope.key.specialF)inheritr   r?   r6   c              3     K   | j         rnt                              |           d	ddd          }t          |j                  }
                              5  |V  d d d            n# 1 swxY w Y   | j        
                              5  t          t                              | j                  	dddj                  j                  V  d d d            n# 1 swxY w Y   t          j	        | j
         dd	f | j        j                            V  nU| j        r0t          j	        | j
         dd	f | j                            V  nt          j	        | j
         d	f          V  | j        D ]"}t          j	        d
 |                    V  #| j        rt          | j        d          D ]u\  }}g }t#          |j                  D ]$\  }}|                     ||                     %dV  t          t          t)          | d| d          j                  V  v|s7| j        rt          j        d          V  d S t          j        d          V  d S 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  rI   z: ztraceback.exc_type)z[NOTE] ztraceback.noter   r   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(   rI   	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_exceptiongrouped_exceptions
group_lastgroup_stackbackground_stylerH   highlighterrender_stackr   traceback_themes            rA   r&  z0Traceback.__rich_console__.<locals>.render_stackk  s     | +6;&&u--S*!3"7 7 7  $--=tz#J#J &&77 + +****+ + + + + + + + + + + + + + + !-&&77  # 55e6HII"2)H#'$*"&*   

 
 
 
 
               m***,@AK 2 677       Qm***,@AK00     
 m%8:N$OPPPPP V Vm$A;;tCTCTUUUUUU~ 1:5;KQ1O1O  -Ho68&3<_=S3T3T Y Y/
K*11,,{J2W2WXXXXHHH#!#56">H">">)A  
 
       > *e       *d       s%   A..A25A2AC))C-0C-)rL   get_background_styleget_style_for_tokenr0   	TextTokenr   r   r   Functionr   r   r-   r   Constant	Delimiterr   r*   r'   r   r_   r&   r    reversedr   r   )r   rH   r  rL   token_styler?   r   r$  r%  r&  r'  s   ``     @@@@rA   __rich_console__zTraceback.__rich_console__L  s      
 5577/++i00U!3!3 ";;v#6#6 $[[%?%?	
 ";;v#6#6 {{733eoooE KK// kk)44u$7G7G7GG {{622 !++g.>"?"? ";;w/?#@#@ [[)9:: F,< = = H 5 5 [[..  $[[%?%?%D///%Q!$ '
 
 
, &''	A	 A	T A	l A	 A	 A	 A	 A	 A	 A	 A	 A	 A	 
A	F %Xdj.?%@%@AA 	, 	,KD%,ud++++++	, 	,rC   r   c              #   <  K   t                      }t                      }|j        dk    rgt          j                            |j                  rCt          j        d|j         dfdt          |j	                  dfd          } ||          V   ||j
                                                  }d|_        t          |j        d	z
  t          |                    }|                    d
||           |t          j        dd|z  z   dz   d          z  }|V  d S )Nz<stdin> r  :r
  r  r
  r  Tr   zbold underline
u   [traceback.offset]▲[/])r*   r   r   r   r   existsr   r  r   r   r   rstripno_wrapminr   lenstylizer  )r   r   r%  path_highlighterr   syntax_error_textr   s          rA   r  zTraceback._render_syntax_error  sJ     %''*,, I--w~~l344 -}0.002CD*,--/@A)	   '&t,,,,,'K(9(@(@(B(BCC$(!\(1,c2C.D.DEE!!"2FFCCCT-3<"<<!
 
 
 	
  rC   r   codec                 z   t           j                            |          d         }|sT|                    d          }|dk    r
|d |         n|}|                    d          rd|                                v rdS 	 | j                            |          pt          ||          j	        S # t          $ r Y dS w xY w)Nr8   r6  z#!r   r   )r   r   splitextindexr   lowerLEXERSrr   r   r   r   )r   r   r?  extnew_line_index
first_lines         rA   _guess_lexerzTraceback._guess_lexer  s    gx((, 	  "ZZ--N2@B2F2Fo~o..DJ$$T**  x:;K;K;M;M/M/Mx	:>>#&&W*B8T*R*R*WW 	 	 	66	s   =.B, ,
B:9B:r   c              #   X   K   t                      } j        }dt          dt          t                   f fd}d } j        dk    r5t           j        dz  t          |j                   j        dz  z
            }d}t          |j                  D ]\  }}|r||v rd}|r+|J t          dt          |           d	d
d          V  d}|dk    }	|j        t          fd j        D                       }
t          j                            |j                  rSt          j         |t          |j        d                    dt%          |j                  dfd|j        dfd          }n4t          j        d|j        dfdt%          |j                  dfd          }|j                            d          s|	sdV  |V  |j                            d          r ||          E d {V  e|
s	 t-          j        |j                  }d                    |          }|s                     |j        |          }t5          |||d|j         j        z
  |j         j        z   f|j        h j         j         j        d
  
        }dV  |j        |j        \  }}tA          ||          D ]\  }}}	 |dk    r<||dz
           }t          |          t          |!                                          z
  }|dk    rt          ||dz
                     }n# tD          $ r Y tw xY w|#                    d||f||f           |j$        rtK          |g ||          d          n|V  # tL          $ r&}t          j        d| df          V  Y d }~d }~ww xY wd S )Nr  r6   c              3   r   K   | j         r,t          | j         dj        j        j                  V  d S d S )Nr   )r  rS   r   r   )r   r,   rS   rO   rP   )r  r   s    rA   render_localsz.Traceback._render_stack.<locals>.render_locals  s`      | "L""&"4#5#5        rC   r   rn   FTz
... z frames hidden ...centerztraceback.error)justifyr  c              3   B   K   | ]}                     |          V  d S Nr   )r   r   frame_filenames     rA   	<genexpr>z*Traceback._render_stack.<locals>.<genexpr>   s1      WW^66t<<WWWWWWrC   r  r5  r3  r  z in r  r
  zin r   r   )rL   line_numbers
line_rangehighlight_linesrM   rJ   rS   dedentr   r8   ztraceback.error_range)r  r4   r5   )r  r6  )'r   rL   r   r   r$   rU   r9   r;  r   r  r   r   anyrT   r   r   r7  r  r   r   r   r   	linecachegetlinesr   rH  r.   rK   rM   rJ   rS   r   rB   lstrip
IndexErrorstylize_ranger   r!   r   )r   r   r=  rL   rK  exclude_framesexcludedframe_indexr  r>   
suppressedr   
code_linesr?  
lexer_namesyntaxr4   r5   r:   r;   r=   r   errorrP  s   `                      @rA   r  zTraceback._render_stack  s     *,,
	 	84E+F 	 	 	 	 	 	 +/?a"1$EL!!DOq$88 N
 "+EL"9"9 g	 g	K +"?"? !%111DS00DDD$+     
 !1$E"^NWWWWWWWWWJw~~en-- }$$T%.@Q%R%R%RSS*&&(9:Z!45)   }Z!45*&&(9:)   >,,S11 % JJJ~((-- (=///////// >=!*!3EN!C!CJ77:..D ! !!%!2!25>4!H!HJ#"#%)!L4+;;!L4+;;$ */"&.#'?&*&8$  F HHH -9%*%;
s 8J%QT7U7U  3E7G	)#*a<<+5eai+@D.1$ii#dkkmm:L:L.LG#*b==.1*UQY2G.H.HG#- ) ) ) !))
 #00&=',g&6%*G$4 1     !<$ &!.u!5!5 %&    $
 
 
 
7 !   -%e'89         3>Sg	 g	s2   :0M5,A)M5=A L
L+*L+5
N%?N  N%rO  )!r   r   r   __doc__rD  LOCALS_MAX_LENGTHLOCALS_MAX_STRINGr   r   r   r   r_   r   r   r   r   classmethodr   r	   r   r   r^   r   r"   r#   r&   r0  r'   r   r  rH  r   r  rG   rC   rA   r]   r]      s        .  F "&3F  #$&#!!2!2#'#("57!3F 3F 3F3F }	3F
 SM3F 3F }3F 3F 3F 3F 3F !3F !3F 3F 5j123F  !3F 3F 3F 3Fj   #$&#!!2!2#'#("57%F
 F
 F
s)F
 !F
 M*	F
 }F
 SMF
 F
 }F
 F
 F
 F
 F
 !F
 !F
  !F
" 5j12#F
$ %F
& 
'F
 F
 F
 [F
P  "!2!2#'#(p p p}%p !p M*	p p p p !p !p 
p p p [pdd,d,)7d,	d, d, d, d,L UWW   ,       W , C s s    [ UWW}5 }\ } } } W} } }rC   r]   __main__r   ac                 .    d}t          || z             d S )Nr   )r`   )ri  ones     rA   barrl  ^  s     cAgrC   c                 6    d}h ddd}t          |            d S )NT>   Duncan IdahoThufir HawatPaul AtreidesVladimir Harkonnen)NFT)
charactersatomic_types)rl  )ri  r   zeds      rA   fooru  d  s9     $   0
 
 	ArC   c                  $    t          d           d S )Nr   )ru  rG   rC   rA   rc  rc  q  s    ArC   )r6   N)Zr   rW  r   r   dataclassesr   r   	itertoolsr   rZ   r   typesr   r   typingr	   r
   r   r   r   r   r   r   r   r   pip._vendor.pygments.lexersr   pip._vendor.pygments.tokenr   r   r   r   r   r   r   r*  r   pip._vendor.pygments.utilr   r   r   _loopr   r    columnsr!   rH   r"   r#   r$   r%   r&   r'   	constrainr(   r%  r)   r*   panelr+   scoper,   r  r-   rb  r.   r/   r   rL   r0   platformWINDOWSre  rf  r   rB   r   r_   r   r   r   r   r   r   r   r]   r   rl  ru  rc  rG   rC   rA   <module>r     s        				 



 ( ( ( ( ( ( ( (             + + + + + + + +                        A @ @ @ @ @ W W W W W W W W W W W W W W W W 8 8 8 8 8 8 , , , , , , 3 3 3 3 3 3       - - - - - - - -                      !           : : : : : : : :                   * * * * * * * *            
,'
!  %% .%eCcM"#% % % %< "& "..#)-13~ ~ ~g~ C=~ 	~
 ~ C=~ ~ ~ ~ ~ ~ !~ ~ uS*_-.~ ~  tM"M8M3JKSPQ!~ ~ ~ ~B O O O O O O O O 3 3 3 3 3 3 3 3 < < < < < < < <        / / / / /& / / /[	 [	 [	 [	 [	 [	 [	 [	| zGJJJ	   s t        
EGGGGG5 rC   