| 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 : |
�
�@�cT1 � � � d Z ddlZddlZddlmZ ddlZddlmZ ddl m
Z
mZmZ ddl
mZmZmZ ddlmZ ddlmZ e� � Ze G d � 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 � � e Zd Z e� � 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.
)r r z-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 �nargsr r z-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 �typer r r z-u�uniquezN
when searching history using `-g`, show only unique history.
)r r r �range)r � c � �� t | j |� � }| j j ��fd�}|j }|st
j }d}n�t j � |� � }t j �
|� � rM t j d|z � � }n# t $ r d}Y nw xY w|st d� � dS t d� � t |dd �
� � }d}|j }|j } |j }
|j }d}|j t* u rdn|j }
d}|j �S|j sL|j r!dd� |j � � z dz }nd}�� ||| |
|j �
� � }d}n�|j t* ur|
�dn|
}�� ||| �� � }nX|j r"dd� |j � � z dz }d}�� d� |j � � || � � }d}|D ]�\ }}}| r|\ }}|rt; j ||� � s�%|� d� � � � � }d|v }|rdnd}|r4t |||� � � |� � �d|��|d�� � |
r>t dd|�� � |r*d� |�! � � � � dz }t ||�� � | r|rt ||�� � ��|r|�"