
    Ji              '          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/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZCmDZD dd	lEm#Z# ddlFmGZG ej                  dk(  ZIdZJdZKdeDdeDdeeeLeLeLf      fdZMddd d!dd"d"eJeKdd#ddd#d$dd%d&ee0   d'eeL   d(eeL   d)eLd*eeN   d+eOd,eOd-eLd.eLd/eeL   d0eOd1eeO   d2ee3   d3eOd4eeeNef      d5eLdeeeP   ePee   gef   f"d6ZQe G d7 d8             ZRe G d9 d:             ZSe G d; d<             ZTe G d= d>             ZU G d? d@e:      ZV G dA dB      ZWeXdCk(  r) eQd#D       d dlZdEeddfdFZYdEeddfdGZZdIdHZ[ e[        yy)J    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OverflowMethodGroupRenderResultgroup)	Constrain)RegexHighlighterReprHighlighter)Panel)render_scope)Style)SyntaxSyntaxPosition)Themewin32
   P   startendreturnc              #      K   | \  }}|\  }}||k(  r|||f yt        t        ||dz               D ]!  \  }}}|r||df |r|d|f |ddf # yw)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)	r6   r7   line1column1line2column2firstlastline_nos	            X/mnt/e/genesis-system/.venvs/browser-army/lib/python3.12/site-packages/rich/traceback.py_iter_syntax_linesrD   8   s      NE7NE7~Wg%%$3E%4K$L 	% E4w**q'))q"n$	%s   AAd   X      FT )consolewidth
code_widthextra_linestheme	word_wrapshow_localslocals_max_lengthlocals_max_stringlocals_max_depthlocals_hide_dunderlocals_hide_sunderlocals_overflowindent_guidessuppress
max_framesrI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   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_max_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
        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.
        locals_overflow (OverflowMethod, optional): How to handle overflowing locals, or None to disable. Defaults to None.
        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	tracebackr8   c                     t         j                  | ||
	t                    }j                  |       y )NrJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   )	Tracebackfrom_exceptionboolprint)r[   r\   r]   exception_tracebackrK   rL   rV   rS   rT   rR   rP   rQ   rU   rX   rO   rW   rM   traceback_consolerJ   rN   s       rC   
excepthookzinstall.<locals>.excepthook   sh    
 (66!##//-1#$67+'!% 7 
( 	 34    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	 _        y )
Nargskwargsr8   c                      | | i | y)zEwrap the default ip.showtraceback to store info for ip._showtracebackNrH   )rj   rk   default_showtracebacktb_datas     rC   ipy_show_tracebackzCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_traceback   s     G!4262rg   F)	is_syntaxrp   c                     	j                         }| rdn|d   }
j                  dd      }
j                  d      }||rdnd}t        |      D ]  }| n|j                  }  |d   |d   |       i 
y)z2Internally called traceback from ip._showtracebackN   running_compiled_codeF	tb_offsetr   r   )_get_exc_infogetr;   tb_next)rp   rj   rk   	exc_tupletbcompiledrt   _rf   rh   rn   s           rC   ipy_display_tracebackzFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_traceback   s    
 ((*I 3<$1B {{#:EBHK0I !)Aq	9%  :ZZ 
 y|Yq\26Grg   c                       | ddi|S )Nrp   TrH   )rj   rk   r|   s     rC   <lambda>z9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>   s     5J6
!6
%+6
 rg   )showtracebackr	   rb   _showtracebackshowsyntaxerror)rh   ro   rm   r|   rn   rf   s   ` @@@rC   ipy_excepthook_closurez'install.<locals>.ipy_excepthook_closure   st     " 0 0	3c 	3S 	3T 	3 +0		#'	;>		4 2-
rg   )r#   
is_jupyterr   BaseExceptionr   r   r	   get_ipythonsysrf   	Exception)rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r   rh   old_excepthookrf   re   s    ```````````````   @@rC   installr   T   s    ^ 18t,W ((-?-G 	 5M"55 M*5 
	5 5 56)
3 )
4 )
V	]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<   y)	Framefilenamelinenoname lineNlocalslast_instruction)__name__
__module____qualname__str__annotations__intr   r   r   r   r   Noder   r   rH   rg   rC   r   r      sa    MK
ID#N/3FHT#v{{*+,3JNhuU38_eCHo%EFGNrg   r   c                   b    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<   y)	_SyntaxErroroffsetr   r   r   msgdefault_factorynotesN)
r   r   r   r   r   r   r   listr   r   rH   rg   rC   r   r      s.    KM
IK	HT2E492rg   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<   y)Stackexc_type	exc_valueNsyntax_errorFis_causer   framesr   is_groupTrace
exceptions)r   r   r   r   r   r   r   r   r   rb   r   r   r   r   r   r   r   r   rH   rg   rC   r   r      sh    MN+/L(<(/Hd5FDK5T2E492Hd %d ;JW;rg   r   c                       e Zd ZU ee   ed<   y)r   stacksN)r   r   r   r   r   r   rH   rg   rC   r   r      s    Krg   r   c                       e Zd ZdgZy)PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)r   r   r   
highlightsrH   rg   rC   r   r     s
    -.Jrg   r   c            (       d   e Zd ZdZddddddZ	 d4dd	d
dddeedd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e	   dedede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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e	   deded$ee   dedeee
ef      de	d%d f&d&       Zedeeddddd'd!ee   d"ed#ee   dede	de	dee	   deded(ee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
d0e
d%e
fd1       Z  e       d2e!d%efd3       Z"y)5r`   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_max_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
        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.
        locals_overflow (OverflowMethod, optional): How to handle overflowing locals, or None to disable. Defaults to None.
        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.pxiNrE   rF   rG   FTrH   )rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   locals_overlowrV   rW   rX   tracerJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   r   rV   rW   rX   c                    |>t        j                         \  }}}|||t        d      | j                  ||||      }|| _        || _        || _        || _        t        j                  |xs d      | _
        || _        || _        || _        || _        |	| _        |
| _        || _        || _        || _        g | _        |D ]  }t+        |t,              s@|j.                  
J |d       t0        j2                  j5                  |j.                        }n|}t0        j2                  j7                  t0        j2                  j9                  |            }| j(                  j;                  |        |dkD  rt=        d|      | _        y d| _        y )Nz9Value for 'trace' required if not called in except: blockrO   	ansi_darkz+ must be a module with '__file__' attributer      ) r   exc_info
ValueErrorextractr   rJ   rK   rL   r0   	get_themerM   rN   rO   rV   rP   rQ   rR   rS   rT   rU   rW   
isinstancer   __file__ospathdirnamenormpathabspathappendmaxrX   )selfr   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   r   rV   rW   rX   r   r   r]   suppress_entityr   s                         rC   __init__zTraceback.__init__'  s   ( =-0\\^*Hi9#4	8I O  LL)YK ! E 

$&%%e&:{;
"&*!2!2 0"4"4-')' 		'Oos3#,,8U%((STU8ww'?'?@&77##BGGOOD$9:DMM  &		' 1;Q#a,Arg   r_   r   r   r]   rU   r8   c                d    | j                  ||||	|
||||	      } | |f||||||	||
|||||||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_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
            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.
            locals_overflow (OverflowMethod, optional): How to handle overflowing locals, or None to disable. Defaults to None.
            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.
        )rO   rP   rQ   rR   rS   rT   )rJ   rK   rL   rM   rN   rO   rV   rP   rQ   rR   rS   rT   r   rW   rX   )r   )clsr   r   r]   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rich_tracebacks                       rC   ra   zTraceback.from_exception`  sw    b #//-11 % 

 
!##'//-11*!!
 	
rg   )rO   rP   rQ   rR   rS   rT   _visited_exceptionsr   c                N  	 g }d}ddl m} t        |dd      xs g }|

t               n|
}dt        dt
        fd}	 t         ||j                         ||      ||
      }t        j                  dk\  rt        |t        t        f      rwd	|_        |j                  D ]a  }||v r|j                  |       |j                  j!                  t"        j%                  t'        |      ||j(                  ||	|             c t        |t*              rXt-        |j.                  xs d|j0                  xs d|j2                  xs d|j4                  xs d|j6                  |      |_        |j!                  |       |j:                  j                   }dt<        t>        t
        t@        f      dt<        t>        t
        t@        f      f	fd}tC        |      D ]  \  }}|jD                  jF                  }d}t        j                  dk\  rW|jH                  dz  }tK        tM        |jD                  jO                         ||dz               }|\  }}}}|||
|||f||ff}|rP|jQ                  d      s?tR        jT                  jW                  |      s tR        jT                  jY                  ||      }|jZ                  j]                  dd      rt_        |xs d||jD                  j`                  |ru ||jZ                  jc                               D  ci c]I  \  }} te        jf                  |       s/te        jh                  |       s|tk        jl                  | |||      K c} }nd|      }! ||!       |jZ                  j]                  dd      s|j:                  dd=  |sjt        |dd      }"|""|"|ur|"jn                  }|"}|"j(                  }d	}|jp                  }"|"+t        |dd      s|"jn                  }|"}|"j(                  }d}	 ts        |      }#|#S c c} }w )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_max_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
            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_objectr8   c                 8    	 t        |       S # t        $ r Y yw xY w)z1Don't allow exceptions from __str__ to propagate.z<exception str() failed>)r   r   )r   s    rC   safe_strz#Traceback.extract.<locals>.safe_str  s#    27|# 212s   
 	T)r   r   r   r   )rG      )rO   rP   rS   rT   r   ?r   )r   r   r   r   r   r   iter_localsc              3      K   ss| E d{    y| D ]3  \  }}r|j                  d      rr|j                  d      r.||f 5 y7 >w)z-Extract locals from an iterator of key pairs.N__r{   
startswith)r   keyr\   rS   rT   s      rC   
get_localsz%Traceback.extract.<locals>.get_locals  s_      +.@***"- %JC)cnnT.B )cnnS.A u*$% +s   
AA?Arr   r   <_rich_traceback_omit)
max_length
max_string	max_depth)r   r   r   r   r   _rich_traceback_guard	__cause____suppress_context__)r   ):richr   getattrsetr	   r   r   r   r   version_infor   BaseExceptionGroupExceptionGroupr   r   addr   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_localsrv   r   co_nameitemsinspect
isfunctionisclassr   traverse	__class____context__r   )$r   r   r   r]   rO   rP   rQ   rR   rS   rT   r   r   r   r   r   grouped_exceptionsr   stack	exceptionr   r   frame_summaryrB   r   r   instruction_indexinstruction_position
start_lineend_linestart_column
end_columnr   r\   framecauser   s$           ``                          rC   r   zTraceback.extract  s>   B !$"9k4@FB )0CE6I 		2c 	2c 	2 !("3"34"9-!	E 7*i*<n)MN%)EN%.%9%9 	$(::$*..y9((//%-- $Y ) ) 7 7,72C3E3E4F . 		" )[1%1$++0q&//63$++0q"-2!&" MM% \\((F%%eCK&89%%V,-% +2)*< ;(&w(//;; $( ##w.(5(=(=(B%+/)00==?--1,( -" $" #.$0(4&2 (6%z2,(
 H$7$7$<77==2#%77<<X#F ))--.DeL%_"&--55 ' /99O9O9U9U9W.X	 !+U$+$6$6u$=QVAW   %+<+<*:	" 	 "%5%( u ))--.EuMQw;(z &	;=$i)?$H %I !& 3 3I#H!--$W5u.  %H %I % 3 3I$HV$Y	s   AP!rI   optionsc              #      	
K    j                   }|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.                  j0                              D ]  \  }} 	||        y w)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  rA   r8   c              3   4  K   | j                   rTt        j                  |       d	ddd      }t        |j                        }
j                        5  | d d d        | j                  
j                        5  t        t        j                  | j                        	dddj                        j                         d d d        t        j                  | j                   dd	f | j                  j                               nh| j                  r8t        j                  | j                   dd	f | j                               n$t        j                  | j                   d	f       | j                  D ]   }t        j                  d
 |             " | j                  rt        | j                   d      D ]m  \  }}g }t#        |j$                        D ]  \  }}|j'                   ||              d t        t        t)        | d| d      j                         o |s<| j*                  rt        j,                  d       y t        j,                  d       y y # 1 sw Y   $xY w# 1 sw Y   xY ww)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  rJ   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*   rJ   	use_themer   _render_syntax_errorr   assembler   r   r   r   r   	enumerater   r!   r   r   r'   r   from_markup)r  rA   stack_renderablenotegroup_nogroup_exceptionr  
group_lastgroup_stackbackground_stylerI   highlighterrender_stackr   traceback_themes            rC   r+  z0Traceback.__rich_console__.<locals>.render_stack  s    ||6;&&u-S*!3"7  $--=tzz#J &&7 +**+ !!-&&7 # 55e6H6HI"2)H#'$*"&** 


 
 mm'r*,@A 2 2 6 67  mm'r*,@A0 
 mm'7:N$OPP Vmm$A;tCTUUV ~~1:5;K;KQ1O -Ho68&3<_=S=S3T Y/
K*11,{J2WXYH#!#56$3H:">)A
 

  >>**e  **d  ]+ + s8   AJI>%JAJF2J>JJJJ)rM   get_background_styleget_style_for_tokenr2   	TextTokenr   r   r   Functionr   r   r/   r   Constant	Delimiterr   r,   r)   r   rb   r(   r!   reversedr   r   )r   rI   r  rM   token_stylerA   r  r)  r*  r+  r,  s   ``     @@@@rC   __rich_console__zTraceback.__rich_console__r  s     

 557//+i0U!3 ";v#6 $[%?	
 ";v#6 {73eoE K/ k)4u$7GG {62 !+g.>.>"? ";w/?/?#@ [)9)9: F,<,< = H 5 [.  $[%?%D/%Q!$ '
, &'	A	 A	T A	l A	 A	 
A	F %Xdjj.?.?%@A 	,KD%ud++	,s   GG!r   c              #   8  K   t               }t               }|j                  dk7  rpt        j                  j                  |j                        rGt        j                  d|j                   dfdt        |j                        dfd      } ||        ||j                  j                               }d|_        t        |j                  d	z
  t        |            }|j!                  d
||       |t        j"                  dd|z  z   dz   d      z  }| y w)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          rC   r  zTraceback._render_syntax_error  s    %'*,  I-ww~~l334}}../02CD*,,-/@A)	 't,,'(9(9(@(@(BC$(!\((1,c2C.DE!!"2FFCT--3<"<<!
 	
  s   DDr   codec                 R   t         j                  j                  |      d   }|sA|j                  d      }|dk7  r|d | n|}|j	                  d      rd|j                         v ry	 | j                  j                  |      xs t        ||      j                  S # t        $ r Y yw xY w)Nr:   r;  z#!r   r   )r   r   splitextindexr   lowerLEXERSrv   r   r   r   )r   r   rD  extnew_line_index
first_lines         rC   _guess_lexerzTraceback._guess_lexer  s    ggx(, "ZZ-N2@B2Fo~.DJ$$T*x:;K;K;M/M	::>>#&W*B8T*R*W*WW 		s   '2B 	B&%B&r  c              #      K   t               } j                  }dt        dt        t           f fd}d } j
                  dk7  r<t         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       d}|dk(  }	|j                  t        fd j                  D              }
t        j                  j!                  |j                        rXt        j"                   |t        |j                  d            dt%        |j&                        dfd|j(                  dfd      }n;t        j"                  d|j(                  dfdt%        |j&                        dfd      }|j                  j+                  d      s|	sd | |j                  j+                  d      r ||      E d {    r|
rv	 t-        j.                  |j                        }dj1                  |      }|s j3                  |j                  |      }t5        |||d|j&                   j6                  z
  |j&                   j6                  z   f|j&                  h j8                   j:                   j<                  d
      }d |j>                  |j>                  \  }}tA        ||      D ]g  \  }}}	 |dk(  r-||dz
     }t        |      t        |jC                               z
  }|dk(  rt        ||dz
           }|jG                  d||f||f       i |jH                  rtK        |g ||      d      n|  y 7 # tD        $ r Y w xY w# tL        $ r'}t        j"                  d| df       Y d }~1d }~ww xY ww)Nr  r8   c           	   3      K   | j                   rQt        | j                   dj                  j                  j                  j
                  j                         y y w)Nr   )r  rV   r   r   r   overflow)r   r.   rV   rP   rQ   rR   rU   )r  r   s    rC   render_localsz.Traceback._render_stack.<locals>.render_locals  sW     ||"LL""&"4"4#55#55"33!11  s   AA"r   rr   FTz
... z frames hidden ...centerztraceback.error)justifyr  c              3   @   K   | ]  }j                  |        y wNr   ).0r   frame_filenames     rC   	<genexpr>z*Traceback._render_stack.<locals>.<genexpr>(  s     W^66t<Ws   r  r:  r8  r  z in r  r  zin r   r   )rM   line_numbers
line_rangehighlight_linesrN   rK   rV   dedentr   r:   ztraceback.error_range)r  r6   r7   )r  r;  )'r   rM   r   r   r%   rX   r;   r@  r   r!  r   r   anyrW   r   r   r<  r   r   r   r   r   	linecachegetlinesr   rM  r0   rL   rN   rK   rV   r   rD   lstrip
IndexErrorstylize_ranger   r"   r   )r   r  rB  rM   rQ  exclude_framesexcludedframe_indexr  r@   
suppressedr   
code_linesrD  
lexer_namesyntaxr6   r7   r<   r=   r?   r   errorrW  s   `                      @rC   r  zTraceback._render_stack  s    *,


	 
	84E+F 
	 +/??a"1$ELL!DOOq$88N
 "+ELL"9 g	K+"?%111S011CD$+ 
 !1$E"^^NWWWJww~~enn-}}$T%..@Q%RS*&(9:ZZ!45) }}ZZ!45*&(9:) >>,,S1%J~~((-(///=!*!3!3ENN!CJ77:.D !!%!2!25>>4!HJ#"#%)!LL4+;+;;!LL4+;+;;$ */"&..#'??&*&8&8$F H --9%*%;%;
s 8J%QT7U 3E7G	)#*a<+5eai+@D.1$i#dkkm:L.LG#*b=.1*UQY2G.HG #00&=',g&6%*G$4 1 2 !<<   &!.u!5 %& $
{g	N 0X $. ) !))# ! --eW'89  so   G?ONO2NOBN.O ANAO	NONO	O'O	O	OOrU  )#r   r   r   __doc__rI  LOCALS_MAX_LENGTHLOCALS_MAX_STRINGr   r   r   r   rb   r&   r   r   r   r   classmethodr   r	   r   r   ra   r   r   r#   r$   r(   r5  r)   r   r  rM  r   r  rH   rg   rC   r`   r`     s   2 F "&7F  #$&#!!2!2*.#'#(37"57%7F7F }	7F
 SM7F 7F }7F 7F 7F 7F 7F #3-7F !7F !7F !07F  !7F" 5j12#7F$ %7Fr   #$&#!!2!2*.#'#(48"57)M
s)M
 !M
 M*	M
 }M
 SMM
 M
 }M
 M
 M
 M
 M
 #3-M
 !M
  !!M
" ".1#M
$ %M
& 5j12'M
( )M
* 
+M
 M
^  "!2!2*.#'#(<@}% ! M*	    #3- ! ! &c-&89 
 Bd,d,)7d,	d,L W   ,    , C s s   W5 \  rg   r`   __main__r   ac                 $    d}t        || z         y )Nr   )rc   )rp  ones     rC   barrs    s     cAgrg   c                 ,    d}h ddd}t        |        y )NT>   Duncan IdahoThufir HawatPaul AtreidesVladimir Harkonnen)NFT)
charactersatomic_types)rs  )rp  r   zeds      rC   foor|    s"     $ 0
 	Arg   c                      t        d       y )Nr   )r|  rH   rg   rC   rj  rj    s	    Arg   )r8   N)\r   r^  r   r   dataclassesr   r   	itertoolsr   r]   r   typesr   r   typingr	   r
   r   r   r   r   r   r   r   r   r   pygments.lexersr   pygments.tokenr   r   r   r   r   r   r   r/  r   pygments.utilr   r   r   _loopr    r!   columnsr"   rI   r#   r$   r%   r&   r'   r(   r)   	constrainr*   r*  r+   r,   panelr-   scoper.   r  r/   ri  r0   r1   r   rM   r2   platformWINDOWSrl  rm  r   rD   r   rb   r   r   r   r   r   r   r   r`   r   rs  r|  rj  rH   rg   rC   <module>r     s     	 
 (   +    5 K K ,   '  -    ! :    *  
,,'
!  %% .%eCcM"#%< "& "..&*#)-0413#FgF C=F 	F
 F C=F F F F F smF F !F n-F F  uS*_-.!F" #F$ tM"M8M3JKSPQ%FR O O O 3 3 3 < < <   /& /y	 y	x z	s t  
G5 rg   