ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/autoexpand.cpython-36.opt-1.pyc

3

*j�a��@sFdZddlZddlZGdd�d�ZedkrBddlmZeddd	�dS)
a=Complete the current word before the cursor with words in the editor.

Each menu selection or shortcut key selection replaces the word with a
different word with the same prefix. The search for matches begins
before the target and moves toward the top of the editor. It then starts
after the cursor and moves down. It then returns to the original word and
the cycle starts again.

Changing the current text line or leaving the cursor in a different
place before requesting the next selection causes AutoExpand to reset
its state.

There is only one instance of Autoexpand.
�Nc@s<eZdZejejdZdd�Zdd�Zdd�Z	dd	�Z
d
S)�
AutoExpand�_cCs|j|_|jj|_d|_dS)N)�text�bell�state)�selfZeditwin�r�7/opt/alt/python36/lib64/python3.6/idlelib/autoexpand.py�__init__s
zAutoExpand.__init__c
Cs�|jjd�}|jjdd�}|js.|j�}d}n*|j\}}}}||ksL||krX|j�}d}|sh|j�dS|j�}|jjdt|�d�||}	|dt|�}|dkr�|j�|jj	d|	�|jjd�}|jjdd�}||||f|_dS)z1Replace the current word with the next expansion.�insertzinsert linestartzinsert lineendr�breakzinsert - %d chars�)
r�index�getr�getwordsr�getprevword�delete�lenr)
rZeventZ	curinsertZcurline�wordsrr�line�wordZnewwordrrr	�expand_word_events.zAutoExpand.expand_word_eventc	Cs�|j�}|sgS|jjdd�}tjd|d|�}~|jjdd�}tjd|d|�}~|rh|rhgSg}i}|j�x*|D]"}|j|�r�q~|j|�|||<q~Wx*|D]"}|j|�r�q�|j|�|||<q�W|j|�|S)z?Return a list of words that match the prefix before the cursor.z1.0zinsert wordstartz\bz\w+\bzinsert wordend�end)rrr�re�findall�reverse�append)	rrZbeforeZwbefore�afterZwafterr�dict�wrrr	r6s4






zAutoExpand.getwordscCsJ|jjdd�}t|�}x&|dkr<||d|jkr<|d}qW||d�S)z)Return the word prefix before the cursor.zinsert linestartrrr
N)rrr�	wordchars)rr�irrr	rUs
zAutoExpand.getprevwordN)�__name__�
__module__�__qualname__�stringZ
ascii_lettersZdigitsr r
rrrrrrr	rs
r�__main__)�mainz!idlelib.idle_test.test_autoexpand�)�	verbosity)�__doc__rr%rr"Zunittestr'rrrr	�<module>sK

Zerion Mini Shell 1.0