Ë
    ùÿæi"(  ã                   óœ   — d dl Z d dlZd dlZd dlZd dlZd dlmZ e j                  d„ «       Z	ddœd„Z
dddœdefd	„Zd
„ Z G d„ d«      Zd„ Zy)é    N)ÚTracebackTypec               #   ó  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              úk/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/torch/utils/_traceback.pyÚreport_compile_source_on_errorr1   0   sÇ  è ø€ ðP*ÜøÜó N*Ø×Ñˆð ˆØ‰nØ—{‘{×)Ñ)×5Ñ5ˆHØ—[‘[×*Ñ*×.Ñ.Ð/CÓDˆFà˜:Ó%¨&Ñ*<ô2 ×0Ñ0Ø U°5õàØ—G‘G˜F”O÷÷ ñ úð Ÿ™�ÜÐ9¸1¿6¹6À6ÓJ�Ø—|‘|¨E¯L©L×,@Ñ,@�|ÓA�ä˜5Ÿ<™<¨Ô8ð  Ÿ<™<Ø%*§\¡\×%>Ñ%>Ø',§|¡|×'BÑ'Bð (ó �Dô "ØØ—O‘OØV�u—~‘~ÐVÐ'?Ä×AUÑAUÑVó�
ô
 (¨¨j¸"¿+¹+ÀrÇ|Á|ÓT�Ø—‘˜WÕ%à—‘˜RÔ à—‘ˆBðA ŠnðF ˆÜ˜5–/ˆBØ ˆBŒJØ‰Gð "ð × Ñ  Ó)Ð)ûð]N*ü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)Úfnr3   Úprefixs      r0   Úshorten_filenamer?   …   sq   € à€|Ü�w‰w�‰œrŸw™wŸ™¬xÓ8Ó9ˆð%Ü—‘×#Ñ# R¨ JÓ/ˆð ”#�f“+ ‘/Ð#Ð$Ð$øô ò ØŠ	ðús   Á!A6 Á6BÂBF)r3   ÚlineÚreturnc                ó’   — 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  # r2   Ú:z in )r@   r?   r)   Úlinenor   )r,   r3   r@   Ú
extra_lines       r0   Úformat_framerG   ’   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.éÿÿÿÿ)rG   Ú	tracebackÚ
extract_tb©r'   s    r0   Úformat_traceback_shortrN   ž   s   € äœ	×,Ñ,¨RÓ0°Ñ4Ó5Ð5rH   c                   ób   — e Zd ZddgZddd„Zdd„Zd„ Zd„ Zed	d	dd
œd„«       Z	d„ Z
ed„ «       Zy)ÚCapturedTracebackr'   Úskipr   Nc                 ó    — || _         || _        y ©N©r'   rQ   )Úselfr'   rQ   s      r0   Ú__init__zCapturedTraceback.__init__¦   s   € ØˆŒØˆ�	rH   c                 ó   — d | _         y rS   rM   ©rU   s    r0   ÚcleanupzCapturedTraceback.cleanupª   s	   € Øˆ�rH   c                 óØ   — dd l }| j                  €t        j                  «       S t	        |j
                  j                  j                  | j                  g«      d   | j                  «      S )Nr   )	Útorch._C._profilerr'   rK   ÚStackSummaryÚ_extract_symbolized_tbÚ_CÚ	_profilerÚsymbolize_tracebacksrQ   )rU   Útorchs     r0   ÚsummaryzCapturedTraceback.summary­   sS   € Û!à�7‰7ˆ?ä×)Ñ)Ó+Ð+ä%Ø�H‰H×Ñ×3Ñ3°T·W±W°IÓ>¸qÑAÀ4Ç9Á9ó
ð 	
rH   c                 ó$   — d d | j                   dœfS )NrT   )rQ   rX   s    r0   Ú__getstate__zCapturedTraceback.__getstate__¸   s   € ààØŸ	™	ñð
ð 	
rH   F)ÚscriptÚcpprQ   c                 ó°   — ddl }| s|r|dk7  rt        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)Úpythonre   rf   r5   )r[   ÚAssertionErrorrP   r^   r_   Úgather_traceback)re   rf   rQ   ra   s       r0   ÚextractzCapturedTraceback.extractÁ   sh   € ó 	"á‘SØ�qŠyÜ$Ð%?Ó@Ð@ä Ø�H‰H×Ñ×/Ñ/°tÀFÐPSÐ/ÓTñ ™3ˆAó	
ð 	
ð %)¨1¡Hó	
ð 	
rH   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
        )rK   Úformat_listrb   rX   s    r0   ÚformatzCapturedTraceback.formatÚ   s   € ô ×$Ñ$ T§\¡\£^Ó4Ð4rH   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}«       |D ]+  }t        j                  | |   j                  «       «      ||<   Œ- |S c c}w )z_
        Bulk version of CapturedTraceback.format.  Returns a list of list of strings.
        r   N)
r[   Ú	enumerater'   r"   r^   r_   r`   rK   rm   rb   )Útbsra   ÚrsÚdelayed_idxsÚir'   s         r0   Ú
format_allzCapturedTraceback.format_allä   s¹   € ó
 	"ð &(ˆØˆÜ˜s–^‰EˆAˆrØ�u‰uˆ}Ø—	‘	˜"•à—	‘	˜$”Ø×#Ñ# AÕ&ð $ð 	�‰×Ñ×/Ñ/ÁLÓ0QÁL¸q°°Q±·³ÀLÑ0QÔRÛˆAÜ×)Ñ)¨#¨a©&¯.©.Ó*:Ó;ˆBˆqŠEð ð ˆ	ùò	 1Rs   Á?C)r   )rA   N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__rV   rY   rb   rd   Ústaticmethodrk   rn   ru   © rH   r0   rP   rP   £   sS   „ Ø�v�€Iôóò	
ò
ð Ø U°ó 
ó ð
ò05ð ñó ñrH   rP   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)   r@   r   )rK   r\   r$   r"   ÚFrameSummary)r'   rQ   r(   r+   s       r0   r]   r]   ü   sS   € ô
 ×"Ñ"Ó$€EÜ�b˜˜�iÖ ˆØ�‰”Y×+Ñ+¨A¨j©M¸1¸V¹9ÀaÈÁ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   