ó
    Ñ]j\  ã                   óð   • S r SSKrSSKJr  SSKr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                  " \R                  S \R                   5       5      rS
S\4S jjr " S S	\R$                  5      rg)zéCompiler tools with improved interactive support.

Provides compilation machinery similar to codeop, but with caching support so
we can provide interactive tracebacks.

Authors
-------
* Robert Kern
* Fernando Perez
* Thomas Kluyver
é    N)ÚPyCF_ONLY_AST)Úcontextmanagerc              #   óV   #   • U  H  n[        [        U5      R                  v •  M!     g 7f©N)ÚgetattrÚ
__future__Úcompiler_flag)Ú.0Úfnames     ÚT/home/mande/repo/quber/.venv/lib/python3.13/site-packages/IPython/core/compilerop.pyÚ	<genexpr>r   /   s%   é € ð IÚ+G %ô &¤j°%Ó8×FÖFÚ+Gùs   ‚')Úreturnc                 ó�   • [         R                  " U R                  S5      5      R                  5       nSR	                  XSS 5      $ )z]Compute a (probably) unique name for code for caching.

This now expects code to be unicode.
zutf-8z<ipython-input-{0}-{1}>Né   )ÚhashlibÚsha1ÚencodeÚ	hexdigestÚformat)ÚcodeÚnumberÚhash_digests      r   Ú	code_namer   6   s>   € ô
 —,’,˜tŸ{™{¨7Ó3Ó4×>Ñ>Ó@€Kð %×+Ñ+¨FÀÀÐ4DÓEÐEó    c                   ól   • \ rS rSrSrS rSS jrS r\S 5       r	S r
S\4S	 jrSS jr\S 5       rSrg
)ÚCachingCompileréE   zFA compiler that caches code compiled from interactive statements.
    c                 óP   • [         R                  R                  U 5        0 U l        g r   )ÚcodeopÚCompileÚ__init__Ú_filename_map©Úselfs    r   r!   ÚCachingCompiler.__init__I   s   € Ü�‰×Ñ Ô%ð
  ˆÕr   c                 ó>   • [        XX0R                  [        -  S5      $ )zµParse code to an AST with the current compiler flags active.

Arguments are exactly the same as ast.parse (in the standard library),
and are passed to the built-in compile function.é   )ÚcompileÚflagsr   )r$   ÚsourceÚfilenameÚsymbols       r   Ú	ast_parseÚCachingCompiler.ast_parseQ   s   € ô
 �v¨·±¼mÑ1KÈQÓOÐOr   c                 ó.   • [         R                  U l        g)z&Reset compiler flags to default state.N)r   ÚPyCF_DONT_IMPLY_DEDENTr)   r#   s    r   Úreset_compiler_flagsÚ$CachingCompiler.reset_compiler_flagsX   s   € ô ×2Ñ2ˆ�
r   c                 ó   • U R                   $ )z;Flags currently active in the compilation process.
        ©r)   r#   s    r   Úcompiler_flagsÚCachingCompiler.compiler_flags^   s   € ð �z‰zÐr   c                 ó   • [        X#5      $ )aQ  Compute filename given the code, and the cell number.

Parameters
----------
raw_code : str
    The raw cell code.
transformed_code : str
    The executable Python source code to cache and compile.
number : int
    A number which forms part of the code's name. Used for the execution
    counter.

Returns
-------
The computed filename.
)r   )r$   Úraw_codeÚtransformed_coder   s       r   Úget_code_nameÚCachingCompiler.get_code_named   s   € ô" Ð)Ó2Ð2r   r   c                 óJ   • XR                   ;   a  SSU R                   U   -  4$ g)a  Return a user-friendly label and name for a code block.

Parameters
----------
name : str
    The name for the code block returned from get_code_name

Returns
-------
A (label, name) pair that can be used in tracebacks, or None if the default formatting should be used.
ÚCellzIn[%s]N)r"   )r$   Únames     r   Úformat_code_nameÚ CachingCompiler.format_code_namew   s0   € ð ×%Ñ%Ó%Ø˜8 d×&8Ñ&8¸Ñ&>Ñ>Ð>Ð>ð &r   Nc                 óà   • Uc  UnU R                  X1U5      nX R                  U'   [        U5      SUR                  5        Vs/ s H  oUS-   PM	     snU4nU[        R
                  U'   U$ s  snf )aø  Make a name for a block of code, and cache the code.

Parameters
----------
transformed_code : str
    The executable Python source code to cache and compile.
number : int
    A number which forms part of the code's name. Used for the execution
    counter.
raw_code : str
    The raw code before transformation, if None, set to `transformed_code`.

Returns
-------
The name of the cached code (as a string). Pass this as the filename
argument to compilation, so that tracebacks are correctly hooked up.
NÚ
)r:   r"   ÚlenÚ
splitlinesÚ	linecacheÚcache)r$   r9   r   r8   r>   ÚlineÚentrys          r   rF   ÚCachingCompiler.cache†   sƒ   € ð$ ÑØ'ˆHà×!Ñ! (¸fÓEˆð $*×Ñ˜4Ñ ô Ð Ó!ØØ%5×%@Ñ%@Ô%BÓCÒ%B˜T�DŒ[Ñ%BÑCØð	
ˆð !&Œ	�‰˜ÑØˆùò	 Ds   ÁA+c              #   óÀ   #   • U R                   ) U-  nU R                   U-  U l          S v •  U =R                   U) -  sl         g ! U =R                   U) -  sl         f = f7fr   r4   )r$   r)   Úturn_on_bitss      r   Úextra_flagsÚCachingCompiler.extra_flags´   sS   é € ð Ÿ
™
�{ UÑ*ˆð —Z‘Z %Ñ'ˆŒ
ð	(Ûð �JŠJ˜<˜-Ñ'ŽJøˆD�JŠJ˜<˜-Ñ'ŽJüs   ‚%A¨A ¬AÁAÁA)r"   r)   )z	<unknown>Úexec)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   r-   r1   Úpropertyr5   r:   Ústrr?   rF   r   rL   Ú__static_attributes__© r   r   r   r   E   sV   † ñò ôPò3ð ñó ðò
3ð&?¨ô ?ô,ð\ ñ(ó ó(r   r   )r   )rS   r   Úastr   r   Ú	functoolsr   rE   ÚoperatorÚtimeÚ
contextlibr   ÚreduceÚor_Úall_feature_namesÚ	PyCF_MASKrU   r   r    r   rW   r   r   Ú<module>ra      su   ðñ
ó: Ý Û Û Û Û Û Û Ý %ð ×Ò˜XŸ\™\ñIØ+5×+GÒ+GóIóJ€	ñ	F õ 	Fô{(�f—n‘nõ {(r   