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/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

�@�c���dZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZdd	lm
Z
d
ZdZGd�d
e��ZGd�de��ZGd�de��ZdS)zb
An application for managing IPython history.

To be invoked as the `ipython history` subcommand.
�N)�Path)�Application�)�BaseIPythonApplication)�Bool�Int�Dict�)�
ask_yes_noz�Trim the IPython history database to the last 1000 entries.

This actually copies the last 1000 entries to a new database, and then replaces
the old file with the new. Use the `--keep=` argument to specify a number
other than 1000.
aClear the IPython history database, deleting all entries.

Because this is a destructive operation, IPython will prompt the user if they
really want to do this. Passing a `-f` flag will force clearing without a
prompt.

This is an handy alias to `ipython history trim --keep=0`
c��eZdZeZedd����d���Zedd����d���Z	e
edddiiejf�	����Z
e
ed
�����Zd�Zd
S)�HistoryTrimFz/Keep the old history file as history.sqlite.<N>��helpT��configi��/Number of recent lines to keep in the database.�backup)rzHistoryTrim.keep)�keepc��t|jj��}|dz}tj|��}t|�d|jdzf����}t|��|jkr(td|jz��td��dStd|jz��|�
��|���|rV|dd}t|�d|f����}t|�d	|f����}|���|d
z}d}	|�
��r.|	dz
}	|d
t|	��zz}|�
���.tj|��}
|
�d��|
�d��|
�d
��|
���|r\|
5|
�d|��|
�d|��|
�d|��ddd��n#1swxYwY|
���|jred}	|d|	zz}|�
��r!|	dz
}	|d|	zz}|�
���!|�|��td|��n|���|�|��dS)Nzhistory.sqlitez^SELECT session, line, source, source_raw FROM history ORDER BY session DESC, line DESC LIMIT ?rz=There are already at most %d entries in the history database.z>Not doing anything. Use --keep= argument to keep fewer entriesz/Trimming history to the most recent %d entries.rzCSELECT session, line, output FROM output_history WHERE session >= ?zMSELECT session, start, end, num_cmds, remark FROM sessions WHERE session >= ?zhistory.sqlite.newz�CREATE TABLE IF NOT EXISTS sessions (session integer
                            primary key autoincrement, start timestamp,
                            end timestamp, num_cmds integer, remark text)z�CREATE TABLE IF NOT EXISTS history
                        (session integer, line integer, source text, source_raw text,
                        PRIMARY KEY (session, line))z�CREATE TABLE IF NOT EXISTS output_history
                        (session integer, line integer, output text,
                        PRIMARY KEY (session, line))z'insert into sessions values (?,?,?,?,?)z$insert into history values (?,?,?,?)z)insert into output_history values (?,?,?)zhistory.sqlite.old.%dz Backed up longer history file to)r�profile_dir�location�sqlite3�connect�list�executer�len�print�pop�reverse�close�exists�str�commit�executemanyr�rename�unlink)�selfr�	hist_file�con�inputs�
first_session�outputs�sessions�
new_hist_file�i�new_db�backup_hist_files            �9/usr/lib/python3/dist-packages/IPython/core/historyapp.py�startzHistoryTrim.start6s����4�+�4�5�5���"2�2�	��o�i�(�(���c�k�k�#S�UY�U^�_`�U`�Tb�d�d�e�e���v�;�;�$�)�#�#��Q�TX�T]�]�^�^�^��R�S�S�S��F�
�?�$�)�K�L�L�L��
�
�����������	Z�"�1�I�a�L�M��3�;�;�(K�MZ�L\�^�^�_�_�G��C�K�K�)F�HU�GW�Y�Y�Z�Z�H��	�	����$�&:�:�
�
���"�"�$�$�	J�
��F�A�'�+?�#�a�&�&�+H�I�M��"�"�$�$�	J����/�/�����M�	N�	N�	N�	���8�	9�	9�	9�	���8�	9�	9�	9�	�
�
�����	Y��
Y�
Y��"�"�#L�h�W�W�W��"�"�#I�6�R�R�R��"�"�#N�PW�X�X�X�	
Y�
Y�
Y�
Y�
Y�
Y�
Y�
Y�
Y�
Y�
Y����
Y�
Y�
Y�
Y�
	�������;�		��A�*�.E��.I�J��"�)�)�+�+�
O��Q���#.�2I�A�2M�#N� �#�)�)�+�+�
O�
���-�.�.�.��4�6F�G�G�G�G����������Y�'�'�'�'�'s�>AI
�
I�IN)�__name__�
__module__�__qualname__�trim_hist_help�descriptionr�tagrrrr	�dictr�flags�aliasesr3��r2r
r
!s������� �K�
�T�%�
>�
�
�
�

�#�T�#�
�
���3�t�
>�
�
�
�

�#�T�#�
�
�	�
�D��� �H�t�#4�5��K�
����
�
�E�
�D���!����
�
�G�@(�@(�@(�@(�@(r>r
c���eZdZeZedd���Zedd����d���Z	e
edddiie	jfd	ddiie	jf�
����Z
e
��Zd�ZdS)
�HistoryClearrrrFz"Don't prompt user for confirmationTr�forcer
)rA�fc�p�|jstddd���rt�|��dSdS)Nz#Really delete all ipython history? �no)�default�	interrupt)rArr
r3�r's r2r3zHistoryClear.start�sN���:�	$��$I���.�.�.�	$����d�#�#�#�#�#�	$�	$r>N)r4r5r6�clear_hist_helpr8rrrr9rAr	r:rr;r<r3r=r>r2r@r@xs�������!�K��3�q�
>�@�@�@�D�
�D��
1�
�
�
�

�#�T�#�
�
�
�
�D��� �G�d�#3�4��J���w��.�
/��J�
����
�
�E��d�f�f�G�$�$�$�$�$r>r@c���eZdZdZdZeeeej���dfe	e	j���df�����Z
d�ZdS)�
HistoryAppzipython-historyz$Manage the IPython history database.r)�trim�clearc�.�|j�vtd|j���z��t��|���|���|�d��dS|j���S)Nz0No subcommand specified. Must specify one of: %sr)�subappr�subcommands�keys�print_description�print_subcommands�exitr3rGs r2r3zHistoryApp.start�s����;���D�59�5E�5J�5J�5L�5L�N�
O�
O�
O��G�G�G��"�"�$�$�$��"�"�$�$�$��I�I�a�L�L�L�L�L��;�$�$�&�&�&r>N)r4r5r6�namer8r	r:r
�
splitlinesr@rOr3r=r>r2rJrJ�s��������D�8�K��$�t�t��[�4�?�?�A�A�!�D�E��|�7�B�B�D�D�Q�G�H������K�
	'�	'�	'�	'�	'r>rJ)�__doc__r�pathlibr�traitlets.config.applicationr�applicationr�	traitletsrrr	�utils.iorr7rHr
r@rJr=r>r2�<module>r\s ��������������4�4�4�4�4�4�/�/�/�/�/�/�%�%�%�%�%�%�%�%�%�%�!�!�!�!�!�!�����U(�U(�U(�U(�U(�(�U(�U(�U(�n$�$�$�$�$�;�$�$�$�.'�'�'�'�'��'�'�'�'�'r>

Youez - 2016 - github.com/yon3zu
LinuXploit