403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/IPython/core/magics/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/IPython/core/magics/__pycache__/history.cpython-311.pyc
�

�@�cT1���dZddlZddlZddlmZddlZddlmZddl	m
Z
mZmZddl
mZmZmZddlmZddlmZe��ZeGd	�d
e
����ZdS)z6Implementation of magic functions related to History.
�N)�open)�StdinNotImplementedError)�Magics�magics_class�
line_magic)�argument�magic_arguments�parse_argstring)�skip_doctest)�ioc��eZdZe��eddddd���eddddd	���ed
dddd���ed
dddd���eddd���eddddd���eddeded� ��ed!d"dd#�$��ed%d�&��eed+d(�������������������������Z	ed)���Z
ed+d*���ZdS),�
HistoryMagicsz-n�
print_nums�
store_trueFz{
        print line numbers for each input.
        This feature is only available if numbered prompts are in use.
        )�dest�action�default�helpz-o�
get_outputz"also print outputs for each input.z-p�	pypromptsz�
        print classic '>>>' python prompts before each input.
        This is useful for making documentation, and in conjunction
        with -o, for producing doctest-ready output.
        z-t�raw�store_falseTa�
        print the 'translated' history, as IPython understands it.
        IPython filters your input and converts it all into valid Python
        source before executing it (things like magics or aliases are turned
        into function calls, for example). With this option, you'll see the
        native history instead of the user-entered version: '%%cd /' will be
        seen as 'get_ipython().run_line_magic("cd", "/")' instead of '%%cd /'.
        z-f�filenamea�
        FILENAME: instead of printing the output to the screen, redirect
        it to the given file.  The file is always overwritten, though *when
        it can*, IPython asks for confirmation first. In particular, running
        the command 'history -f FILENAME' from the IPython Notebook
        interface will replace FILENAME even if it already exists *without*
        confirmation.
        )rrz-g�pattern�*Nac
        treat the arg as a glob pattern to search for in (full) history.
        This includes the saved history (almost all commands ever written).
        The pattern may contain '?' to match one unknown character and '*'
        to match any number of unknown characters. Use '%%hist -g' to show
        full saved history (may be very long).
        )r�nargsrrz-l�limit�?z�
        get the last n lines from all sessions. Specify n as a single
        arg, or the default is the last 10 lines.
        )r�typerrrz-u�uniquezN
        when searching history using `-g`, show only unique history.
        )rrr�range)r�c���t|j|��}|jj��fd�}|j}|st
j}d}n�tj�	|��}tj�
|��rM	tjd|z��}n#t$rd}YnwxYw|std��dStd��t|dd	�
��}d}|j}|j}	|j}
|j}d}|jt*urdn|j}
d}|j�S|jsL|jr!dd�|j��zdz}nd}��|||	|
|j�
��}d}n�|jt*ur|
�dn|
}��|||	���}nX|jr"dd�|j��zdz}d}��d�|j��||	��}d}|D]�\}}}|	r|\}}|rt;j||��s�%|�d�����}d|v}|rdnd}|r4t|||��� |���d|��|d���|
r>tdd|���|r*d�|�!����dz}t||���|	r|rt||�����|r|�"��dSdS)a�Print input history (_i<n> variables), with most recent last.

        By default, input history is printed without line numbers so it can be
        directly pasted into an editor. Use -n to show them.

        By default, all input history from the current session is displayed.
        Ranges of history can be indicated using the syntax:

        ``4``
            Line 4, current session
        ``4-6``
            Lines 4-6, current session
        ``243/1-5``
            Lines 1-5, session 243
        ``~2/7``
            Line 7, session 2 before current
        ``~8/1-~6/5``
            From the first line of 8 sessions ago, to the fifth line of 6
            sessions ago.

        Multiple ranges can be entered, separated by spaces

        The same syntax is used by %macro, %save, %edit, %rerun

        Examples
        --------
        ::

          In [6]: %history -n 4-6
          4:a = 12
          5:print a**2
          6:%history -n 4-6

        c�F��|d�jfvrt|��S|�d|��S)z0Helper function to format line numbers properly.r�/)�session_number�str)�session�line�history_managers  ��=/usr/lib/python3/dist-packages/IPython/core/magics/history.py�_format_linenoz-HistoryMagics.history.<locals>._format_lineno�s3����1�o�<�=�=�=��4�y�y� �%�g�g�t�t�,�,�FzFile %r exists. Overwrite?Tz	Aborting.NzOverwriting file.�wzutf-8)�encodingr� )r�output�nr �
)rr1��
�:r")�file�endz>>> )r8r7z
... z
...)r7)#r
�history�shellr*r�sys�stdout�os�path�
expanduser�existsr�
ask_yes_nor�print�io_openrrrrr�_unspecifiedrr!�join�searchr �get_tail�get_range_by_str�fnmatch�
expandtabs�rstrip�rjust�
splitlines�close)�self�parameter_s�argsr,�outfname�outfile�close_at_end�ansrrrrrr�
range_pattern�histr2�widthr(�lineno�inliner1�	multiline�line_sepr*s                        @r+r9zHistoryMagics.history(s����@�t�|�[�9�9���*�4��	-�	-�	-�	-�	-��=���	 ��j�G� �L�L��w�)�)�(�3�3�H��w�~�~�h�'�'�
+���-�(D�x�(O�P�P�C�C��/�����C�C�C��������+�&�&�&��F��)�*�*�*��h��g�>�>�>�G��L��_�
��_�
��N�	��h�����
�l�2�2����
���
��<�#�D�J�#��|�
������� 6� 6�6��<�����"�)�)�'�s�:�,1�$�+�*�G�G�D��J�J�
�Z�|�
+�
+��m����A�"�+�+�A�3�z�+�J�J�D�D��|�
"� #�c�h�h�t�|�&<�&<� <�s� B�
�!�
�"�3�3������$�$�c�:���D���'+�	,�	,�#�G�V�V�
�
(�!'�����
���v�}�=�=����&�&�q�)�)�0�0�2�2�F����I�(�1�t�t�c�H��
;��.�.��&�"A�"A�"G�"G��"N�"N�"N�"N� ��"�)0�c�;�;�;�;��
J��g�3�W�5�5�5�5��J�%�]�]�6�+<�+<�+>�+>�?�?�'�I�F��&�w�'�'�'�'��
,�f�
,��f�7�+�+�+�+���	��M�M�O�O�O�O�O�	�	s�?B�B&�%B&c�6�|s9|j�t|jjd����dS|jj�|��}d�d�|D����}|r.|j�|�����dS	tt||jj����}|j�|�����dS#t$r||jj�
d|zdz��}td�|D����D]:}d|vsd|vr�|j�|�����YdSYnwxYwtd	|��dS)
aIRepeat a command, or get command to input line for editing.

        %recall and %rep are equivalent.

        - %recall (no arguments):

        Place a string version of last computation result (stored in the
        special '_' variable) to the next input prompt. Allows you to create
        elaborate command lines without using copy-paste::

             In[1]: l = ["hei", "vaan"]
             In[2]: "".join(l)
            Out[2]: heivaan
             In[3]: %recall
             In[4]: heivaan_ <== cursor blinking

        %recall 45

        Place history line 45 on the next input prompt. Use %hist to find
        out the number.

        %recall 1-4

        Combine the specified lines into one cell, and place it on the next
        input prompt. See %history for the slice syntax.

        %recall foo+bar

        If foo+bar can be evaluated in the user namespace, the result is
        placed at the next input prompt. Otherwise, the history is searched
        for lines which contain that substring, and the most recent one is
        placed at the next input prompt.
        �_Nr5c3�&K�|]}|dV��
dS)�N���.0�xs  r+�	<genexpr>z'HistoryMagics.recall.<locals>.<genexpr>s&����0�0���!��0�0�0�0�0�0r-rc��g|]
}|d��S�r`rarbs  r+�
<listcomp>z(HistoryMagics.recall.<locals>.<listcomp>s��7�7�7��q��t�7�7�7r-�recall�repz%Couldn't evaluate or find in history:)
r:�set_next_inputr'�user_nsr*rHrErK�eval�	ExceptionrF�reversedrB)rO�arg�	histlines�cmd�hs     r+rizHistoryMagics.recall�s���F�	��J�%�%�c�$�*�*<�S�*A�&B�&B�C�C�C��F��J�.�?�?��D�D�	��i�i�0�0�i�0�0�0�0�0���	��J�%�%�c�j�j�l�l�3�3�3��F�	��d�3��
� 2�3�3�4�4�C�
�J�%�%�c�j�j�l�l�3�3�3��F���	�	�	��
�2�9�9�#�c�'�#�+�F�F�I��7�7�Y�7�7�7�8�8�
�
���q�=�=�E�Q�J�J���
�)�)�!�(�(�*�*�5�5�5�����	
�
�	����	�5�s�;�;�;�;�;s�+'D�BF�Fc��|�|dd���\}}d|vr�	t|d��}n #t$rtd��YdSwxYw|dkrtd��dS|dkrtd	��dS|jj�|��}n�d
|vr^d|d
zdz}t|jj�|����}t|��D]}d|d
vr|g}n�g}nA|r |jj�
|��}n|jj�d��}d�|D��}|std��dSd�|��}td��t|��td��|j�d�|��d���dS)aoRe-run previous input

        By default, you can specify ranges of input history to be repeated
        (as with %history). With no arguments, it will repeat the last line.

        Options:

          -l <n> : Repeat the last n lines of input, not including the
          current command.

          -g foo : Repeat the most recent line which contains foo
        zl:g:�string)�mode�lz"Number of lines must be an integerNrz'Requested 0 last lines - nothing to runz+Number of lines to rerun cannot be negative�gr�rerunr`�c��g|]
}|d��Srgrarbs  r+rhz'HistoryMagics.rerun.<locals>.<listcomp>Js��#�#�#���!��#�#�#r-z'No lines in history match specificationr5z=== Executing: ===z=== Output: ===F)�
store_history)
�
parse_options�int�
ValueErrorrBr:r*rG�listrFrorHrE�run_cell)	rOrP�optsrQr2rW�prwrqs	         r+ryzHistoryMagics.reruns���'�'��V�(�'�K�K�
��d��$�;�;�
���S�	�N�N�����
�
�
��:�;�;�;����
�����A�v�v��?�@�@�@����Q����C�D�D�D����:�-�6�6�q�9�9�D�D�
�D�[�[��D��I�
�c�!�A���
�2�9�9�!�<�<�=�=�D��d�^�^�
�
���!�A�$�&�&��3�D��E�'����
�	:��:�-�>�>�t�D�D�D�D��:�-�6�6�q�9�9�D�#�#�d�#�#�#���	��;�<�<�<��F��I�I�d�O�O�	�
�"�#�#�#�
�i����
�� � � ��
���D�I�I�d�O�O�5��A�A�A�A�As�7�A�A)r")�__name__�
__module__�__qualname__r	rr~rDrrr9riryrar-r+rr%s�������_���
�X��<��e��
�
�
��X��<��e�
1�3�3�3��X��;�|�U��
�
�
��X��5����	
�	
�	
��X��:��	
�	
�	
��X��9�C���
�
�
��X��7��C���
�
�
��X��8�L��
�
�
�
�X�g�S�!�!�!���~�~�~��Z��\�"�!�
�
�

�
�
�
�	
�	
�	
�	
�
�
�3�3�

�
���x~�@�8<�8<��Z�8<�t�2B�2B�2B��Z�2B�2B�2Br-r)�__doc__r=r;rrrCrI�IPython.core.errorr�IPython.core.magicrrr�IPython.core.magic_argumentsrr	r
�IPython.testing.skipdoctestr�
IPython.utils�objectrDrrar-r+�<module>r�s'����
�	�	�	�
�
�
�
�����������8�7�7�7�7�7�?�?�?�?�?�?�?�?�?�?�;�;�;�;�;�;�;�;�;�;�4�4�4�4�4�4��������v�x�x���lB�lB�lB�lB�lB�F�lB�lB���lB�lB�lBr-

Youez - 2016 - github.com/yon3zu
LinuXploit