ó
    Ñ]jØ~  ã                   óˆ  • S r SSKrSSKJrJr  SSKrSSKrSSKrSSKJ	r	J
r
JrJr  SSKrSSKJr  SSKJr  \R$                  " S5      rS rS	 r " S
 S5      r\" \R$                  " S5      \R$                  " S5      SS9r\" \R$                  " S\R0                  5      5      rS rS\\   4S jrS\4S jrS\
\\4   S\4S jr " S S5      r " S S\5      r  " S S\5      r!Sr"S r#S!r$S"r%S#r&S$r'S%r(S&r)S'r*1 S(kr+S S"1r,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3\"S0Rh                  \#S1Rh                  \$\.\%\/\&\0\(\1\)\2\*\30r5 " S2 S3\5      r6\R$                  " S4\R0                  5      r7 " S5 S6\5      r8S7\	\9   4S8 jr:S9\	\Rv                     4S: jr<S;r= " S< S=5      r>S> r? " S? S@\5      r@ " SA SB\5      rA\R„                  rC\A" \CSC9rDg)DaG  Input transformer machinery to support IPython special syntax.

This includes the machinery to recognise and transform ``%magic`` commands,
``!system`` commands, ``help?`` querying, prompt stripping, and so forth.

Added: IPython 7.0. Replaces inputsplitter and inputtransformer which were
deprecated in 7.0 and removed in 9.0
é    N)ÚCommandCompilerÚCompile)ÚListÚTupleÚOptionalÚAny)Údedent)Ú	tokenutilz^[ \t]+c                 óˆ   • U (       d  U $ [        U 5       H)  u  pU(       d  M  UR                  5       (       a  M%  XS s  $    U $ )zmRemove leading empty lines

If the leading lines are empty or contain only whitespace, they will be
removed.
N)Ú	enumerateÚisspace)ÚlinesÚiÚlines      Ú[/home/mande/repo/quber/.venv/lib/python3.13/site-packages/IPython/core/inputtransformer2.pyÚleading_empty_linesr      s=   € ö ØˆÜ˜UÖ#‰ˆßˆ4˜Ÿ™Ÿ›Ø˜�9Òñ $ð €Ló    c                 ób   • U (       d  U $ [        SR                  U 5      5      R                  SS9$ )z\Remove leading indentation.

Removes the minimum common leading indentation from all lines.
Ú T©Úkeepends)r	   ÚjoinÚ
splitlines)r   s    r   Úleading_indentr   '   s-   € ö
 ØˆÜ�"—'‘'˜%“.Ó!×,Ñ,°dÐ,Ð;Ð;r   c                   óT   • \ rS rSrSrSSS.S jjrS\\   S\\   4S	 jr	S
 r
S rSrg)ÚPromptStripperé0   aý  Remove matching input prompts from a block of input.

Parameters
----------
prompt_re : regular expression
    A regular expression matching any input prompt (including continuation,
    e.g. ``...``)
initial_re : regular expression, optional
    A regular expression matching only the initial prompt, but not continuation.
    If no initial expression is given, prompt_re will be used everywhere.
    Used mainly for plain Python prompts (``>>>``), where the continuation prompt
    ``...`` is a valid Python expression in Python 3, so shouldn't be stripped.

Notes
-----

If initial_re and prompt_re differ,
only initial_re will be tested against the first line.
If any prompt is found on the first two lines,
prompts will be stripped from the rest of the block.
NF)Údoctestc                ó$  • Xl         U=(       d    UU l        X0l        U(       am  [        R                  " S5      U l        [        R                  " S5      U l        [        R                  " S5      U l        [        R                  " S5      U l        g g )Nz^\s*>>>z
^\s*>>>\s?z^\s*\.\.\.\s?z(?<!\\)(\"\"\"|'''))	Ú	prompt_reÚ
initial_rer   ÚreÚcompileÚ_doctest_initial_reÚ_doctest_ps1_reÚ_doctest_ps2_reÚ_triple_quote_re)Úselfr    r!   r   s       r   Ú__init__ÚPromptStripper.__init__F   sj   € Ø"ŒØ$×1¨	ˆŒØŒÞô
 (*§z¢z°*Ó'=ˆDÔ$Ü#%§:¢:¨mÓ#<ˆDÔ Ü#%§:¢:Ð.>Ó#?ˆDÔ ô
 %'§J¢JÐ/EÓ$FˆDÕ!ð r   r   Úreturnc                 óÖ   • / nSnU H^  nUR                  USL5        U R                  R                  U5       H)  nUR                  S5      nUc	  UnSUS'   M   X6:X  d  M'  SnM+     M`     U$ )z¶
Return a boolean mask: True if the corresponding line is considered
inside a triple-quoted string literal.

This is intentionally heuristic (fast + good enough for paste handling).
Né   Téÿÿÿÿ)Úappendr'   ÚfinditerÚgroup)r(   r   ÚmaskÚ	in_tripler   ÚmÚqs          r   Ú_triple_quote_maskÚ!PromptStripper._triple_quote_maskY   sv   € ð ˆØ $ˆ	ÛˆDØ�K‰K˜	¨Ð-Ô.à×*Ñ*×3Ñ3°DÖ9�Ø—G‘G˜A“J�ØÑ$Ø !�IØ#�D˜“HØ•^Ø $’Ió :ñ ð ˆr   c           	      ób   • U Vs/ s H  o R                   R                  SUSS9PM     sn$ s  snf )Nr   r-   ©Úcount)r    Úsub)r(   r   Úls      r   Ú_stripÚPromptStripper._stripp   s.   € Ù<AÓBºE°q—‘×"Ñ" 2 q°Ð"Ó2¹EÑBÐBùÒBs   …$,c                 óÐ  ^ • U(       d  U$ T R                   (       Gaã  T R                  U5      n[        U 4S j[        X5       5       5      nU(       d  U$ / n/ n[        X5       HÎ  u  pgU(       a$  UR	                  U5        UR	                  S5        M0  T R
                  R                  U5      (       a  T R
                  R                  SUSS9nO>T R                  R                  U5      (       a  T R                  R                  SUSS9nOUnUR	                  U5        UR	                  X†:g  5        MÐ     / n	Sn
U
[        U5      :  aµ  U
nX*   nU[        U5      :  a&  X+   U:X  a  US-  nU[        U5      :  a
  X+   U:X  a  M  XJU n[        XZU 5      nU(       d>  U(       a7  U	R                  [        SR                  U5      5      R                  SS95        OU	R                  U5        Un
U
[        U5      :  a  Mµ  U	$ T R                  R                  US   5      (       d2  [        U5      S:”  a4  T R                  R                  US   5      (       a  T R!                  U5      $ U$ )	Nc              3   óz   >#   • U  H0  u  pU(       + =(       a    TR                   R                  U5      v •  M2     g 7f©N)r$   Úmatch)Ú.0r<   r3   r(   s      €r   Ú	<genexpr>Ú*PromptStripper.__call__.<locals>.<genexpr>{   s5   øé € ð &â$;‘L�Að ”×E D×$<Ñ$<×$BÑ$BÀ1Ó$EÔEÚ$;ùs   ƒ8;Fr   r-   r9   r   Tr   )r   r6   ÚanyÚzipr/   r%   rB   r;   r&   ÚlenÚextendr	   r   r   r!   r    r=   )r(   r   Útriple_maskÚhas_doctest_outsideÚ	out_linesÚstripped_maskr<   r3   Únew_lÚdedentedr   ÚjÚsegmentÚseg_strippeds   `             r   Ú__call__ÚPromptStripper.__call__s   s,  ø€ ÞØˆLà�<�<ˆ<Ø×1Ñ1°%Ó8ˆKô #&ô &ä$'¨Ô$;ó&ó #Ðö 'Ø�à#%ˆIØ(*ˆMä # EÖ 7‘�ÞØ×$Ñ$ QÔ'Ø!×(Ñ(¨Ô/Ùà×'Ñ'×-Ñ-¨a×0Ñ0Ø ×0Ñ0×4Ñ4°R¸À!Ð4ÐD‘EØ×)Ñ)×/Ñ/°×2Ñ2Ø ×0Ñ0×4Ñ4°R¸À!Ð4ÐD‘Eà�EØ× Ñ  Ô'Ø×$Ñ$ U¡ZÖ0ñ !8ð  #%ˆHØˆAØ”c˜)“nÓ$Ø�Ø'™N�	Øœ#˜i›.Ó(¨[©^¸yÓ-HØ˜‘F�Að œ#˜i›.Ó(¨[©^¸yÕ-Hð $ a˜.�Ü" =°1Ð#5Ó6�æ!¦|Ø—O‘O¤F¨2¯7©7°7Ó+;Ó$<×$GÑ$GÐQUÐ$GÐ$VÕWà—O‘O GÔ,à�ð ”c˜)“nÕ$ð  ˆOà�?‰?× Ñ   q¡×*Ñ*Ü�U“˜a“ D§N¡N×$8Ñ$8¸¸q¹×$BÑ$BØ—;‘;˜uÓ%Ð%Øˆr   )r$   r%   r&   r'   r   r!   r    rA   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r)   r   ÚstrÚboolr6   r=   rS   Ú__static_attributes__© r   r   r   r   0   s;   † ñð*G¸eö Gð&¨¨S©	ð °d¸4±jô ò.Cõ9r   r   z^(>>>|\.\.\.)( |$)z	^>>>( |$)T)r    r!   r   a  
        ^(                         # Match from the beginning of a line, either:

                                   # 1. First-line prompt:
        ((\[nav\]|\[ins\])?\ )?    # Vi editing mode prompt, if it's there
        In\                        # The 'In' of the prompt, with a space
        \[\d+\]:                   # Command index, as displayed in the prompt
        \                          # With a mandatory trailing space

        |                          # ... or ...

                                   # 2. The three dots of the multiline prompt
        \s*                        # All leading whitespace characters
        \.{3,}:                    # The three (or more) dots
        \ ?                        # With an optional trailing space

        )
        c                 ó   • U (       a  U S   R                  S5      (       d  U $ [        R                  " SU S   5      (       a  U $ U S   SS  R                  5       R	                  S5      u  pnSR                  U SS  5      nSU< S	U< S	U< S
3/$ )Nr   ú%%z%%\w+\?é   Ú r   r-   zget_ipython().run_cell_magic(ú, z)
)Ú
startswithr"   rB   ÚrstripÚ	partitionr   )r   Ú
magic_nameÚ_Ú
first_lineÚbodys        r   Ú
cell_magicrj   Í   sŠ   € Þ˜˜a™×+Ñ+¨D×1Ñ1ØˆÜ	‡x‚x�
˜E !™H×%Ñ%àˆØ % a¡¨¨ × 3Ñ 3Ó 5× ?Ñ ?ÀÓ DÑ€J�:Ø�7‰7�5˜˜�9Ó�Dã›:£tð-ð .ð .r   r+   c                 ó¬   • Sn[        U 5       HC  u  p#UR                  nUS:X  a
  US:X  a  Us  $ US;   a  US-  nM.  US;   d  M6  US:”  d  M>  US-  nME     g)z–Get the index of the first assignment in the line ('=' not inside brackets)

Note: We don't try to support multiple special assignment (a = b = %foo)
r   Ú=¾   Ú(Ú[Ú{r-   ¾   Ú)Ú]Ú}N)r   Ústring)Ú
token_lineÚparen_levelr   ÚtiÚss        r   Ú_find_assign_oprz   Ù   sf   € ð
 €KÜ˜:Ö&‰ˆØ�I‰IˆØ�‹8˜ qÓ(ØŠHØ�ÓØ˜1ÑŠKØ�/Õ!Ø˜Q�Ø˜qÑ ’ñ 'ð r   Ú
start_linec                 óœ   • UnX   R                  S5      (       a1  US-  nU[        U 5      :¼  a   U$ X   R                  S5      (       a  M1  U$ )zbFind the last line of a line explicitly extended using backslashes.

Uses 0-indexed line numbers.
z\
r-   )ÚendswithrH   )r   r{   Úend_lines      r   Úfind_end_of_continued_liner   ê   sU   € ð
 €HØ
‰/×
"Ñ
" 6×
*Ñ
*Ø�A‰ˆØ”s˜5“zÓ!ØØ€Oð	 ‰/×
"Ñ
" 6×
*Ó
*ð €Or   Ústartr~   c                 óØ   • XS      US   S /XS   S-   US-    -   nSR                  USS  Vs/ s H  oDR                  5       SS PM     snUS   R                  5       /-   5      $ s  snf )aÝ  Assemble a single line from multiple continued line pieces

Continued lines are lines ending in ``\``, and the line following the last
``\`` in the block.

For example, this code continues over multiple lines::

    if (assign_ix is not None) \
         and (len(line) >= assign_ix + 2) \
         and (line[assign_ix+1].string == '%') \
         and (line[assign_ix+2].type == tokenize.NAME):

This statement contains four continued line pieces.
Assembling these pieces into a single line would give::

    if (assign_ix is not None) and (len(line) >= assign_ix + 2) and (line[...

This uses 0-indexed line numbers. *start* is (lineno, colno).

Used to allow ``%magic`` and ``!system`` commands to be continued over
multiple lines.
r   r-   Nra   r.   )r   rd   )r   r€   r~   ÚpartsÚps        r   Úassemble_continued_liner„   ö   s€   € ð. ˜‘8‰_˜U 1™X˜YÐ'Ð(¨5°q±¸!±¸HÀQ¹JÐ+GÑG€EØ�8‰8¨e°C°R©jÓ9ªj¨—X‘X“Z  “_©jÑ9Ø˜R‘y×'Ñ'Ó)Ð*ñ+ó ,ð ,ùÒ9s   ¯A'c                   óL   • \ rS rSrSrSrS rS r\S 5       r	S\
\   4S jrS	rg
)ÚTokenTransformBasei  a–  Base class for transformations which examine tokens.

Special syntax should not be transformed when it occurs inside strings or
comments. This is hard to reliably avoid with regexes. The solution is to
tokenise the code as Python, and recognise the special syntax in the tokens.

IPython's special syntax is not valid Python syntax, so tokenising may go
wrong after the special syntax starts. These classes therefore find and
transform *one* instance of special syntax at a time into regular Python
syntax. After each transformation, tokens are regenerated to find the next
piece of special syntax.

Subclasses need to implement one class method (find)
and one regular method (transform).

The priority attribute can select which transformation to apply if multiple
transformers match in the same place. Lower numbers have higher priority.
This allows "%magic?" to be turned into a help call rather than a magic call.
é
   c                 óH   • U R                   U R                  U R                  4$ rA   )r{   Ú	start_colÚpriority©r(   s    r   ÚsortbyÚTokenTransformBase.sortby(  s   € Ø�‰ §¡°·±Ð=Ð=r   c                 ó2   • US   S-
  U l         US   U l        g ©Nr   r-   )r{   r‰   )r(   r€   s     r   r)   ÚTokenTransformBase.__init__+  s   € Ø ™( Q™,ˆŒØ˜q™ˆ�r   c                 ó   • [         e)al  Find one instance of special syntax in the provided tokens.

Tokens are grouped into logical lines for convenience,
so it is easy to e.g. look at the first token of each line.
*tokens_by_line* is a list of lists of tokenize.TokenInfo objects.

This should return an instance of its class, pointing to the start
position it has found, or None if it found no match.
©ÚNotImplementedError©ÚclsÚtokens_by_lines     r   ÚfindÚTokenTransformBase.find/  s
   € ô "Ð!r   r   c                 ó   • [         e)z Transform one instance of special syntax found by ``find()``

Takes a list of strings representing physical lines,
returns a similar list of transformed lines.
r’   )r(   r   s     r   Ú	transformÚTokenTransformBase.transform<  s
   € ô "Ð!r   )r‰   r{   N)rU   rV   rW   rX   rY   rŠ   rŒ   r)   Úclassmethodr—   r   rZ   rš   r\   r]   r   r   r†   r†     s<   † ñð( €Hò>ò"ð ñ
"ó ð
"ð"˜t C™y÷ "r   r†   c                   ó<   • \ rS rSrSr\S 5       rS\\   4S jr	Sr
g)ÚMagicAssigniD  z2Transformer for assignments from magics (a = %foo)c                 ó  • U Hz  n[        U5      nUc  M  [        U5      US-   :¼  d  M'  X#S-      R                  S:X  d  M>  X#S-      R                  [        R
                  :X  d  Mc  U " X#S-      R                  5      s  $    g)z@Find the first magic assignment (a = %foo) in the cell.
        Nr`   r-   Ú%)rz   rH   ru   ÚtypeÚtokenizeÚNAMEr€   ©r•   r–   r   Ú	assign_ixs       r   r—   ÚMagicAssign.findF  st   € ó #ˆDÜ'¨Ó-ˆIØÓ%Ü˜T› i°!¡mÕ3Ø¨™kÑ*×1Ñ1°SÕ8Ø¨™kÑ*×/Ñ/´8·=±=Õ@Ù˜4¨!¡Ñ,×2Ñ2Ó3Ò3ò #r   r   c                 ó0  • U R                   U R                  p2X   SU n[        X5      n[        XU4U5      nUR	                  S5      (       d   U5       eUSS R                  S5      u  pxn	USU n
SR                  Xy5      nXK-   S-   nXS-   S nX¬/-   U-   $ )zJTransform a magic assignment found by the ``find()`` classmethod.
        Nr    r-   ra   z(get_ipython().run_line_magic({!r}, {!r})Ú
)r{   r‰   r   r„   rc   re   Úformat)r(   r   r{   r‰   Úlhsr~   Úrhsrf   rg   ÚargsÚlines_beforeÚcallÚnew_lineÚlines_afters                 r   rš   ÚMagicAssign.transformR  s¸   € ð !%§¡°·±�IØÑ 
 Ð+ˆÜ-¨eÓ@ˆÜ% e¸)Ð-DÀhÓOˆØ�~‰~˜c×"Ñ"Ð' CÓ'Ð"Ø! ! "˜g×/Ñ/°Ó4Ñˆ
�tà˜[˜jÐ)ˆØ9×@Ñ@ÀÓRˆØ‘: Ñ$ˆØ Q™J˜KÐ(ˆà˜jÑ(¨;Ñ6Ð6r   r]   N)rU   rV   rW   rX   rY   rœ   r—   r   rZ   rš   r\   r]   r   r   rž   rž   D  s'   † Ù<Øñ	4ó ð	4ð7˜t C™y÷ 7r   rž   c                   ó\   • \ rS rSrSr\S 5       r\S 5       r\S 5       rS\	\
   4S jrSrg	)
ÚSystemAssignid  z;Transformer for assignments from system commands (a = !foo)c                 óŠ  • U GH<  n[        U5      nUc  M  X#   R                  R                  5       R                  S5      (       a  MF  [	        U5      US-   :¼  d  MZ  X#S-      R
                  [        R                  :X  d  M  US-   nU[	        U5      :  d  M•  X$   R
                  [        R                  :X  d  M·  X$   R                  S:X  a  U " X$   R                  5      s  $ X$   R                  R                  5       (       d  GM  US-  nU[	        U5      :  d  GM  X$   R
                  [        R                  :X  a  M…  GM?     g ©Nrl   r`   r-   Ú!)rz   r   Ústriprc   rH   r¡   r¢   Ú
ERRORTOKENru   r€   r   )r•   r–   r   r¥   Úixs        r   Úfind_pre_312ÚSystemAssign.find_pre_312f  só   € ä"ˆDÜ'¨Ó-ˆIØÓ%Ø ™O×0Ñ0×6Ñ6Ó8×CÑCÀC×HÓHÜ˜T› i°!¡mÕ3Ø¨!™mÑ,×1Ñ1´X×5HÑ5HÕHØ ‘]�àœ3˜t›9•n¨©¯©¼(×:MÑ:MÕ)MØ‘x—‘¨#Ó-Ù" 4¡8§>¡>Ó2Ò2Ø!™XŸ_™_×4Ñ4×6Ñ6ÚØ˜!‘G�Bð œ3˜t›9–n¨©¯©¼(×:MÑ:M×)MÐ)Mò #r   c                 óh  • U H¬  n[        U5      nUc  M  X#   R                  R                  5       R                  S5      (       a  ME  [	        U5      US-   :¼  d  MY  X#S-      R
                  [        R                  :X  d  M~  X#S-      R                  S:X  d  M•  U " X#S-      R                  5      s  $    g rµ   )
rz   r   r·   rc   rH   r¡   r¢   ÚOPru   r€   r¤   s       r   Úfind_post_312ÚSystemAssign.find_post_312w  s”   € ã"ˆDÜ'¨Ó-ˆIàÓ&Ø™×,Ñ,×2Ñ2Ó4×?Ñ?À×DÓDÜ˜“Y )¨a¡-Õ/Ø a™-Ñ(×-Ñ-´·±Õ<Ø a™-Ñ(×/Ñ/°3Õ6á˜4¨A¡Ñ.×4Ñ4Ó5Ò5ò #r   c                 ón   • [         R                  S:  a  U R                  U5      $ U R                  U5      $ )z8Find the first system assignment (a = !foo) in the cell.)é   é   )ÚsysÚversion_inforº   r¾   r”   s     r   r—   ÚSystemAssign.find„  s4   € ô ×Ñ˜gÓ%Ø×#Ñ# NÓ3Ð3Ø× Ñ  Ó0Ð0r   r   c                 ó  • U R                   U R                  p2X   SU n[        X5      n[        XU4U5      nUR	                  S5      (       d   U5       eUSS nUSU nSR                  U5      n	XI-   S-   n
XS-   S nXŠ/-   U-   $ )zKTransform a system assignment found by the ``find()`` classmethod.
        Nr¶   r-   úget_ipython().getoutput({!r})r¨   )r{   r‰   r   r„   rc   r©   )r(   r   r{   r‰   rª   r~   r«   Úcmdr­   r®   r¯   r°   s               r   rš   ÚSystemAssign.transform‹  s¨   € ð !%§¡°·±�IàÑ 
 Ð+ˆÜ-¨eÓ@ˆÜ% e¸)Ð-DÀhÓOˆØ�~‰~˜c×"Ñ"Ð' CÓ'Ð"Ø�!�"ˆgˆà˜[˜jÐ)ˆØ.×5Ñ5°cÓ:ˆØ‘: Ñ$ˆØ q™L˜MÐ*ˆà˜jÑ(¨;Ñ6Ð6r   r]   N)rU   rV   rW   rX   rY   rœ   rº   r¾   r—   r   rZ   rš   r\   r]   r   r   r³   r³   d  sO   † ÙEØñó ðð  ñ
6ó ð
6ð ñ1ó ð1ð7˜t C™y÷ 7r   r³   r¶   z!!Ú?ú??r    r_   Ú,Ú;Ú/>   r¶   r    rÌ   rÎ   rÍ   rÊ   c                 ó²   • US:X  a  SO	SU ;   a  SOSnSR                  X /5      nUR                  S5      u  pEnUR                  [        5      nSU< SU< S	3$ )
zQPrepares a pinfo(2)/psearch call from a target name and the escape
(i.e. ? or ??)rË   Úpinfo2Ú*ÚpsearchÚpinfora   úget_ipython().run_line_magic(rb   rr   )r   re   ÚlstripÚ	ESC_MAGIC)ÚtargetÚescÚmethodÚargÚt_magic_namerg   Út_magic_arg_ss          r   Ú_make_help_callrÝ   °  s_   € ð  ›+‰hØ"%¨£-‘YØð ð �(‰(�FÐ#Ó
$€Cà%(§]¡]°3Ó%7Ñ"€L�]Ø×&Ñ&¤yÓ1�LÛ5AÃ=ÐQÐQr   c                 ó*   • U (       d  g[        U S5      $ )zjTranslate lines escaped with: ?

A naked help line should fire the intro help screen (shell.show_usage())
úget_ipython().show_usage()rÊ   ©rÝ   ©Úcontents    r   Ú_tr_helprã   ½  s   € ö
 Ø+ä˜7 CÓ(Ð(r   c                 ó*   • U (       d  g[        U S5      $ )zkTranslate lines escaped with: ??

A naked help line should fire the intro help screen (shell.show_usage())
rß   rË   rà   rá   s    r   Ú	_tr_help2rå   Ç  s   € ö
 Ø+ä˜7 DÓ)Ð)r   c                 ó@   • U R                  S5      u  pnSU< SU< S3$ )z.Translate lines escaped with a percent sign: %ra   rÔ   rb   rr   ©re   ©râ   Únamerg   r¬   s       r   Ú	_tr_magicrê   Ñ  s!   € à×%Ñ% cÓ*�M€D‰TÛ59»4Ð@Ð@r   c                 óx   • U R                  S5      u  pnU< SSR                  UR                  5       5      < S3$ )z'Translate lines escaped with a comma: ,ra   ú("z", "ú"))re   r   Úsplitrè   s       r   Ú	_tr_quoterï   Ö  s0   € à×%Ñ% cÓ*�M€DˆTÛ˜vŸ{™{¨4¯:©:«<Ö8Ð:Ð:r   c                 ó>   • U R                  S5      u  pnU< SU< S3$ )z+Translate lines escaped with a semicolon: ;ra   rì   rí   rç   rè   s       r   Ú
_tr_quote2rñ   Û  s!   € à×%Ñ% cÓ*�M€DˆTÛ›tÐ$Ð$r   c                 óª   • U R                  S5      u  pnUS:X  a  [        S[         S35      eU< SSR                  UR	                  5       5      < S3$ )z'Translate lines escaped with a slash: /ra   r   Ú"z%" must be followed by a callable namern   rb   rr   )re   ÚSyntaxErrorÚ	ESC_SHELLr   rî   rè   s       r   Ú	_tr_parenrö   à  sL   € à×%Ñ% cÓ*�M€DˆTØˆrƒzÜ˜Aœi˜[Ð(MÐNÓOÐOã˜TŸY™Y t§z¡z£|Ö4Ð5Ð5r   zget_ipython().system({!r})rÇ   c                   ó.   • \ rS rSrSr\S 5       rS rSrg)ÚEscapedCommandiñ  z9Transformer for escaped commands like %foo, !foo, or /fooc                 óŠ  • U H½  nU(       d  M  Sn[        U5      nXC:”  al  X#   R                  [        R                  [        R                  1;   a<  US-  nXC:”  a2  X#   R                  [        R                  [        R                  1;   a  M<  X4:¼  a  M‘  X#   R
                  [        ;   d  M©  U " X#   R                  5      s  $    g)zGFind the first escaped command (%foo, !foo, etc.) in the cell.
        r   r-   N)rH   r¡   r¢   ÚINDENTÚDEDENTru   ÚESCAPE_SINGLESr€   )r•   r–   r   r¹   Úlls        r   r—   ÚEscapedCommand.findó  s’   € ó #ˆDÞÙØˆBÜ�T“ˆBØ“'˜d™hŸm™m´·±ÄÇÁÐ/QÓQØ�a‘�ð “'˜d™hŸm™m´·±ÄÇÁÐ/QÕQà‹xÙØ‰x�‰¤.Õ0Ù˜4™8Ÿ>™>Ó*Ò*ò #r   c                 ó<  • U R                   U R                  p2X   SU n[        X5      n[        XU4U5      n[	        U5      S:”  a  USS [
        ;   a
  USS USS p‡O	USS USS p‡U[        ;   a  [        U   " U5      n	OSn	USU n
XI-   S-   nXS-   S nX«/-   U-   $ )zGTransform an escaped line found by the ``find()`` classmethod.
        Nr-   r`   r   r¨   )r{   r‰   r   r„   rH   ÚESCAPE_DOUBLESÚtr)r(   r   r{   r‰   Úindentr~   r   Úescaperâ   r®   r­   r¯   r°   s                r   rš   ÚEscapedCommand.transform  sË   € ð !%§¡°·±�IàÑ" : IÐ.ˆÜ-¨eÓ@ˆÜ& u¸9Ð.EÀxÓPˆäˆt‹9�q‹=˜T " 1˜X¬Ó7Ø" 2 A˜h¨¨Q¨R¨‘Gà" 2 A˜h¨¨Q¨R¨�Gà”R‹<Ü�f’:˜gÓ&‰DàˆDà˜[˜jÐ)ˆØ‘= 4Ñ'ˆØ q™L˜MÐ*ˆà˜jÑ(¨;Ñ6Ð6r   r]   N)	rU   rV   rW   rX   rY   rœ   r—   rš   r\   r]   r   r   rø   rø   ñ  s   † ÙCØñ+ó ð+õ7r   rø   zÂ(%{0,2}
    (?!\d)[\w*]+            # Variable name
    (\.(?!\d)[\w*]+|\[-?[0-9]+\])*       # .etc.etc or [0], we only support literal integers.
    )
    (\?\??)$                # ? or ??
    c                   óF   ^ • \ rS rSrSrSrU 4S jr\S 5       rS r	Sr
U =r$ )ÚHelpEndi(  z+Transformer for help syntax: obj? and obj??é   c                 óR   >• [         TU ]  U5        US   S-
  U l        US   U l        g r�   )Úsuperr)   Úq_lineÚq_col)r(   r€   Úq_locnÚ	__class__s      €r   r)   ÚHelpEnd.__init__.  s*   ø€ Ü‰Ñ˜ÔØ˜Q‘i !‘mˆŒØ˜A‘Yˆ�
r   c                 óx  • U H´  n[        U5      S:”  d  M  US   R                  S:X  d  M)  SnX#   R                  [        R                  [        R
                  1;   a7  US-  nX#   R                  [        R                  [        R
                  1;   a  M7  U " X#   R                  US   R                  5      s  $    g)z8Find the first help command (foo?) in the cell.
        r`   éþÿÿÿrÊ   r   r-   N)rH   ru   r¡   r¢   rú   rû   r€   )r•   r–   r   r¹   s       r   r—   ÚHelpEnd.find3  s‰   € ó #ˆDä�4‹y˜1�}  b¡§¡°CÕ!7à�Ø‘h—m‘m¬¯©¼¿¹Ð'IÓIØ˜!‘G�Bð ‘h—m‘m¬¯©¼¿¹Ð'IÕIá˜4™8Ÿ>™>¨4°©8¯>©>Ó:Ò:ò #r   c                 ó¨  • SR                  XR                  U R                  S-    5      nUSU R                   X R                  S pCUSU R                   nXR                  S-   S n[        R                  U5      nU(       d  [        U5      eUc   U5       eUR                  S5      nUR                  S5      n	[        X‰5      n
X:-   S-   nX[/-   U-   $ )zFTransform a help command found by the ``find()`` classmethod.
        r   r-   NrÁ   r¨   )	r   r{   r
  r‰   Ú_help_end_reÚsearchrô   r1   rÝ   )r(   r   Úpiecer  râ   r­   r°   r4   r×   rØ   r®   r¯   s               r   rš   ÚHelpEnd.transform@  sÓ   € ð —‘˜Ÿo™o°·±¸a±Ð@ÓAˆØÐ 0 $§.¡.Ð1°5¿¹Ð9IÐ3J�ØÐ.˜tŸ™Ð/ˆØŸK™K¨!™OÐ-Ð.ˆä×Ñ Ó(ˆÞÜ˜gÓ&Ð&Ø‰}Ð%˜gÓ%ˆ}Ø—‘˜“ˆØ�g‰g�a‹jˆô ˜vÓ+ˆØ‘= 4Ñ'ˆà˜jÑ(¨;Ñ6Ð6r   )r  r
  )rU   rV   rW   rX   rY   rŠ   r)   rœ   r—   rš   r\   Ú__classcell__©r  s   @r   r  r  (  s0   ø† Ù5ð €Hõð
 ñ
;ó ð
;÷7ð 7r   r  r   c                 ó˜  • [         R                  [         R                  p!/ /n[        U 5      S:”  a.  U S   R	                  S5      (       d  [
        R                  " SSS9  Sn [        R                  " [        U 5      R                  S/S9 H†  nUS	   R                  U5        UR                  U:X  d  UR                  U:X  a  US::  a  UR                  / 5        MP  UR                  S
;   a  US-  nMg  UR                  S;   d  My  US:”  d  M�  US-  nMˆ     US	   (       d  UR                  5         U$ ! [         R                   a     N2f = f)aO  Tokenize a series of lines and group tokens by line.

The tokens for a multiline Python string or expression are grouped as one
line. All lines except the last lines should keep their line ending ('\n',
'\r\n') for this to properly work. Use `.splitlines(keeplineending=True)`
for example when passing block of text to this function.

r-   r   )r¨   Úz
ÚÚz–`make_tokens_by_line` received a list of lines which do not have lineending markers ('\n', '\r', '\r\n', '\x0b', '\x0c'), behavior will be unspecifiedr`   )Ú
stacklevelzexpected EOF)Úextra_errors_to_catchr.   rm   rq   )r¢   ÚNEWLINEÚNLrH   r}   ÚwarningsÚwarnr
   Úgenerate_tokens_catch_errorsÚiterÚ__next__r/   r¡   ru   Ú
TokenErrorÚpop)r   r  r   r–   ÚparenlevÚtokens         r   Úmake_tokens_by_liner*  V  s.  € ô ×"Ñ"¤H§K¡KˆRØ') d€NÜ
ˆ5ƒz�Aƒ~˜e A™h×/Ñ/Ð0T×UÑUÜ�Šð kØò	
ð €HðÜ×;Ò;Ü�‹K× Ñ ¸Ð8Hô
ˆEð ˜2Ñ×%Ñ% eÔ,Ø—
‘
˜gÓ%ØŸ™ rÓ)°¸A³Ø×%Ñ% bÖ)Ø—‘ Ó0Ø˜A‘’Ø—‘ Õ0Ø˜a•<Ø ‘M’Hñ
ð" ˜"×Ø×ÑÔð Ðøô ×Ñó áðús   Á#BD2 ÄD2 Ä	D2 Ä2E	ÅE	Útokensc                 ó†   • SnU  H9  nUR                   S;   a  US-  nM  UR                   S;   d  M,  US-  nUS:  d  M9    g   g)zBCheck if the depth of brackets in the list of tokens drops below 0r   rm   r-   rq   TF)ru   )r+  r(  r)  s      r   Úhas_sunken_bracketsr-  †  sJ   € à€HÛˆØ�<‰<˜?Ó*Ø˜‰MŠHØ�\‰\˜_Õ,Ø˜‰MˆHØ˜!�|Ùñ ð r   iô  c                   óJ   • \ rS rSrSrS rS rS rS\S\4S jr	S\4S	 jr
S
rg)ÚTransformerManageri•  zŽApplies various transformations to a cell or code block.

The key methods for external use are ``transform_cell()``
and ``check_complete()``.
c                 óˆ   • [         [        [        [        /U l        [
        /U l        [        [        [        [        /U l        g rA   )r   r   Úclassic_promptÚipython_promptÚcleanup_transformsrj   Úline_transformsrž   r³   rø   r  Útoken_transformersr‹   s    r   r)   ÚTransformerManager.__init__›  s?   € äÜÜÜð	#
ˆÔô ð 
ˆÔô ÜÜÜð	#
ˆÕr   c                 óB  • [        U5      n/ nU R                   H.  nUR                  U5      nU(       d  M  UR                  U5        M0     U(       d  SU4$ [	        U[
        R                  S9nU H  n SUR                  U5      4s  $    SU4$ ! [         a     M,  f = f)aê  Find and run the transform earliest in the code.

Returns (changed, lines).

This method is called repeatedly until changed is False, indicating
that all available transformations are complete.

The tokens following IPython special syntax might not be valid, so
the transformed code is retokenised every time to identify the next
piece of special syntax. Hopefully long code cells are mostly valid
Python, not using lots of IPython special syntax, so this shouldn't be
a performance issue.
F)ÚkeyT)	r*  r5  r—   r/   Úsortedr†   rŒ   rš   rô   )r(   r   r–   Ú
candidatesÚtransformer_clsÚtransformerÚordered_transformerss          r   Údo_one_token_transformÚ)TransformerManager.do_one_token_transform¬  s®   € ô -¨UÓ3ˆØˆ
Ø#×6Ô6ˆOØ)×.Ñ.¨~Ó>ˆKßˆ{Ø×!Ñ! +Ö.ñ  7ö
 à˜%�<ÐÜ% jÔ6H×6OÑ6OÑPÐÛ/ˆKðØ˜[×2Ñ2°5Ó9Ð9Ò9ñ 0ð
 �eˆ|Ðøô ó Úðús   Á5BÂ
BÂBc                 óŽ   • [        [        5       H!  nU R                  U5      u  p1U(       a  M  Us  $    [        S[        -  5      e)NzBInput transformation still changing after %d iterations. Aborting.)ÚrangeÚTRANSFORM_LOOP_LIMITr>  ÚRuntimeError)r(   r   rg   Úchangeds       r   Údo_token_transformsÚ&TransformerManager.do_token_transformsÌ  sM   € ÜÔ+Ö,ˆAØ!×8Ñ8¸Ó?‰NˆGß�7Ø’ñ -ô
 ð 6Ü8LñMó Nð 	Nr   Úcellr+   c                 óê   • UR                  S5      (       d  US-  nUR                  SS9nU R                  U R                  -    H  nU" U5      nM     U R	                  U5      nSR                  U5      $ )zTransforms a cell of input coder¨   Tr   r   )r}   r   r3  r4  rE  r   )r(   rG  r   rš   s       r   Útransform_cellÚ!TransformerManager.transform_cellÕ  sp   € à�}‰}˜T×"Ñ"Ø�D‰LˆDØ—‘¨�Ð.ˆØ×0Ñ0°4×3GÑ3GÔGˆIÙ˜eÓ$ŠEñ Hð ×(Ñ(¨Ó/ˆØ�w‰w�u‹~Ðr   c                 óî	  • Sn[        U5       H$  nUS:X  a  Sn  OUR                  5       (       a    OM&     U(       d  US-  nUR                  SS9nU(       d  g[        U5       HN  nUR                  5       (       d  M  UR                  S5      R                  S5      (       a  S[	        U5      4s  $   O    U R
                   H  n[        USS5      (       a  M  U" U5      nM!     US
   R                  S5      (       a&  US   R                  5       (       a  S[	        U5      4$ g U R                   H  n[        USS5      (       a  M  U" U5      nM!     U R                  U5      n[        U5      n[        U5      S:X  a  U(       a  [        US
   5      (       a  g	U(       d  S[	        U5      4$ US   S   R                  [        R                   :w  a1  US   S   R                  [        R"                  :w  a  S[	        U5      4$ [        R$                  [        R&                  [        R                   1nSn	US    V
s1 s H  oªR                  iM     sn
[        R(                  [        R                   1[        R                   14;   a  [        U5      S:”  a  UR+                  5       n	US   (       aK  US   S   R                  U;   a5  US   R+                  5         US   (       a  US   S   R                  U;   a  M5  US   (       d  S[	        U5      4$ US   S   R,                  S:X  a�  S
nUS   U   R                  [        R.                  [        R(                  1;   a;  US-  nUS   U   R                  [        R.                  [        R(                  1;   a  M;  US   U   R0                  S   nSUS-   4$ US   S
   R2                  R                  S5      (       a  g [4        R6                  " 5          [4        R8                  " S[:        5        [=        SR?                  U5      SS9nSSS5        Wc  S[	        U5      4$  U	(       a6  U	S
   R                  [        R(                  :X  a  U(       a  gS[	        U5      4$ US   R                  5       (       d  gg! [         a     g	f = f! [         a     g	f = fs  sn
f ! , (       d  f       N›= f! [        [@        [B        [D        [F        [:        4 a     g	f = f)a¬  Return whether a block of code is ready to execute, or should be continued

Parameters
----------
cell : string
    Python input code, which can be multiline.

Returns
-------
status : str
    One of 'complete', 'incomplete', or 'invalid' if source is not a
    prefix of valid code.
indent_spaces : int or None
    The number of spaces by which to indent the next line of code. If
    status is not 'incomplete', this is None.
Fr¨   Tr   )ÚcompleteNÚ\Ú
incompleteÚhas_side_effects)ÚinvalidNr   r_   r.   r-   NÚ:é   )rN  NÚerrorr   Úexec)Úsymbol)$Úreversedr·   r   r}   Úfind_last_indentr3  Úgetattrrô   rc   r4  rE  r*  rH   r-  r¡   r¢   Ú	ENDMARKERr¸   r  ÚCOMMENTrû   r'  ru   rú   r€   r   r!  Úcatch_warningsÚsimplefilterÚSyntaxWarningÚcompile_commandr   ÚOverflowErrorÚ
ValueErrorÚ	TypeErrorÚMemoryError)r(   rG  Úends_with_newlineÚ	characterr   r   rš   r–   Únewline_typesÚlast_token_lineÚtr¹   r  Úress                 r   Úcheck_completeÚ!TransformerManager.check_completeà  s˜  € ð$ "ÐÜ! $žˆIØ˜DÓ Ø$(Ð!ÙØ—‘×"Ñ"Ùáñ (ö !ð �D‰LˆDà—‘¨�Ð.ˆæØ#ä˜U–OˆDØ—:‘:—<‘<ÙØ—‘˜DÓ!×*Ñ*¨4×0Ñ0Ø#Ô%5°eÓ%<Ð<Ò<áñ $ð	#Ø!×4Ô4�	Ü˜yÐ*<¸e×DÓDÙ% eÓ,’Eñ 5ð �‰8×Ñ˜t×$Ñ$à�R‰y�‰× Ñ Ø#Ô%5°eÓ%<Ð<Ð<à'ð	#Ø!×1Ô1�	Ü˜yÐ*<¸e×DÓDÙ% eÓ,’Eñ 2ð ×,Ñ,¨UÓ3ˆEô -¨UÓ3ˆô
 �‹J˜!‹OÞÜ# N°1Ñ$5×6Ñ6à"æØÔ!1°%Ó!8Ð8Ð8ð ˜2Ñ˜rÑ"×'Ñ'¬8×+=Ñ+=Ó=Ø˜rÑ" 2Ñ&×+Ñ+¬x×/BÑ/BÓBð  Ô!1°%Ó!8Ð8Ð8ä!×)Ñ)¬8×+;Ñ+;¼X×=OÑ=OÐPˆð ˆØ*¨2Ò.Ó/Ò.�q�FŒFÑ.Ñ/Ü�_‰_œh×0Ñ0Ð1Ü×ÑÐ ð4
ó 
ô �.Ó! AÓ%Ø,×0Ñ0Ó2ˆOà˜R×  ^°BÑ%7¸Ñ%;×%@Ñ%@ÀMÓ%QØ˜2Ñ×"Ñ"Ô$ð ˜R×  ^°BÑ%7¸Ñ%;×%@Ñ%@ÀMÕ%Qð ˜b×!ØÔ!1°%Ó!8Ð8Ð8à˜"Ñ˜bÑ!×(Ñ(¨CÓ/àˆBØ  Ñ$ RÑ(×-Ñ-´(·/±/Ä8Ç?Á?Ð1SÓSØ�a‘�ð ! Ñ$ RÑ(×-Ñ-´(·/±/Ä8Ç?Á?Ð1SÕSð $ BÑ'¨Ñ+×1Ñ1°!Ñ4ˆFØ ¨!¡Ð+Ð+à˜"Ñ˜aÑ ×%Ñ%×.Ñ.¨t×4Ñ4Ø%ð		=Ü×(Ò(Õ*Ü×%Ò% g¬}Ô=Ü% b§g¡g¨e£n¸VÑD�÷ +ð ‰{Ø#Ô%5°eÓ%<Ð<Ð<ð ö ˜¨qÑ1×6Ñ6¼(¿/¹/ÓIÞ Ø'ØÔ!1°%Ó!8Ð8Ð8ð �R‰y�‰× Ñ Ø#àøôs ó 	#Ù"ð	#ûô ó 	#Ù"ð	#üò8 0÷6 +Õ*ûô œ]¬J¼	Üœ]ð,ó 	#á"ð	#ús`   Â7R ÃR Ä&R' Å	R' È<R7ÏS Ï25R<Ð'S Ò
R$Ò#R$Ò'
R4Ò3R4Ò<
S
ÓS Ó$S4Ó3S4)r3  r4  r5  N)rU   rV   rW   rX   rY   r)   r>  rE  rZ   rI  ri  r\   r]   r   r   r/  r/  •  s9   † ñò

ò"ò@Nð	 3ð 	¨3ô 	ðK  3÷ K r   r/  c                 ó–   • [         R                  U S   5      nU(       d  g[        UR                  S5      R	                  SS5      5      $ )Nr.   r   Ú	z    )Ú
_indent_rerB   rH   r1   Úreplace)r   r4   s     r   rW  rW  n  s<   € Ü×Ñ˜˜r™Ó#€AÞØÜˆq�w‰w�q‹z×!Ñ! $¨Ó.Ó/Ð/r   c                   ó,   ^ • \ rS rSrSU 4S jjrSrU =r$ )ÚMaybeAsyncCompileiu  c                 óL   >• [         TU ]  5         U =R                  U-  sl        g rA   )r	  r)   Úflags)r(   Úextra_flagsr  s     €r   r)   ÚMaybeAsyncCompile.__init__v  s   ø€ Ü‰ÑÔØ�
Š
�kÑ!Ž
r   r]   ©r   )rU   rV   rW   rX   r)   r\   r  r  s   @r   rp  rp  u  s   ø† ÷"õ "r   rp  c                   ó   • \ rS rSrSS jrSrg)ÚMaybeAsyncCommandCompileri{  c                 ó    • [        US9U l        g )N©rs  )rp  Úcompiler)r(   rs  s     r   r)   Ú"MaybeAsyncCommandCompiler.__init__|  s   € Ü)°kÑBˆ�r   )rz  Nru  )rU   rV   rW   rX   r)   r\   r]   r   r   rw  rw  {  s   † ÷Cr   rw  ry  )ErY   ÚastÚcodeopr   r   r"   rÃ   r¢   Útypingr   r   r   r   r!  Útextwrapr	   ÚIPython.utilsr
   r#   rm  r   r   r   r1  ÚVERBOSEr2  rj   Úintrz   r   r„   r†   rž   r³   rõ   Ú
ESC_SH_CAPÚESC_HELPÚ	ESC_HELP2rÖ   Ú
ESC_MAGIC2Ú	ESC_QUOTEÚ
ESC_QUOTE2Ú	ESC_PARENrü   r   rÝ   rã   rå   rê   rï   rñ   rö   r©   r  rø   r  r  rZ   r*  Ú	TokenInfor-  rB  r/  rW  rp  rw  ÚPyCF_ALLOW_TOP_LEVEL_AWAITÚ_extra_flagsr^  r]   r   r   Ú<module>r�     sN  ðñó ß +Û 	Û 
Û ß -Ó -Û Ý å #à�ZŠZ˜
Ó#€
òò<÷|ñ |ñ|  Ø�jŠjÐ.Ó/Ø�zŠz˜,Ó'Øñ€ñ  Ø‡J‚Jð	ð$ 	�
‰
ó'ó€ò2	.ð 8¨C¡=ô ð"
°#ô 
ð,¨%°°S°©/ð ,ÀSô ,÷61"ñ 1"ôf7Ð$ô 7ô@77Ð%ô 77ð~ €	Ø€
Ø€Ø€	Ø€	Ø€
Ø€	Ø€
Ø€	â/€Ø˜�€ò
Rò)ò*òAò
;ò
%ò
6ð Ð0×7Ñ7ØÐ3×:Ñ:Ø�HØ�IØ�IØ�IØ�JØ�Ið €ô)7Ð'ô )7ðX �zŠzðð ‡J�Jó€ô,7Ð ô ,7ð\-˜d 3™iô -ð`
  X×%7Ñ%7Ñ 8ô 
ð Ð ÷V ñ V òr0ô"˜ô "ôC ô Cð
 ×-Ñ-€á+¸ÑE�r   