Ë
    Q/æj?(  ã                   ó¦   — d dl mZ d dlmZmZ d dlZd dlZd dlZd dlZd dl	Z
ej                  d„ «       Zddœd„Zdddœd	„Zd
„ Z G d„ d«      Zd„ Zy)é    )ÚTracebackType)ÚListÚOptionalNc               #   ó  K  — 	 d –— y # t         $ �ró} | j                  }g }|��±|j                  j                  j                  }|j                  j
                  j                  d«      }|dk(  �rE|��Bt        j                  ddd¬«      5 }|j                  |«       d d d «       n# 1 sw Y   nxY w|j                  }t        dj                  d«      }|j                  |j                  j                  ¬	«      }t        |j                  d
«      r;|j                  |j                  j                  |j                  j                   ¬«      }t#        ||j
                  i |j$                  ¥dt&        j(                  i¥«      }t+        d ||j,                  |j.                  «      }	|j1                  |	«       n|j1                  |«       |j2                  }|��Œ±d }
t5        |«      D ]  }|
|_        |}
Œ | j7                  |
«      ‚d } ~ ww xY w­w)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              úY/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/torch/utils/_traceback.pyÚreport_compile_source_on_errorr3   /   sÛ  è ø€ ðS*ÜøÜó Q*Ø×Ñˆð ˆØ‰nØ—{‘{×)Ñ)×5Ñ5ˆHØ—[‘[×*Ñ*×.Ñ.Ð/CÓDˆFà˜:Ó%¨&Ñ*<ô2 ×0Ñ0°cÀ%ÐPUÔVð $ÐZ[Ø—G‘G˜F”O÷$÷ $ñ $úð Ÿ™�ÜÐ9¸1¿6¹6À6ÓJ�Ø—|‘|¨E¯L©L×,@Ñ,@�|ÓA�ä˜5Ÿ<™<¨Ô8ð  Ÿ<™<Ø%*§\¡\×%>Ñ%>Ø',§|¡|×'BÑ'Bð (ó �Dô "ØØ—O‘OðØŸ.™.ðà0´'×2FÑ2Fñó�
ô (Ø˜* b§k¡k°2·<±<ó�ð —‘˜WÕ%à—‘˜RÔ à—‘ˆBðG ŠnðL ˆÜ˜5“/ò 	ˆBØ ˆBŒJØ‰Gð	ð × Ñ  Ó)Ð)ûðcQ*üsD   ‚H	„	 ˆH	‰
H“A7HÂ
B%Â	HÂ%B.	Â*D)HÇ,HÈHÈH	©Úbasec                ó  — |€@t         j                  j                  t         j                  j                  t        «      «      }	 t         j                  j	                  | |g«      }| t        |«      dz   d S # t        $ r | cY S w xY w)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)Úfnr5   Úprefixs      r2   Úshorten_filenamerA   †   sq   € à€|Ü�w‰w�‰œrŸw™wŸ™¬xÓ8Ó9ˆð$Ü—‘×#Ñ# R¨ JÓ/ˆð ”#�f“+ ‘/Ð"Ð#Ð#øô ò ØŠ	ðús   Á!A6 Á6BÂBF)r5   Úlinec                ó’   — d}|r| j                   › d�}|› t        | j                  |¬«      › d| j                  › d| j                  › �S )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  # r4   ú:z in )rB   rA   r+   Úlinenor   )r.   r5   rB   Ú
extra_lines       r2   Úformat_framerH   ’   sQ   € ð €JÙØŸ
™
�| 4Ð(ˆ
Øˆ\Ô*¨5¯>©>ÀÔEÐFÀaÈÏÉÀ~ÐUYÐZ_×ZdÑZdÐYeÐfÐfó    c                 óD   — t        t        j                  | «      d   «      S )zJFormat a TracebackType in a short way, printing only the inner-most frame.éÿÿÿÿ)rH   Ú	tracebackÚ
extract_tb©r)   s    r2   Úformat_traceback_shortrO   �   s   € äœ	×,Ñ,¨RÓ0°Ñ4Ó5Ð5rI   c                   ó^   — e Zd ZddgZdd„Zd„ Zd„ Zd„ Zedddd	œd
„«       Z	d„ Z
ed„ «       Zy)ÚCapturedTracebackr)   Úskipr   c                 ó    — || _         || _        y ©N©r)   rR   )Úselfr)   rR   s      r2   Ú__init__zCapturedTraceback.__init__¤   s   € ØˆŒØˆ�	rI   c                 ó   — d | _         y rT   rN   ©rV   s    r2   ÚcleanupzCapturedTraceback.cleanup¨   s	   € Øˆ�rI   c                 óØ   — dd l }| j                  €t        j                  «       S t	        |j
                  j                  j                  | j                  g«      d   | j                  «      S )Nr   )	Útorch._C._profilerr)   rL   ÚStackSummaryÚ_extract_symbolized_tbÚ_CÚ	_profilerÚsymbolize_tracebacksrR   )rV   Útorchs     r2   ÚsummaryzCapturedTraceback.summary«   sT   € Û!à�7‰7ˆ?ä×)Ñ)Ó+Ð+ä%Ø�H‰H×Ñ×3Ñ3°T·W±W°IÓ>¸qÑAØ�I‰Ió
ð 	
rI   c                 ó$   — d d | j                   dœfS )NrU   )rR   rY   s    r2   Ú__getstate__zCapturedTraceback.__getstate__·   s   € ØØØ—I‘Iñ
ð ð 	rI   F)ÚscriptÚcpprR   c                 ó¨   — ddl }| s|r|dk(  sJ d«       ‚t        |j                  j                  j	                  d| |¬«      | s|rd«      S |dz   «      S )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)Úpythonrf   rg   r7   )r\   rQ   r_   r`   Úgather_traceback)rf   rg   rR   rb   s       r2   ÚextractzCapturedTraceback.extract½   sg   € ó 	"á‘SØ˜1’9Ð8Ð8Ó8�9ä Ø�H‰H×Ñ×/Ñ/°tÀFÐPSÐ/ÓTñ ™3ˆAó	
ð 	
ð %)¨1¡Hó	
ð 	
rI   c                 óH   — t        j                  | j                  «       «      S )al  
        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
        )rL   Úformat_listrc   rY   s    r2   ÚformatzCapturedTraceback.formatÕ   s   € ô ×$Ñ$ T§\¡\£^Ó4Ð4rI   c                 óÀ  — ddl }g }g }t        | «      D ]E  \  }}|j                  €|j                  g «       Œ$|j                  d«       |j                  |«       ŒG |j                  j
                  j                  |D �cg c]  }| |   j                  ‘Œ c}«      }t        ||«      D ].  \  }}t        j                  | |   j                  «       «      ||<   Œ0 |S c c}w )z_
        Bulk version of CapturedTraceback.format.  Returns a list of list of strings.
        r   N)r\   Ú	enumerater)   r$   r_   r`   ra   ÚziprL   rm   rc   )Útbsrb   ÚrsÚdelayed_idxsÚir)   ÚstbsÚstbs           r2   Ú
format_allzCapturedTraceback.format_allß   sÌ   € ó
 	"ð )+ˆØˆÜ˜s“^ò 	'‰EˆAˆrØ�u‰uˆ}Ø—	‘	˜"•à—	‘	˜$”Ø×#Ñ# AÕ&ð	'ð �x‰x×!Ñ!×6Ñ6È<Ö7XÀa¸¸A¹¿	»	Ò7XÓYˆÜ˜,¨Ó-ò 	<‰FˆAˆsÜ×)Ñ)¨#¨a©&¯.©.Ó*:Ó;ˆBˆqŠEð	<ð ˆ	ùò	 8Ys   Á?CN)r   )Ú__name__Ú
__module__Ú__qualname__Ú	__slots__rW   rZ   rc   re   Ústaticmethodrk   rn   rx   © rI   r2   rQ   rQ   ¡   sS   „ Ø�v�€Ióòò

òð Ø U°ó 
ó ð
ò.5ð ñó ñrI   rQ   c           	      ó²   — t        j                  «       }t        | |d «      D ]1  }|j                  t        j                  |d   |d   |d   «      «       Œ3 |S )zˆ
    Given a symbolized traceback from symbolize_tracebacks, return a StackSummary object of
    pre-processed stack trace entries.
    Nr+   rB   r   )rL   r]   r&   r$   ÚFrameSummary)r)   rR   r*   r-   s       r2   r^   r^   ÷   sZ   € ô
 ×"Ñ"Ó$€EÜ�b˜˜�iÓ ò RˆØ�‰”Y×+Ñ+¨A¨j©M¸1¸V¹9ÀaÈÁiÓPÕQðRà€LrI   )Útypesr   Útypingr   r   r   rL   Ú
contextlibr    Úos.pathr8   Úcontextmanagerr3   rA   rH   rO   rQ   r^   r~   rI   r2   ú<module>r†      sf   ðå ß !Û Û Û Û Û ðN ×ÑñT*ó ðT*ðl "&ô 
$ð !%¨5ô 	gò6÷Sñ SólrI   