+
    ^|i=                         ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RIH
t
 ^ RIt^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHt ^R
IHtHtHtHtHtHtHt ^tR R lt ! R R]4      t R# )    N)Sequence)TracebackType)AnyOptional)Callable)Terminal256Formatter)Token)ThemeTokenStreamtheme_table)get_terminal_size)	FrameInfoTBTools_safe_string_tokens_filenameeqreprget_line_number_of_framenullreprc          
          V ^8  d   QhR\         \        P                  ,          R\        R\        R\         \
        ,          R\
        /# )   linestheme
has_colors
lvals_toksreturn)list
stack_dataLiner
   boolr   )formats   "4/usr/lib/python3/dist-packages/IPython/core/doctb.py__annotate__r"      sH     4 4
 44 4 [!	4
 4    c                    \         ^,
          p\        R3.pV  EFp  pV\        P                  J d'   \        P                  R3.pVP                  V4       K>  VP                  pVP                  VR7      P                  R4      R,           p	VP                  '       dM   V\        \        V4      4      ,
          p
\        P                  VP                  ^4      3\        R3\        V	3.pM\        R3\        R3\        V	3.pVP                  V4       V'       g   EK  VP                  '       g   EK  V FM  pVP                  \        R\         ,          34       VP                  V4       VP                  \        R34       KO  	  VRR pEKs  	  V# )z
Format tracebacks lines with pointing arrow, leading numbers,
this assumes the stack have been extracted using stackdata.


Parameters
----------
lines : list[Line]

z   (...))	pygmented z...N)INDENT_SIZEr	   r   LINE_GAPLinenoEmextendlinenorenderrstrip
is_currentlenstrPrompt
make_arrowappend)r   r   r   r   numbers_widthtokens
stack_linetoksr-   linepadlvs   &&&&        r!   _format_traceback_linesr=      sW     !OM!4=/F
,,,^^Z01DMM$""  : 6==dCdJ   #c&k"22Cu//23D 	D 	d:*/// ucK&789b!udm, !
 CR[FA D Mr#   c                     a a ] tR t^Tt oRtRtRtRV3R lV 3R llltV3R lR ltV3R lR	 lt	V3R
 lR lt
V3R lR ltV3R lR ltRV3R lR lltRV3R lR lltRV3R lR lltRV3R lR lltV3R ltRtVtV ;t# )DocTBzl

A stripped down version of Verbose TB, simplified to not have too much information when
running doctests

 defaultc                x   < V ^8  d   QhRS[ RS[RS[RS[RS[RS[RS[. R3,          R,          R	S[R,          /# )
r   
theme_namecall_pdbostream	tb_offsetlong_headerinclude_varscheck_cacheNdebugger_cls)r2   r   r   intr   type)r    __classdict__s   "r!   r"   DocTB.__annotate__d   so     #  #  #  	# 
 #  #  #  #  b$h'$.#  Tk# r#   c	                   < \        V\        4      '       g   Q h\        S	V `  VVVVR7       W@n        WPn        W`n        Vf   \        P                  pWpn	        RV n
        R# )a7  Specify traceback offset, headers and color scheme.

Define how many frames to drop from the tracebacks. Calling it with
tb_offset=1 allows use of this handler in interpreters which will have
their own code at the top of the traceback (VerboseTB will first
remove that frame before printing the traceback info).)rC   rD   rE   rJ   NT)
isinstancer2   super__init__rF   rG   rH   	linecache
checkcacherI   skip_hidden)
selfrC   rD   rE   rF   rG   rH   rI   rJ   	__class__s
   &&&&&&&&&r!   rR   DocTB.__init__d   sj    $ *c****!%	 	 	
 #&( #..K&r#   c                &   < V ^8  d   QhRS[ RS[/# )r   
frame_infor   )r   r2   )r    rM   s   "r!   r"   rN      s     e e	 ec er#   c           
     R   \        V\        4      '       g   Q h\        VP                  \        P                  4      '       dW   \
        V P                  ,          P                  \        R3\        P                  RVP                  ,          3\        R3.4      # R\        ,          p\        VP                  \        4      '       g   Q h\        P                  ! VP                   4      w  r4rVVP"                  e   VP"                  P%                  4       pMRpVR8X  d   RpMV P&                  '       d   \(        M\*        p	 \        P,                  ! W4WVV	R7      p
\        V
\.        4      '       g   Q h\
        V P                  ,          P                  \        R	3\        P0                  V3\        P2                  V
3.4      p. pV P&                  '       du    VP6                  pV Fa  pVP9                  \        VP:                  3\        R3\        P2                  R3\        P2                  \=        VP>                  4      3.4       Kc  	  VP                  f   Q h\
        V P                  ,          P                  \C        RVPD                  VP                  R7      4      pY'       d   RMR,          pW R2,          pV\
        V P                  ,          P                  \G        VPH                  \
        V P                  ,          V PJ                  V4      4      ,          pV#   \4         dT    \
        T P                  ,          P                  \        R	3\        P0                  T3\        P2                  R
3.4      p ELi ; i  \@         d    TP9                  \        R3.4        EL^i ; i)zFormat a single stack frame    z![... skipping similar frames: %s]r%   r'   ?z<module>r@   )formatvaluezin z"(***failed resolving arguments***)z= z<Exception trying to inspect frame. No more locals available.T)r-   z, )&rP   r   _sdr   RepeatedFramesr   _theme_namer    r	   ExcNamedescriptionr)   r-   rK   inspectgetargvaluesframe	executingcode_qualnamerH   r   r   formatargvaluesr2   VNameValEmKeyErrorvariables_in_executing_piecer5   namereprvalue	Exceptionr   filenamer=   r   r   )rV   rZ   indentargsvarargsvarkwlocals_funccallvar_reprscoper   fibpvarresults   &&             r!   format_recordDocTB.format_record   s   *i0000jnnj&?&?@@t//077FO;j>T>TT DM	 	 K'*++S1111(/(<(<Z=M=M(N%u+''557DD:D "&!2!2!2vH//5x "%----"4#3#34;;U^ekk4%85;;:NO8 )+
 ">>C%%"CHH-"CL"[[$/"[[$syy/:	  & ~~)))T--.55T:#6#6z?P?PQ
 	$$B&F"++d../66#  D,,-	
 	
 A  " #4#3#34;;d+&JK#P  !! "Zs'   ?B L A3M? AM<;M<?#N&%N&c                &   < V ^8  d   QhRS[ RS[ /# )r   etyper   )r2   )r    rM   s   "r!   r"   rN      s      C C r#   c                    \        ^K\        4       ^ ,          4      p\        V P                  ,          P	                  \
        R3\
        R3.4      pV# )K   z"Traceback (most recent call last):r'   )minr   r   ra   r    r	   )rV   r   widthheads   &&  r!   prepare_headerDocTB.prepare_header   sT    B)+A./4++,33 8 
 r#   c                ,   < V ^8  d   QhRS[ RS[ RS[ /# )r   r   evaluer   r   )r    rM   s   "r!   r"   rN      s"     
 
c 
3 
3 
r#   c                  a   \        \        W34      w  r4\	        TR. 4      p\        T\        4      '       d   \        T\        \        34      '       d   \        TR\        R7      .p\        S P                  ,          P                  \        P                  T3\        R3\        T3.4      .T 3R lT 4       O#    \        \        P                  ! 4       R ,          r!\        \        Y34      w  r4 L; i):Nr   N	__notes__)rx   z: c              3      <"   T F<  p\         SP                  ,          P                  \        \	        VR 4      3.4      x  K>  	  R# 5i)noteN)r   ra   r    r	   r   ).0nrV   s   & r!   	<genexpr>)DocTB.format_exception.<locals>.<genexpr>  s@      A D,,-44ul1f>U6V5WXXs   AA)mapr2   sysexc_infogetattrrP   r   bytesr   ro   r   ra   r    r	   rb   )rV   r   r   	etype_str
evalue_strnotess   f&&   r!   format_exceptionDocTB.format_exception   s    	>$'e_$=!I R0%**je.M.M!%4@AE (()00--+eT]UJ<OP
	
 	
	>!36$'e_$=!Izs   B: :6C2c                   < V ^8  d   QhRS[ RS[S[,          RS[S[,          RS[RS[S[,          RS[S[S[,          ,          /# )r   r   r   etbcontextrF   r   rL   r   BaseExceptionr   rK   r   r2   )r    rM   s   "r!   r"   rN     s]     ,7 ,7,7 ',7 m$	,7
 ,7 C=,7 
d3i,7r#   c           
        Tp VP                   pVf   V P                  MTp\        V\        4      '       g   Q hV P                  \        V4      4      pV^8X  g   Q V4       hV'       d   V P                  W4V4      M. p. p	^ p
\        V4      ^,
          pV	P                  V P                  V^ ,          4      4       V'       d`   V	P                  \        V P                  ,          P                  \        R3\        R3\        RV,          3\        R3\        R3.4      4       V P                  W4      pV.V	,           V,           .#   \         d     ELCi ; i)zFormats the header, traceback and exception message for a single exception.

This may be called multiple times by Python 3 exception chaining
(PEP 3134).
r%   r\   z[... %s skipped frames])__name__AttributeErrorrF   rP   rK   r   r2   get_recordsr1   r5   r   r   ra   r    r	   r   )rV   r   r   r   r   rF   
orig_etyper   recordsframesskippednskippedformatted_exceptions   &&&&&&       r!   format_exception_as_a_whole!DocTB.format_exception_as_a_whole  s=    
	NNE '0&7DNNY	)S))))""3u:.!|$W$|?B$""3;w<!#d((45MMD,,-44 9H DE
 #33EB"55667  		s   E EEc                2   < V ^8  d   QhRS[ RS[RS[RS[/# )r   r   r   rF   r   )r   rK   r   )r    rM   s   "r!   r"   rN   E  s)     ) )} )s )s )s )r#   c                x   V^8X  g   Q V4       hVf   Q hV^,
          pV^,          pW$,
          pV P                   '       dS   \        V P                  ,          P                  4       p\        P
                  ! W`P                  4      p\        VR7      pMRp\        P                  ! VVVR7      p	Tp
^ p. pV
e    \        P                  ! V
P                  4      pVe5   VP                  pVP                  R4      vppVR8X  d   V
P                  p
K]  \        V
P                  4      p\#        W4      pVP%                  V
4       \'        V
RR4      p
K  \)        \        P*                  P	                  WR7      4      VR pV Uu. uF  p\*        P,                  ! V4      NK  	  ppV#   \          d    ^ p Li ; iu upi )   N)style)beforeafterpygments_formatter.IPythontb_next)options)r   r   ra   as_pygments_styler   style_with_executing_nodetb_highlightr   Optionsrd   	getmoduletb_framer   splitr   r   OSErrormaxr5   r   r   r   _from_stack_data_FrameInfo)rV   r   r   rF   r   r   
base_styler   	formatterr   cfmax_lentbsmodmod_name	root_name_resrres2s   &&&&                r!   r   DocTB.get_recordsE  s   !|$W$|A+1???$T%5%56HHJJ88EVEVWE,59II$$(
 '*n''4?"||H$,NN3$7MI I-ZZ 22;;? '+GJJrNY-B:''2232HI)*UADEA	44Q7E   Fs   9AF$ F$ F7$F43F4c                ~   < V ^8  d   QhRS[ RS[S[,          RS[S[,          RS[S[,          RS[RS[S[,          /# )r   r   r   r   rF   r   r   r   )r    rM   s   "r!   r"   rN   p  sY     4* 4*4* '4* m$	4*
 C=4* 4* 
c4*r#   c                   V^ 8  g   Q hV^8X  g   Q V4       hV P                  WW5V4      p\        ^K\        4       ^ ,          4      p\        V P                  ,          p. p	^ p
^pV P                  V4      pV'       d.   Vf   Q hW`P                  VP                  4      ,          pVw  rpMRp\        4       pV'       d   W`P                  WW;V
4      ,          pV P                  V4      pV'       da   \        V^,          4      V9  dJ   VP                  \        V^,          4      4       W`P                  VP                  4      ,          pVw  rpK  RpK  \        V4       F  pW,          p	K  	  V	# )z5Return a nice text document describing the traceback.N)r   r   r   r   ra   get_parts_of_chained_exception!prepare_chained_exception_message	__cause__setidaddreversed)rV   r   r   r   rF   r   formatted_exceptionstermsizer   structured_traceback_partschained_exceptions_tb_offsetlines_of_context	exceptionchained_exc_idsfxs   &&&&&&         r!   structured_tracebackDocTB.structured_tracebackp  s}    {{!|$W$|040P0P31
 r,.q12D,,-02"'($77?	%%% $J$J  %   "+E3F% $D$Ds6R%   ;;FCIR	!-_D##y|$ %(N(N$$) $ &/"s /0B&,& 1 *)r#   c                $   < V ^8  d   QhRS[ RR/# )r   forcer   N)r   )r    rM   s   "r!   r"   rN     s     = =d =t =r#   c                    \        R 4      h)zcanot rundebugger in Docs mode)RuntimeError)rV   r   s   &&r!   debuggerDocTB.debugger  s    ;<<r#   c                L   < V ^8  d   QhRS[ S[S[S[3,          R,          RR/# )r   infoNr   )tupler   )r    rM   s   "r!   r"   rN     s+      E#sC-047 4 r#   c                   T;'       g    \         P                  ! 4       w  r#pW@n        V P                  pVP	                  4        VP                  V P                  W#V4      4       VP                  R 4       VP	                  4        R# )r%   N)r   r   tbrE   flushwritetext)rV   r   r   r   r   rE   s   &&    r!   handlerDocTB.handler  s]    #55s||~,,diis34dr#   c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# )r   r   r   r   r   Nr   )r    rM   s   "r!   r"   rN     s*     	) 	)c 	)# 	)3 	)RV 	)r#   c                    Vf   V P                  4        MV P                  WV34        V P                  4        R#   \         d    \        R4        R# i ; i)z@This hook can replace sys.excepthook (for Python 2.1 or higher).Nz
KeyboardInterrupt)r   r   KeyboardInterruptprint)rV   r   r   r   s   &&&&r!   __call__DocTB.__call__  sG    ;LLNLL%-.	)MMO  	)'(	)s   < AAc                J   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   # )r   rF   rG   rH   _mode)rK   r   r2   )r    rM   s   "r!   r"   rN   T   s7      N      J r#   )rI   rH   rG   rU   r   rF   )linuxFNr   FTNN)NNr   )F)N)NNN)r   
__module____qualname____firstlineno____doc__r   tb_highlight_stylerR   r   r   r   r   r   r   r   r   r   __annotate_func____static_attributes____classdictcell____classcell__)rW   rM   s   @@r!   r?   r?   T   s      L"#  # Je eN 
 
2,7 ,7\) )V4* 4*l= = 	) 	)A  r#   r?   )!rd   rS   r   collections.abcr   typesr   typingr   r   r   r   pygments.formatters.terminal256r   pygments.tokenr	   IPython.utils.PyColorizer
   r   r   IPython.utils.terminalr   tbtoolsr   r   r   r   r   r   r   r)   r=   r?    r#   r!   <module>r     sV      
 $    $  @   D D 4   4ni)G i)r#   