Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/idlelib/__pycache__/parenmatch.cpython-310.opt-2.pyc

o

0�i$�@sh	ddlmZddlmZdddd�ZdZGdd	�d	�Ze��ed
kr2ddl	m
Z
e
dd
d�dSdS)�)�HyperParser)�idleConf�(�[�{��)�]�}�dc@s�eZdZ	dZdZdd�Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zd!dd�Z
dd�Zdd�Zdd�Zdd�Zeeeed�Zdd�Zdd �ZdS)"�
ParenMatchz<<parenmatch-check-restore>>)z
<KeyPress>z
<ButtonPress>z<Key-Return>z<Key-BackSpace>cCs0||_|j|_|j�|j|j�d|_d|_dS)Nr)�editwin�textZbind�RESTORE_VIRTUAL_EVENT_NAME�
restore_event�counter�is_restore_active)�selfr
�r�9/opt/alt/python310/lib64/python3.10/idlelib/parenmatch.py�__init__(s
�
zParenMatch.__init__cCsVtjddddd�|_tjdddddd	�|_tjddd
ddd	�|_t�t��d
�|_dS)N�
extensionsrZstyle�opener)�defaultzflash-delay�inti�)�typer�bell�bool�Zhilite)rZ	GetOption�STYLE�FLASH_DELAY�BELLZGetHighlightZCurrentTheme�
HILITE_CONFIG)�clsrrr�reload3s�
�
�

�zParenMatch.reloadcCs2	|js|jD]
}|j�|j|�qd|_dSdS)NT)r�RESTORE_SEQUENCESrZ	event_addr�r�seqrrr�activate_restore>�

�zParenMatch.activate_restorecCs2	|jr|jD]
}|j�|j|�qd|_dSdS)NF)rr%rZevent_deleterr&rrr�deactivate_restoreEr)zParenMatch.deactivate_restorecCs 	t|jd���}|�|�dS)N�insert�break)rr
�get_surrounding_brackets�finish_paren_event)r�event�indicesrrr�flash_paren_eventLs
�
zParenMatch.flash_paren_eventcCsP	|j�d�}|tvr
dSt|jd�}|��sdS|�t|d�}|�|�dS)Nz	insert-1cT)r�get�_openersrr
Z
is_in_coder-r.)rr/ZcloserZhpr0rrr�paren_closed_eventSs
zParenMatch.paren_closed_eventcCsZ|dur|jr|j��dS|��|j�|j|j�||�|jr'|j	�dS|j
�dS�N)r!rrr(�tagfuncsr2r�create_tag_expressionr �set_timeout_last�set_timeout_none�rr0rrrr.`s
�zParenMatch.finish_paren_eventNcCs(	|j�d�|��|jd7_dS)N�parenr)rZ
tag_deleter*r)rr/rrrrkszParenMatch.restore_eventcCs||jkr|��dSdSr5)rr)rZtimer_countrrr�handle_restore_timerqs
�zParenMatch.handle_restore_timercCs(	|j�d|d�|j�d|j�dS)Nr;r)r�tag_add�
tag_configr"r:rrr�create_tag_openerxszParenMatch.create_tag_openercCsd	|j�|d�dvr|dd}n|d}|j�d|d|dd|d|�|j�d|j�dS)Nrr�+1cr;rz-1c�rr2r=r>r"�rr0Z
rightindexrrr�create_tag_parens}s$zParenMatch.create_tag_parenscCsT	|j�|d�dvr|dd}n|d}|j�d|d|�|j�d|j�dS)Nrrr@r;rrArBrrrr7�sz ParenMatch.create_tag_expression)rrZparensZ
expressioncCs@	|jd7_||j|j�d�fdd�}|jj�t||�dS)Nrr+cSs4||j�d�kr|�|�dS|jj�t||�dS)Nr+)r�indexr<r
�
text_frame�after�CHECK_DELAY)�callmer�crDrrrrH�sz+ParenMatch.set_timeout_none.<locals>.callme)rrrDr
rErFrG)rrHrrrr9�s

�zParenMatch.set_timeout_nonecCs2	|jd7_|jj�|j||jfdd��dS)NrcSs
|�|�Sr5)r<)rrIrrr�<lambda>�s
z-ParenMatch.set_timeout_last.<locals>.<lambda>)rr
rErFr )rrrrr8�s�zParenMatch.set_timeout_lastr5)�__name__�
__module__�__qualname__rr%r�classmethodr$r(r*r1r4r.rr<r?rCr7r6r9r8rrrrr
s0


	
�
r�__main__)�mainz!idlelib.idle_test.test_parenmatch�)�	verbosityN)Zidlelib.hyperparserrZidlelib.configrr3rGrr$rKZunittestrPrrrr�<module>s&�