Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/autocomplete.cpython-37.opt-1.pyc

B

� f�"�@s�dZddlZddlZddlZddlZd\ZZddlmZddl	m
Z
ddlmZdZ
dZd	d	d	efZd	d	d	efZejejd
Zej�ejr�ejnd��Zde��ZGd
d�d�Ze��edkr�ddlmZeddd�dS)z�Complete either attribute names or file names.

Either on demand or after a user-selected delay after a key character,
pop up a list of candidates.
�N)r�)�autocomplete_w)�idleConf)�HyperParser)TFTN)FTTNF�_��.c@sneZdZddd�Zedd��Zdd�Zddd	�Zd
d�Zdd
�Z	ddd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�AutoCompleteNcCs,||_|dk	r|j|_d|_d|_d|_dS)N)�editwin�text�autocompletewindow�_delayed_completion_id�_delayed_completion_index)�selfr
�r�9/opt/alt/python37/lib64/python3.7/idlelib/autocomplete.py�__init__!szAutoComplete.__init__cCstjdddddd�|_dS)N�
extensionsr	�	popupwait�intr)�type�default)rZ	GetOptionr)�clsrrr�reload,szAutoComplete.reloadcCst�|j�S)N)rZAutoCompleteWindowr)rrrr�_make_autocomplete_window1sz&AutoComplete._make_autocomplete_windowcCs|jr|j��d|_dS)N)rZhide_window)r�eventrrr�_remove_autocomplete_window4s
z(AutoComplete._remove_autocomplete_windowcCs|�t�dS)zA(^space) Open completion list, even if a function call is needed.�break)�open_completions�FORCE)rrrrr�force_open_completions_event9s
z)AutoComplete.force_open_completions_eventcCs^t|d�r|js"|j�dd���s&dS|jrD|j��rD|j��dS|�t	�}|rVdSdSdS)z5(tab) Complete word or open list if multiple options.�mc_statezinsert linestart�insertNr)
�hasattrr!r�get�striprZ	is_active�completer�TAB)rrZopenedrrr�autocomplete_event>s

zAutoComplete.autocomplete_eventcCsd|j�d�}|tkr`|dkr tnt}|j�d�|_|jdk	rJ|j�|j�|j�	|j
|j|�|_dS)z7(./) Open completion list after pause with no movement.z	insert-1crr"N)rr$�TRIGGERS�TRY_A�TRY_F�indexrr
�after_cancelZafterr�_delayed_open_completions)rrZlastchar�argsrrr�try_open_completions_eventLs
z'AutoComplete.try_open_completions_eventcCs&d|_|j�d�|jkr"|�|�dS)z)Call open_completions if index unchanged.Nr")r
rr,rr)rr/rrrr.Wsz&AutoComplete._delayed_open_completionsc
Cs|\}}}}|jdk	r*|j�|j�d|_t|jd�}|j�dd�}t|�}}	|��r�|rd|tkr�|�	�t}x$|r�||ddt
kr�|d8}qrW|||	�}
|}	x |r�||ddkr�|d8}q�W|||	�}n�|���r�|r�|tk�r�|�	�t}x:|�r4||dt
k�s*t||d�dk�r4|d8}q�W|||	�}
|�r�||ddk�r�|�dt|�|d�|��}|�r�|�s�|�d	�d
k�r�dSnd}ndS|�r�|�s�|
�s�dS|�||�}|d�s�dS|��|_|j�|dt|
�|||�S)
aXFind the completions and create the AutoCompleteWindow.
        Return True if successful (no syntax error or so found).
        If complete is True, then if there's nothing to complete and no
        start of completion, won't open completions and return False.
        If mode is given, will open a completion list only in this mode.
        Nr"zinsert linestartrz'"�rz
insert-%dc�(���rr)r
rr-rr
r$�lenZis_in_string�FILESr�SEPSZ
is_in_code�ATTRS�ID_CHARS�ordZ	set_indexZget_expression�find�fetch_completionsrrZshow_window)
rr/Z	evalfuncsr&Zwantwin�modeZhpZcurline�i�jZ
comp_startZ	comp_whatZ
comp_listsrrrr]sP
0

zAutoComplete.open_completionsc	Cs`y|jjjjj}Wnd}YnX|r<|�dd||fi�S|tkr�|dkr�tjj	tj	�}t
d|�}|��d|kr�tt
d|��}q�dd�|D�}nPy@|�
|�}t|�}|��d|kr�t|j�}nd	d�|D�}WnggfSnd|tk�rJ|dk�r�d
}y0tj�|�}t�|�}|��dd�|D�}Wntk
�rHggfSX|�sT|}||fSdS)aOReturn a pair of lists of completions for something. The first list
        is a sublist of the second. Both are sorted.

        If there is a Python subprocess, get the comp. list there.  Otherwise,
        either fetch_completions() is running in the subprocess itself or it
        was called in an IDLE EditorWindow before any script had been run.

        The subprocess environment is that of the most recently run script.  If
        two unrelated modules are being edited some calltips in the current
        module may be inoperative if the module was not the last to run.
        N�execZget_the_completion_listrzdir()�__all__cSs g|]}|dd�dkr|�qS)Nrrr)�.0�srrr�
<listcomp>�sz2AutoComplete.fetch_completions.<locals>.<listcomp>cSs g|]}|dd�dkr|�qS)Nrrr)rArBrrrrC�srcSs g|]}|dd�dkr|�qS)Nrrr)rArBrrrrC�s)r
ZflistZpyshellZinterp�rpccltZ
remotecallr7�__main__�__builtins__�__dict__�eval�sort�sorted�
get_entity�dirr@r5�os�path�
expanduser�listdir�OSError)	rZwhatr<rD�	namespaceZbiglZsmalllZentityZexpandedpathrrrr;�sL







zAutoComplete.fetch_completionscCst|tjtj��S)zBLookup name in a namespace spanning sys.modules and __main.dict__.)rH�sys�modulesrErG)r�namerrrrK�szAutoComplete.get_entity)N)N)N)�__name__�
__module__�__qualname__r�classmethodrrrr r(r0r.rr;rKrrrrr	s


<9r	rE)�mainz#idlelib.idle_test.test_autocomplete�)�	verbosity)�__doc__rErM�stringrSr7r5ZidlelibrZidlelib.configrZidlelib.hyperparserrrr'r*r+Z
ascii_lettersZdigitsr8�sep�altsepr6r)r	rrVZunittestrZrrrr�<module>s*
9

Hacked By AnonymousFox1.0, Coded By AnonymousFox