
    3Ki"(                         S SK r S SKrS SKrS SKrS SKrS SKJr  \ R                  S 5       r	SS.S jr
SSS.S\4S	 jjrS
 r " S S5      rS rg)    N)TracebackTypec               #   &  #     S v   g ! [          Ga  n U R                  n/ nUGb  UR                  R                  R                  nUR                  R
                  R                  S5      nUS:X  GaG  UGbC  [        R                  " SSSS9 nUR                  U5        S S S 5        O! , (       d  f       O= fUR                  n[        SWR                  S5      nUR                  UR                  R                  S	9n[        UR                  S
5      (       a8  UR                  UR                  R                  UR                  R                   S9n[#        UUR
                  0 UR$                  ES[&        R(                  0E5      n[+        S XR,                  UR.                  5      n	UR1                  U	5        OUR1                  U5        UR2                  nUb  GM  S n
[5        U5       H  nXl        Un
M     U R7                  U
5      eS n A ff = f7f)N__compile_source__z<string>wFz.py)modedeletesuffixz__inspect_currentframe()eval)co_nameco_linetable)r   co_firstlineno__inspect_currentframe)	Exception__traceback__tb_framef_codeco_filename	f_globalsgettempfileNamedTemporaryFilewritecompilenamereplacer   hasattrr   r   r
   f_localsinspectcurrentframer   tb_lasti	tb_linenoappendtb_nextreversedwith_traceback)exctbstackfilenamesourcefframecode
fake_framefake_tbr#   s              X/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/torch/utils/_traceback.pyreport_compile_source_on_errorr1   0   s    P* N* n{{))55H[[**../CDF:%&*<2 00U5GGFO   91666J||ELL,@,@|A5<<88  <<%*\\%>%>',||'B'B ( D "OOVu~~V'?AUAUV

 (j++r||TW%R BA nF 5/B JG "   ))]N*sD   H	 HHA8H	B'	H	'
B5	1D(H	-H		HHbasec                   Uc@  [         R                  R                  [         R                  R                  [        5      5      n [         R                  R	                  X/5      nU [        U5      S-   S $ ! [         a    U s $ f = f)ziShorten a source filepath, with the assumption that torch/ subdirectories don't need to be shown to user.N   )ospathdirname__file__
commonpathlen
ValueError)fnr3   prefixs      r0   shorten_filenamer?      so    |wwrwwx89%##RJ/ #f+/#$$  	s    A6 6BBF)r3   linereturnc                    SnU(       a  U R                    S3nU [        U R                  US9 SU R                   SU R                   3$ )z
Format a FrameSummary in a short way, without printing full absolute path or code.

The idea is the result fits on a single line.
 z  # r2   :z in )r@   r?   r)   linenor   )r,   r3   r@   
extra_lines       r0   format_framerG      sQ     J

|4(
\*5>>EFa~UYZ_ZdZdYeff    c                 F    [        [        R                  " U 5      S   5      $ )zJFormat a TracebackType in a short way, printing only the inner-most frame.)rG   	traceback
extract_tbr'   s    r0   format_traceback_shortrN      s    	,,R0455rH   c                   r    \ rS rSrSS/rSSS jjrSS jrS rS	 r\	S
S
SS.S j5       r
S r\	S 5       rSrg)CapturedTraceback   r'   skipr   Nc                     Xl         X l        g Nr'   rR   )selfr'   rR   s      r0   __init__CapturedTraceback.__init__   s    	rH   c                     S U l         g rT   rM   rV   s    r0   cleanupCapturedTraceback.cleanup   s	    rH   c                     SS K nU R                  c  [        R                  " 5       $ [	        UR
                  R                  R                  U R                  /5      S   U R                  5      $ )Nr   )	torch._C._profilerr'   rK   StackSummary_extract_symbolized_tb_C	_profilersymbolize_tracebacksrR   )rV   torchs     r0   summaryCapturedTraceback.summary   sS    !77?))++%HH33TWWI>qA499
 	
rH   c                 $    S S U R                   S.4$ )NrU   )rR   rZ   s    r0   __getstate__CapturedTraceback.__getstate__   s    		
 	
rH   F)scriptcpprR   c                     SSK nU (       d  U(       a  US:w  a  [        S5      e[        UR                  R                  R                  SXS9U (       d  U(       a  S5      $ US-   5      $ )a  
Like traceback.extract_stack(), but faster (approximately 20x faster); it
is fast enough that you can unconditionally log stacks this way as part of
normal execution.  It returns a torch._C._profiler.CapturedTraceback
object that must be formatted specially with format_captured_tb.

By default, this only reports Python backtraces (like extract_stack).  You
can set the script/cpp kwargs to also turn on TorchScript/C++ trace
reporting.
r   Nzskip with script/cpp NYIT)pythonrj   rk   r5   )r^   AssertionErrorrP   ra   rb   gather_traceback)rj   rk   rR   rd   s       r0   extractCapturedTraceback.extract   se     	"Sqy$%?@@ HH//tF/T 3A	
 	
 %)1H	
 	
rH   c                 J    [         R                  " U R                  5       5      $ )a<  
Formats a single torch._C._profiler.CapturedTraceback into a list of
strings equivalent to the output of traceback.format_list.  Note that if
pass it CapturedTraceback with C++ traces,  it is better not to use this
function and use the batch formatting API format_captured_tbs to amortize
the cost of symbolization
)rK   format_listre   rZ   s    r0   formatCapturedTraceback.format   s     $$T\\^44rH   c                    SSK n/ n/ n[        U 5       HG  u  pEUR                  c  UR                  / 5        M%  UR                  S5        UR                  U5        MI     UR                  R
                  R                  U Vs/ s H  o@U   R                  PM     sn5        U H+  n[        R                  " X   R                  5       5      X$'   M-     U$ s  snf )zO
Bulk version of CapturedTraceback.format.  Returns a list of list of strings.
r   N)
r^   	enumerater'   r"   ra   rb   rc   rK   rs   re   )tbsrd   rsdelayed_idxsir'   s         r0   
format_allCapturedTraceback.format_all   s    
 	" &(s^EAuu}		"		$##A& $ 	//L0QLqQL0QRA))#&..*:;BE  		 1Rs   C)rR   r'   )r   )rA   N)__name__
__module____qualname____firstlineno__	__slots__rW   r[   re   rh   staticmethodrp   rt   r|   __static_attributes__ rH   r0   rP   rP      sS    vI	

 U 
 
05  rH   rP   c           	          [         R                  " 5       n[        XS 5       H3  nUR                  [         R                  " US   US   US   5      5        M5     U$ )z|
Given a symbolized traceback from symbolize_tracebacks, return a StackSummary object of
pre-processed stack trace entries.
Nr)   r@   r   )rK   r_   r$   r"   FrameSummary)r'   rR   r(   r+   s       r0   r`   r`      sQ    
 ""$Ebi Y++AjM1V9aiPQ !LrH   )
contextlibr   os.pathr6   r   rK   typesr   contextmanagerr1   r?   strrG   rN   rP   r`   r   rH   r0   <module>r      sk         R Q* Q*h "& 
% !%5 	gS 	g6
V VrrH   