CyberAlphaWolf

Server : Apache
System : Linux 182.49.167.72.host.secureserver.net 4.18.0-553.92.1.el8_10.x86_64 #1 SMP Wed Jan 14 06:31:58 EST 2026 x86_64
User : kikai ( 1014)
PHP Version : 8.3.30
Disable Function : NONE
Directory :  /opt/python38/lib/python3.8/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/python38/lib/python3.8/idlelib/__pycache__/codecontext.cpython-38.opt-2.pyc
U

�i�_>,�@s�ddlZddlmZddlZddlmZmZddlm	Z	ddddd	d
ddd
dddhZ
e�d�fdd�Zdd�Z
Gdd�d�Ze��edkr�ddlmZedddd�dS)�N)�maxsize)�NSEW�SUNKEN)�idleConf�class�def�if�elif�else�while�for�try�except�finally�with�asyncz^(\s*)(\w*)cCs|�|���S�N)�match�groups)�codeline�c�r�2/opt/python38/lib/python3.8/idlelib/codecontext.py�get_spaces_firstwordsrcCsFt|�\}}t|�}t|�|ks,||dkr0t}|tko:|}|||fS)N�#)r�len�INFINITY�BLOCKOPENERS)rZspacesZ	firstword�indent�openerrrr�
get_line_infosr c@sreZdZdZdd�Zdd�Zedd��Zdd	�Zddd�Z	ddd�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd
S)�CodeContext�dcCs||_|j|_|��dSr)�editwin�text�_reset)�selfr#rrr�__init__.szCodeContext.__init__cCs$d|_d|_d|_d|_dg|_dS)N�)r����F)�context�cell00�t1�
topvisible�info�r&rrrr%Cs
zCodeContext._resetcCstjdddddd�|_dS)N�
extensionsr!Zmaxlines�int�)�type�default)rZ	GetOption�
context_depth)�clsrrr�reloadJs
�zCodeContext.reloadcCs>|jdk	r:z|j�|j�Wntjk
r2YnXd|_dSr)r-r$�after_cancel�tkinter�TclErrorr0rrr�__del__Qs
zCodeContext.__del__Nc

Csz|jdk�r$|jj|jjf}d}d}|D]`}||jjkr@|��n|��}||j�|d�7}||j�|�d��7}||j�|�d��7}q(t	j
|jjddd||tdd�}|_|��|�
�|�d|j�|��|jddtd�t�t��d	�}t	j|jj|d
d�|_|jjddtd�d}	n:|j��d|_|j��d|_|j�|j�|��d
}	|jjdd|	�d�d�dS)Nr�padx�borderr(�disabled)�height�widthZhighlightthicknessr=r>Zrelief�statez<ButtonRelease-1>)�row�columnZsticky�
linenumber�
background��bgZHideZShow�optionsz* Code Contextz
 Code Context)Zmenu�indexZlabel�break)r+r#r$Z
text_frameZ	grid_infoZ	pack_infoZtkZgetintZcgetr:ZTextr�update_font�update_highlight_colors�bind�
jumptoline�timer_eventZgridrr�GetHighlight�CurrentThemeZFramer,Zdestroyr9r-r%Zupdate_menu_label)
r&�eventZwidgetsr=r>Zwidgetr/r+�line_number_colorsZmenu_statusrrr�toggle_code_context_eventZs\
�
��
�
�


�z%CodeContext.toggle_code_context_eventr(rcCs�g}t}t||dd�D]z}|j�|�d�|�d��}t|�\}}	}
||kr|}|
dkr`|d7}|
r�||kr�||kr�|�|||	|
f�||krq�q|��||fS)Nr(r)�.0z.end)r
r	)r�ranger$�getr �append�reverse)r&�new_topvisibleZstopline�
stopindent�lines�
lastindentZlinenumrrr$rrrr�get_context�s
zCodeContext.get_contextcCsB|j�d�}|j|krdS|j|krT|�||j�\}}|jdd|kr�|jd=q6n\|jddd}|jdd|kr�|jdd}|jd=qf|�||jddd|�\}}|j�|�||_dd�|j|jd�D�}|dr�dnd}t|�||jd<d|jd	<|j�	d
d�|j�
dd�||d���d
|jd	<dS)Nz@0,0r)r(rcSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>�sz3CodeContext.update_code_context.<locals>.<listcomp>r@ZnormalrBz1.0�end�
r?)r#Z	getlinenor.r_r/�extendr6rr+�delete�insert�join)r&r[r]r^r\Zcontext_stringsZ	showfirstrrr�update_code_context�s4

�
�
zCodeContext.update_code_contextcCs�z|j�d�Wn�tjk
r�t|j�}|dkr:d}n:tt|j�d���}td||j	�d}|j||d}|j
�|�d��|��YnXdS)Nz	sel.firstr(rhrrV)
r+rJr:r;rr/r2�float�maxr6r$Zyviewrj)r&rSr]ZnewtopZcontextline�offsetrrrrO�s
zCodeContext.jumptolinecCs*|jdk	r&|��|j�|j|j�|_dSr)r+rjr$Zafter�UPDATEINTERVALrPr-r0rrrrP�s
zCodeContext.timer_eventcCs(|jdk	r$t�|jdd�}||jd<dS)N�mainZEditorWindow�font)r+rZGetFontr$)r&rprrrrL�s
zCodeContext.update_fontcCsf|jdk	r6t�t��d�}|d|jd<|d|jd<|jdk	rbt�t��d�}|jj|dd�dS)Nr+rFZ
foregroundrErG)r+rrQrRr,Zconfig)r&ZcolorsrTrrrrM�s


�z#CodeContext.update_highlight_colors)N)r(r)N)�__name__�
__module__�__qualname__rnr'r%�classmethodr8r<rUr_rjrOrPrLrMrrrrr!*s
	
8
(
r!�__main__)roz"idlelib.idle_test.test_codecontextr`F)�	verbosity�exit)�re�sysrrr:Ztkinter.constantsrrZidlelib.configrr�compilerr r!r8rqZunittestrorrrr�<module>s&�[

XYZEAZ - Cyber Alpha Wolf © All Rights Reserved