
    fXfe                        d dl m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mZ d dl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( ddl)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z= dd	l>m Z  ddl?m@Z@  ejA                    dk    ZBdZCdZDdddddddddd 	d!ee,         d"eeE         d#eEd$eeF         d%eGd&eGd'eGd(eeeFef                  d)eEd*eeeH         eHee         gef         fd+ZIe G d, d-                      ZJe G d. d/                      ZKe G d0 d1                      ZLe G d2 d3                      ZM G d4 d5e4          ZN G d6 d7          ZOePd8k    r4dd9l+m,Z,  e,            Z+d dlZd:ed*dfd;ZQd:ed*dfd<ZRd>d=ZS eS             dS dS )?    )absolute_importN)	dataclassfield)walk_tb)
ModuleTypeTracebackType)	AnyCallableDictIterableListOptionalSequenceTypeUnion)guess_lexer_for_filename)CommentKeywordNameNumberOperatorString)Text)Token)ClassNotFound   )pretty)	loop_last)Columns)ConsoleConsoleOptionsConsoleRenderableRenderResultgroup)	Constrain)RegexHighlighterReprHighlighter)Panel)render_scope)Style)Syntax)ThemeWindows
   P   d      FT )	consolewidthextra_linestheme	word_wrapshow_localsindent_guidessuppress
max_framesr3   r4   r5   r6   r7   r8   r9   r:   r;   returnc        	   
         | t          t          j                  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)
a8  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.
        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.
        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.

    N)filetype_value	tracebackr<   c                 x   	 	                     t                              | ||
                     d S )N)r4   r5   r6   r7   r8   r9   r:   r;   )print	Tracebackfrom_exception)r?   r@   rA   r5   r9   r;   r8   r:   r6   traceback_consoler4   r7   s      S/var/www/html/Qu*py/bism/lib/python3.11/site-packages/pip/_vendor/rich/traceback.py
excepthookzinstall.<locals>.excepthookF   s`    
 	$$'#'+!% %  	
 	
 	
 	
 	
    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kwargsr<   c                      | | i | dS )zEwrap the default ip.showtraceback to store info for ip._showtracebackNr2   )rL   rM   default_showtracebacktb_datas     rG   ipy_show_tracebackzCinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_show_traceback_   s&     G!!42622222rI   F)	is_syntaxrR   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getrangetb_next)rR   rL   rM   	exc_tupletbcompiledrV   _rH   rJ   rP   s           rG   ipy_display_tracebackzFinstall.<locals>.ipy_excepthook_closure.<locals>.ipy_display_tracebacke   s    
 ((**I 3<*M$$1B {{#:EBBHKh1EAFFI9%%    :EZJy|Yq\2666GGGrI   c                       | ddi|S )NrR   Tr2   )rL   rM   r_   s     rG   <lambda>z9install.<locals>.ipy_excepthook_closure.<locals>.<lambda>   s(    5J5J6
!6
%+6
 6
 rI   )showtracebackr	   bool_showtracebackshowsyntaxerror)rJ   rQ   rO   r_   rP   rH   s   ` @@@rG   ipy_excepthook_closurez'install.<locals>.ipy_excepthook_closure[   s     " 0	3c 	3S 	3T 	3 	3 	3 	3 	3 	3 	3 +0	 	 		#'	;>		 	 	 	 	 	 	 	0 2-
 
 
 
rI   )r    sysstderrr   BaseExceptionr   r   r	   get_ipythonrH   	Exception)r3   r4   r5   r6   r7   r8   r9   r:   r;   rf   rJ   old_excepthookrH   rF   s    ````````   @@rG   installrm   $   s(   @ 5<OSZ0000
M"

 M*
 
	
 
 
 
 
 
 
 
 
 
 
 
 
 
*'
3 '
4 '
 '
 '
 '
 '
 '
R	]]r"""~   #	s   4$B $C ?C c                   p    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S )Framefilenamelinenoname lineNlocals)__name__
__module____qualname__str__annotations__intrt   ru   r   r   r   Noder2   rI   rG   ro   ro      s[         MMMKKK
IIID#NNN/3FHT#v{*+,33333rI   ro   c                   B    e Zd ZU eed<   eed<   eed<   eed<   eed<   dS )_SyntaxErroroffsetrp   rt   rq   msgN)rv   rw   rx   r{   rz   ry   r2   rI   rG   r~   r~      s=         KKKMMM
IIIKKK	HHHHHrI   r~   c                   z    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<   dS )	Stackexc_type	exc_valueNsyntax_errorFis_cause)default_factoryframes)rv   rw   rx   ry   rz   r   r   r~   r   rc   r   listr   r   ro   r2   rI   rG   r   r      sj         MMMNNN+/L(<(///Hd%555FDK55555rI   r   c                   &    e Zd ZU ee         ed<   dS )TracestacksN)rv   rw   rx   r   r   rz   r2   rI   rG   r   r      s"         KrI   r   c                       e Zd ZdgZdS )PathHighlighterz(?P<dim>.*/)(?P<bold>.+)N)rv   rw   rx   
highlightsr2   rI   rG   r   r      s        -.JJJrI   r   c                   L   e Zd ZdZddddddZddd	dd
d
deeddfdee         dee	         de	de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f
dee         dedee         dee	         de	de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fdee         dede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 ))rD   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.
        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.
        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)rs   z.pyz.pxdz.pyxz.pxiNr0   r1   FTr2   tracer4   r5   r6   r7   r8   r9   locals_max_lengthlocals_max_stringr:   r;   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t3          d|          nd| _        d S )Nz9Value for 'trace' required if not called in except: blockr8   	ansi_darkz+ must be a module with '__file__' attributer      )rg   exc_info
ValueErrorextractr   r4   r5   r+   	get_themer6   r7   r8   r9   r   r   r:   
isinstancery   __file__ospathdirnamenormpathabspathappendmaxr;   )selfr   r4   r5   r6   r7   r8   r9   r   r   r:   r;   r   r   rA   suppress_entityr   s                    rG   __init__zTraceback.__init__   s    =-0\^^*Hi9#4	8I O   LL)YK !  E 

&%e&:{;;
"&*!2!2')' 		' 		'Oos33 '#,88%TTT 988w'?@@&7##BGOOD$9$9::DM  &&&&0:Q#a,,,ArI   r   r   rA   r<   c                 `    |                      ||||          } | |||||||	|
|||          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.
            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.
            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.
        r   )
r4   r5   r6   r7   r8   r9   r   r   r:   r;   )r   )clsr   r   rA   r4   r5   r6   r7   r8   r9   r   r   r:   r;   rich_tracebacks                  rG   rE   zTraceback.from_exception   sb    L i % 
 
 s##'//!
 
 
 	
rI   c           	      V   g }d}ddl m}	 dt          dt          fd}
	 t	           |
|j                   |
|          |          }t          |t                    r:t          |j	        pd|j
        pd	|j        pd|j        pd
|j                  |_        |                    |           |j        j        }t#          |          D ]\  }}|j        j        }|rT|                    d          s?t*          j                            |          s t*          j                            |	|          }|j                            dd          rt7          |pd	||j        j        |r&fd|j                                        D             nd          } ||           |j                            dd          r
|j        dd= t=          |dd          }|r|j        }|}|j         }d}|j!        }|r%t=          |dd          s|j        }|}|j         }d}	 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.

        Returns:
            Trace: A Trace instance which you can use to construct a `Traceback`.
        Fr   )_IMPORT_CWD_objectr<   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>)ry   rk   )r   s    rG   safe_strz#Traceback.extract.<locals>.safe_strS  s7    27||# 2 2 21112s    
T)r   r   r   ?rs   )r   rp   rq   rt   r   <_rich_traceback_omitc                 F    i | ]\  }}|t          j        |           S ))
max_length
max_string)r   traverse).0keyr@   r   r   s      rG   
<dictcomp>z%Traceback.extract.<locals>.<dictcomp>x  sK        'C V_!'8'8    rI   N)rp   rq   rr   ru   _rich_traceback_guard	__cause____suppress_context__)r   )#pip._vendor.richr   r	   ry   r   rv   r   SyntaxErrorr~   r   rp   rq   r   r   r   r   r   r   f_codeco_filename
startswithr   r   isabsjoinf_localsrX   ro   co_nameitemsgetattr	__class____traceback____context__r   )r   r   r   rA   r8   r   r   r   r   r   r   stackr   frame_summaryline_norp   framecauser   s        ``            rG   r   zTraceback.extract5  s   2 !000000	2c 	2c 	2 	2 	2 	2?	!("344"(9--!  E )[11 %1$+0q&/63$+0q"-2!& & &" MM%   \(F*1)*<*< ( (&w(/; GH$7$7$<$< G7==22 G#%7<<X#F#F )--.DeLL %_"&-5 #	      +8*@*F*F*H*H       u )--.EuMM (QQQI{D99E  ?!	 "/	)E WY0FNN  ?!	!/	 V$$$rI   r3   optionsc              #     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#          t%          | j        j                            D ]\  }}	|	j        rnt-          |                     |	          d|ddd          }
t1          |
| j                  }
|                    |          5  |
V  d d d            n# 1 swxY w Y   |	j        |                    |          5  t1          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  |s5|	j"        rt;          j#        d          V  t;          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)inheritz7[traceback.title]Traceback [dim](most recent call last)ztraceback.border)r   r   )titlestyleborder_styleexpandpaddingztraceback.border.syntax_error)r   r   r   r   r4   z: ztraceback.exc_typezI
[i]The above exception was the direct cause of the following exception:
zH
[i]During handling of the above exception, another exception occurred:
)$r6   get_background_styleget_style_for_tokenr,   	TextTokenr   r   r   Functionr   r   r*   r   Constant	Delimiterr   r'   r   reversedr   r   r   r(   _render_stackr%   r4   	use_themer   _render_syntax_errorr   assembler   r   r   r   from_markup)r   r3   r   r6   background_styletoken_styletraceback_themehighlighterlastr   stack_renderables              rG   __rich_console__zTraceback.__rich_console__  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!$ '
 
 
, &''$Xdj.?%@%@AA .	 .	KD%| +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 > *e      *d    Y.	 .	s%   *H;;H?	H?	"AJ66J:	=J:	r   c              #     K   t                      }t                      }|j        dk    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   rp   r   r   ry   rq   rt   rstripno_wrapminr   lenstylizer   )r   r   r   path_highlighterr   syntax_error_textr   s          rG   r   zTraceback._render_syntax_error  s1     %''*,, I--=,\*,,.?@&\())+<=%	  D #"4((((('K(9(@(@(B(BCC$(!\(1,c2C.D.DEE!!"2FFCCCT-3<"<<!
 
 
 	
  rI   rp   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)Nr   z#!r   r   )r   r   splitextindexr   lowerLEXERSrX   r   rr   r   )r   rp   r  extnew_line_index
first_lines         rG   _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              #      K   t                      } j        }i dt          dt          ffd}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         |t          |	j        d                    dt          |	j                  dfd|	j        dfd          }|	j                            d          s|
sdV  |V  |	j                            d          r ||	          E d {V  |s	  ||	j                  }                     |	j        |          }t)          |||d	|	j         j        z
  |	j         j        z   f|	j        h j        d j        d
  
        }dV  |	j        rt3          |g ||	          d          n|V  # t4          $ r&}t          j        d| df          V  Y d }~d }~ww xY wd S )Nrp   r<   c                                          |           }|Dt          | ddd          5 }|                                }ddd           n# 1 swxY w Y   || <   |S )zRead files, and cache results on filename.

            Args:
                filename (str): Filename to read

            Returns:
                str: Contents of file
            Nrtzutf-8replace)encodingerrors)rX   openread)rp   r  	code_file
code_caches      rG   	read_codez*Traceback._render_stack.<locals>.read_code  s     >>(++D|dWY   ,$>>++D, , , , , , , , , , , , , , , (,
8$Ks   AAAr   c              3   r   K   | j         r,t          | j         dj        j        j                  V  d S d S )Nru   )r   r9   r   r   )ru   r)   r9   r   r   )r   r   s    rG   render_localsz.Traceback._render_stack.<locals>.render_locals*  s`      | "L""&"4#5#5        rI   r   rT   FTz
... z frames hidden ...centerztraceback.error)justifyr   c              3   B   K   | ]}                     |          V  d S )N)r   )r   r   frame_filenames     rG   	<genexpr>z*Traceback._render_stack.<locals>.<genexpr>M  s1      WW^66t<<WWWWWWrI   r   r   r   r   z in r   r   r   rs   X   )r6   line_numbers
line_rangehighlight_linesr7   
code_widthr9   dedentr   )r   r   )r   r6   ry   ro   r   r"   r;   rY   r   r   	enumerater   rp   anyr:   r   rq   rr   r   r  r+   r5   r7   r9   ru   r   rk   )r   r   r   r6   r  r  exclude_framesexcludedframe_indexr   first
suppressedr   r  
lexer_namesyntaxerrorr  r  s   `                @@rG   r   zTraceback._render_stack  s     *,,
%'
	 	 	 	 	 	 	 	$	 	84E+F 	 	 	 	 	 	 +/?a"1$EL!!DOq$88 N
 "+EL"9"9 D	 D	K +"?"? !%111DS00DDD$+     
 !1$E"^NWWWWWWWWWJ=  en<M!N!N!NOO&U\""$5601%  D >,,S11 % JJJ~((-- (=///////// #"$9U^44D!%!2!25>4!H!HJ#"#%)!L4+;;!L4+;;$ */"&.#%&*&8$  F HHH !<$ &!.u!5!5 %&    $
 
 
 
 !   -%e'89         )#CD	 D	s   7A4I
JJ  J)!rv   rw   rx   __doc__r  LOCALS_MAX_LENGTHLOCALS_MAX_STRINGr   r   r{   ry   rc   r   r   r   r   classmethodr   r	   ri   r   rE   r   r    r!   r#   r   r$   r~   r   r  r   r   r2   rI   rG   rD   rD      sa        (  F "&"#!"!2!257,F ,F,F },F 	,F
 },F ,F ,F ,F ,F ,F 5j12,F ,F ,F ,F ,F\   ##!"!2!2574
 4
s)4
 !4
 M*	4

 }4
 4
 }4
 4
 4
 4
 4
 4
 5j124
 4
 
4
 4
 4
 [4
l  "!2!2f f}%f !f M*	f
 f f f 
f f f [fPLL)7L	L L L L\ UWW   ,       W * C s s    [ UWWm5 m\ m m m Wm m mrI   rD   __main__)r    ac                 .    d}t          || z             d S )Nr   )rC   )r4  ones     rG   barr7    s    cAgrI   c                 6    d}h ddd}t          |            d S )NT>   Duncan IdahoThufir HawatPaul AtreidesVladimir Harkonnen)NFT)
charactersatomic_types)r7  )r4  r   zeds      rG   foor@    s9     $   0
 
 	ArI   c                      	 	 t          d           d S #  t           Y d S xY w#  t                              d           Y d S xY w)Nr   Tr   )r@  slfkjsldkfjr3   print_exceptionr2   rI   rG   r.  r.    sX    	6A	6###555555s    	 # # A)r<   N)T
__future__r   r   platformrg   dataclassesr   r   rA   r   typesr   r   typingr	   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   rs   r   _loopr   columnsr   r3   r    r!   r"   r#   r$   	constrainr%   r   r&   r'   panelr(   scoper)   r   r*   r-  r+   r   r6   r,   systemWINDOWSr0  r1  r{   ry   rc   ri   rm   ro   r~   r   r   r   rD   rv   r7  r@  r.  r2   rI   rG   <module>rS     s   & & & & & & 				  



 ( ( ( ( ( ( ( (       + + + + + + + + W W W W W W W W W W W W W W W W W W W W W W @ @ @ @ @ @ 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                   T T T T T T T T T T T T T T             : : : : : : : :                                    
(/

y
(  
 "&13i i igi C=i 	i
 C=i i i i uS*_-.i i tM"M8M3JKSPQi i i iX 4 4 4 4 4 4 4 4         6 6 6 6 6 6 6 6        / / / / /& / / /L L L L L L L L^ z      giiGJJJs t    s t    6 6 6 6 
EGGGGGE rI   