AlkantarClanX12

Your IP : 3.137.169.56


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/idlelib/__pycache__/IdleHistory.cpython-35.pyc



��Yf��@s_dZddlmZGdd�d�Zedkr[ddlmZeddd	d
d�dS)
z9Implement Idle Shell history mechanism with History class�)�idleConfc@sReZdZdZdd�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|_tjddddd�|_|jd|j�|jd|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�8/opt/alt/python35/lib64/python3.5/idlelib/IdleHistory.py�__init__
s					zHistory.__init__cCs|jdd�dS)z4Fetch later statement; start with ealiest if cyclic.�reverseF�break)�fetch)r�eventrrrr
szHistory.history_nextcCs|jdd�dS)z0Fetch earlier statement; start with most recent.rTr)r)rrrrrr#szHistory.history_prevcCs;t|j�}|j}|j}|dk	r�|dk	r�|jjddd�ss|jjdd�|j|kr�d}}|jjdd�|dks�|dkr�|jjdd�}|r�|}n#|jr�d}n|jj	�dSt|�}x||r
dnd7}|dks,||kr�|jj	�|jrS|dkrSdS|jjdd�|kr�|jj
dd�|jjd|�d}}P|j|}|d|�|kr�t|�|kr�|jj
dd�|jjd|�Pq�W|jjd�|jj
dd	d
�||_||_dS)
a+Fetch statememt 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-1cZiomarkrrZselz1.0�end���r)�lenr	rr
rZcompare�getZmark_setrZbellZdeleterZseeZ
tag_remove)rrZnhistrr
Znprefix�itemrrrr(sJ		"
			



(	z
History.fetchcCsm|j�}t|�dkrWy|jj|�Wntk
rFYnX|jj|�d|_d|_dS)z.Store Shell input statement into history list.�N)�striprr	�remove�
ValueError�appendrr
)r�sourcerrr�storeYs
	z
History.storeN)	�__name__�
__module__�__qualname__�__doc__rr
rrr"rrrrrs1r�__main__)rz"idlelib.idle_test.test_idlehistory�	verbosityr�exitFN)r&Zidlelib.configHandlerrrr#Zunittestrrrrr�<module>s
a