§
    �Ÿj  ã                   óÀ   — d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZmZ dd	lmZ ej        d
fd„Ze
 G d„ de	¦  «        ¦   «         ZdS )zExtra magics for terminal use.é    )ÚerrorN)ÚTryNextÚ
UsageError)ÚMagicsÚmagics_classÚ
line_magic)ÚClipboardEmpty)Úskip_doctest)ÚSListÚstrip_email_quotes)Ú	py3compatFc              #   ó®   K  — |st          d| z  ¦  «         d}nd}	 	  ||¦  «        }|| k    rdS |V — n # t          $ r t          d¦  «         Y dS w xY wŒ:)zH Yield pasted lines until the user enters the given sentinel value.
    zAPasting code; enter '%s' alone on the line to stop or use Ctrl-D.ú:Ú TNz<EOF>)ÚprintÚEOFError)ÚsentinelÚl_inputÚquietÚpromptÚls        úd/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/terminal/magics.pyÚget_pasted_linesr      s›   è è € ð ð ÝÐQØññ 	ô 	ð 	àˆˆàˆð	ð	Ø�˜‘”ˆAØ�HŠ}ˆ}Ø�à����øÝð 	ð 	ð 	Ý�'‰NŒNˆNØˆFˆFð	øøøð	s   ž6 ±6 ¶AÁAc                   óÀ   ‡ — e Zd Zˆ fd„Zdd„Zd„ Zdd„Zedd„¦   «         Ze	edd	„¦   «         ¦   «         Z
edd
„¦   «         Zej        dk    red„ ¦   «         Zˆ xZS ˆ xZS )ÚTerminalMagicsc                 óX   •— t          t          | ¦  «                             |¦  «         d S )N)Úsuperr   Ú__init__)ÚselfÚshellÚ	__class__s     €r   r   zTerminalMagics.__init__)   s'   ø€ Ý�n˜dÑ#Ô#×,Ò,¨UÑ3Ô3Ð3Ð3Ð3ó    Fc                 ó`  — |rBt          |                     ¦   «         ¦  «        | j        j        |<   t	          d|z  ¦  «         dS |                      |¦  «        }|| j        j        d<   d| j        _        	 | j                             ||¦  «         d| j        _        dS # d| j        _        w xY w)zM Execute a block, or store it in a variable, per the user's request.
        zBlock assigned to '%s'Úpasted_blockTFN)r   Ú
splitlinesr    Úuser_nsr   Úpreclean_inputÚusing_paste_magicsÚrun_cell)r   ÚblockÚnameÚstore_historyÚbs        r   Ústore_or_executezTerminalMagics.store_or_execute,   s¸   € ð ð 	6å',¨U×-=Ò-=Ñ-?Ô-?Ñ'@Ô'@ˆDŒJÔ˜tÑ$ÝÐ*¨TÑ1Ñ2Ô2Ð2Ð2Ð2à×#Ò# EÑ*Ô*ˆAØ12ˆDŒJÔ˜~Ñ.Ø,0ˆDŒJÔ)ð6Ø”
×#Ò# A }Ñ5Ô5Ð5à05�”
Ô-Ð-Ð-ø°�”
Ô-Ð5Ð5Ð5Ð5s   Á6B ÂB-c                 óò   — |                      ¦   «         }|r@|d                              ¦   «         s&|dd …         }|r|d                              ¦   «         ¯&t          d                     |¦  «        ¦  «        S )Nr   é   ú
)r%   Ústripr   Újoin)r   r*   Úliness      r   r'   zTerminalMagics.preclean_input<   sv   € Ø× Ò Ñ"Ô"ˆØð 	˜E !œHŸNšNÑ,Ô,ð 	Ø˜!˜"˜"”IˆEð ð 	˜E !œHŸNšNÑ,Ô,ð 	å! $§)¢)¨EÑ"2Ô"2Ñ3Ô3Ð3r"   r$   c                 óX  — | j         j                             |¦  «        }|€t          d¦  «        ‚t	          |t
          ¦  «        st          d¦  «        ‚t          d|                     dd¦  «        d         t          |¦  «        fz  ¦  «         | j          	                    |¦  «         dS )z, Rerun a previously pasted command.
        Nz"No previous pasted block availablez6Variable 'pasted_block' is not a string, can't executezRe-executing '%s...' (%d chars)r1   r0   r   )
r    r&   Úgetr   Ú
isinstanceÚstrr   ÚsplitÚlenr)   )r   r+   r-   s      r   Úrerun_pastedzTerminalMagics.rerun_pastedB   s«   € ð ŒJÔ×"Ò" 4Ñ(Ô(ˆð ˆ9ÝÐAÑBÔBÐBÝ˜!�SÑ!Ô!ð 	JÝØHñJô Jð Jõ 	Ð/°!·'²'¸$¸q±/´/À!Ô2DÅcÈ!ÁfÄfÐ1MÑMÑNÔNÐNØŒ
×Ò˜AÑÔÐÐÐr"   r   c                 ó|   — | j                              ¦   «          t          dddg| j         j                 ¦  «         dS )z%Toggle autoindent on/off (deprecated)zAutomatic indentation is:ÚOFFÚONN)r    Úset_autoindentr   Ú
autoindent)r   Úparameter_ss     r   r@   zTerminalMagics.autoindentQ   s=   € ð 	Œ
×!Ò!Ñ#Ô#Ð#ÝÐ)¨5°¨,°t´zÔ7LÔ*MÑNÔNÐNÐNÐNr"   c                 ó  — |                       |dd¬¦  «        \  }}d|v r|                      ¦   «          dS d|v }|                     dd¦  «        }d	                     t	          ||¬
¦  «        ¦  «        }|                      ||d¬¦  «         dS )uâ  Paste & execute a pre-formatted code block from clipboard.

        You must terminate the block with '--' (two minus-signs) or Ctrl-D
        alone on the line. You can also provide your own sentinel with '%paste
        -s %%' ('%%' is the new sentinel for this operation).

        The block is dedented prior to execution to enable execution of method
        definitions. '>' and '+' characters at the beginning of a line are
        ignored, to allow pasting directly from e-mails, diff files and
        doctests (the '...' continuation prompt is also stripped).  The
        executed block is also assigned to variable named 'pasted_block' for
        later editing with '%edit pasted_block'.

        You can also pass a variable name as an argument, e.g. '%cpaste foo'.
        This assigns the pasted block to variable 'foo' as string, without
        dedenting or executing it (preceding >>> and + is still stripped)

        '%cpaste -r' re-executes the block previously entered by cpaste.
        '%cpaste -q' suppresses any additional output messages.

        Do not be alarmed by garbled output on Windows (it's a readline bug).
        Just press enter and type -- (and press enter again) and the block
        will be what was just pasted.

        Shell escapes are not supported (yet).

        See Also
        --------
        paste : automatically pull code from clipboard.

        Examples
        --------
        ::

          In [8]: %cpaste
          Pasting code; enter '--' alone on the line to stop.
          :>>> a = ["world!", "Hello"]
          :>>> print(" ".join(sorted(a)))
          :--
          Hello world!

        ::
          In [8]: %cpaste
          Pasting code; enter '--' alone on the line to stop.
          :>>> %alias_magic t timeit
          :>>> %t -n1 pass
          :--
          Created `%t` as an alias for `%timeit`.
          Created `%%t` as an alias for `%%timeit`.
          354 ns Â± 224 ns per loop (mean Â± std. dev. of 7 runs, 1 loop each)
        zrqs:Ústring©ÚmodeÚrNÚqÚsz--r1   )r   T©r,   )Úparse_optionsr;   r6   r3   r   r.   )r   rA   Úoptsr+   r   r   r*   s          r   ÚcpastezTerminalMagics.cpasteW   sŸ   € ðl ×'Ò'¨°VÀ(Ð'ÑKÔK‰
ˆˆdØ�$ˆ;ˆ;Ø×ÒÑÔÐØˆFà˜�ˆà—8’8˜C Ñ'Ô'ˆØ—	’	Õ*¨8¸5ÐAÑAÔAÑBÔBˆØ×Ò˜e T¸ÐÑ>Ô>Ð>Ð>Ð>r"   c                 óÔ  — |                       |dd¬¦  «        \  }}d|v r|                      ¦   «          dS 	 | j        j                             ¦   «         }nl# t
          $ rB}t          |d¦  «        }|rt          |d         ¦  «         nt          d¦  «         Y d}~dS d}~wt          $ r}t          d	¦  «        |‚d}~ww xY wd
|vrŠt          j                             | j                             |¦  «        ¦  «         |                     d¦  «        st          j                             d¦  «         t          j                             d¦  «         |                      ||d¬¦  «         dS )aå  Paste & execute a pre-formatted code block from clipboard.

        The text is pulled directly from the clipboard without user
        intervention and printed back on the screen before execution (unless
        the -q flag is given to force quiet mode).

        The block is dedented prior to execution to enable execution of method
        definitions. '>' and '+' characters at the beginning of a line are
        ignored, to allow pasting directly from e-mails, diff files and
        doctests (the '...' continuation prompt is also stripped).  The
        executed block is also assigned to variable named 'pasted_block' for
        later editing with '%edit pasted_block'.

        You can also pass a variable name as an argument, e.g. '%paste foo'.
        This assigns the pasted block to variable 'foo' as string, without
        executing it (preceding >>> and + is still stripped).

        Options:

          -r: re-executes the block previously entered by cpaste.

          -q: quiet mode: do not echo the pasted text back to the terminal.

        IPython statements (magics, shell escapes) are not supported (yet).

        See Also
        --------
        cpaste : manually paste code into terminal until you mark its end.
        ÚrqrC   rD   rF   NÚargsr   z&Could not get text from the clipboard.z!The clipboard appears to be emptyrG   r1   z## -- End pasted text --
TrI   )rJ   r;   r    ÚhooksÚclipboard_getr   Úgetattrr   r	   r   ÚsysÚstdoutÚwriteÚ
pycolorizeÚendswithr.   )r   rA   rK   r+   r*   Úclipboard_excÚmessageÚes           r   ÚpastezTerminalMagics.paste˜   s†  € ð> ×'Ò'¨°TÀÐ'ÑIÔI‰
ˆˆdØ�$ˆ;ˆ;Ø×ÒÑÔÐØˆFð
	IØ”JÔ$×2Ò2Ñ4Ô4ˆEˆEøÝð 	ð 	ð 	Ý˜m¨VÑ4Ô4ˆGØð @Ý�g˜a”jÑ!Ô!Ð!Ð!åÐ>Ñ?Ô?Ð?ØˆFˆFˆFˆFˆFøøøøÝð 	Ið 	Ið 	IÝÐ@ÑAÔAÀqÐHøøøøð	Iøøøð �dˆ?ˆ?ÝŒJ×Ò˜TœZ×2Ò2°5Ñ9Ô9Ñ:Ô:Ð:Ø—>’> $Ñ'Ô'ð 'Ý”
× Ò  Ñ&Ô&Ð&ÝŒJ×ÒÐ9Ñ:Ô:Ð:à×Ò˜e T¸ÐÑ>Ô>Ð>Ð>Ð>s#   ·A Á
B?Á 7BÂB?Â*B:Â:B?Úwin32c                 ó.   — t          j        d¦  «         dS )zClear screen.
            ÚclsN)ÚosÚsystem)r   rH   s     r   r^   zTerminalMagics.clsÒ   s   € õ ŒI�eÑÔÐÐÐr"   )F)r$   )r   )Ú__name__Ú
__module__Ú__qualname__r   r.   r'   r;   r   r@   r
   rL   r[   rS   Úplatformr^   Ú__classcell__)r!   s   @r   r   r   '   s  ø€ € € € € ð4ð 4ð 4ð 4ð 4ð6ð 6ð 6ð 6ð 4ð 4ð 4ðð ð ð ð ðOð Oð Oñ „ZðOð
 Øð=?ð =?ð =?ñ „Zñ „\ð=?ð~ ð5?ð 5?ð 5?ñ „Zð5?ðp „|�wÒÐØ	ð	ð 	ñ 
Œð	ð 	ð 	ð 	ð 	ð ÐÐÐr"   r   )Ú__doc__Úloggingr   r_   rS   ÚIPython.core.errorr   r   ÚIPython.core.magicr   r   r   ÚIPython.lib.clipboardr	   ÚIPython.testing.skipdoctestr
   ÚIPython.utils.textr   r   ÚIPython.utilsr   Úinputr   r   © r"   r   ú<module>rp      s  ðØ $Ð $ð Ð Ð Ð Ð Ð Ø 	€	€	€	Ø 
€
€
€
à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø #Ð #Ð #Ð #Ð #Ð #à'0¤¸eð ð ð ð ð* ðnð nð nð nð n�Vñ nô nñ „ðnð nð nr"   