ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/history.cpython-37.pyc

B

� f��@sDdZddlmZGdd�d�Zedkr@ddlmZeddd	d
�dS)z9Implement Idle Shell history mechanism with History class�)�idleConfc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�Historya@ Implement Idle Shell history mechanism.

    store - Store source statement (called from pyshell.resetoutput).
    fetch - Fetch stored statement matching prefix already entered.
    history_next - Bound to <<history-next>> event (default Alt-N).
    history_prev - Bound to <<history-prev>> event (default Alt-P).
    cCsL||_g|_d|_d|_t�ddddd�|_|�d|j�|�d|j	�dS)	adInitialize data attributes and bind event methods.

        .text - Idle wrapper of tk Text widget, with .bell().
        .history - source statements, possibly with multiple lines.
        .prefix - source already entered at prompt; filters history list.
        .pointer - index into history.
        .cyclic - wrap around history list (or not).
        N�mainr�cyclic��boolz<<history-previous>>z<<history-next>>)
�text�history�prefix�pointerrZ	GetOptionrZbind�history_prev�history_next)�selfr�r�4/opt/alt/python37/lib64/python3.7/idlelib/history.py�__init__s	zHistory.__init__cCs|jdd�dS)z4Fetch later statement; start with ealiest if cyclic.F)�reverse�break)�fetch)r�eventrrrr
szHistory.history_nextcCs|jdd�dS)z0Fetch earlier statement; start with most recent.T)rr)r)rrrrrr$szHistory.history_prevcCs�t|j�}|j}|j}|dk	rd|dk	rd|j�ddd�sN|j�dd�|j|krdd}}|j�dd�|dkst|dkr�|j�dd�}|r�|}n|jr�d}n|j�	�dSt|�}x�||r�dnd7}|dks�||k�r(|j�	�|js�|dkr�dS|j�dd�|k�r|j�
dd�|j�d|�d}}P|j|}|d|�|kr�t|�|kr�|j�
dd�|j�d|�Pq�W|j�d�|j�
d	d
d�||_||_dS)a+Fetch statement and replace current line in text widget.

        Set prefix and pointer as needed for successive fetches.
        Reset them to None, None when returning to the start line.
        Sound bell when return to start line or cannot leave a line
        because cyclic is False.
        N�insertz!=zend-1cZiomark���rrZselz1.0�end)�lenr	rr
rZcompare�getZmark_setrZbell�deleterZseeZ
tag_remove)rrZnhistrr
Znprefix�itemrrrr)sJ



z
History.fetchcCsV|��}t|�dkrFy|j�|�Wntk
r8YnX|j�|�d|_d|_dS)z.Store Shell input statement into history list.�N)�striprr	�remove�
ValueError�appendrr
)r�sourcerrr�storeZsz
History.storeN)	�__name__�
__module__�__qualname__�__doc__rr
rrr#rrrrrs1r�__main__)rzidlelib.idle_test.test_historyrF)�	verbosity�exitN)r'Zidlelib.configrrr$Zunittestrrrrr�<module>s
b

Zerion Mini Shell 1.0