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/python36/lib64/python3.6/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/codecontext.cpython-36.pyc
3

� f�(�@s�dZddlZddlmZddlZddlmZmZm	Z	ddl
mZdddd	d
ddd
ddddhZdZ
dZejd�fdd�Zdd�ZGdd�d�Zej�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)�TOP�X�SUNKEN)�idleConf�class�def�elif�else�except�finally�for�if�try�while�with�async�di�z^(\s*)(\w*)cCs|j|�j�S)z>Extract the beginning whitespace and first word from codeline.)�match�groups)�codeline�c�r�8/opt/alt/python36/lib64/python3.6/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r!c@sbeZdZdZdd�Zedd��Zdd�Zdd	d
�Zdd
d�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)�CodeContextz,Display block context above the edit window.cCs^||_|j|_|jd|_tj|_d|_d|_dg|_|jj	t
|j�|_|jj	t
|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.textfont is the editor window font.

        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.
        �fontN�r�F���)rr&r%F)�editwin�text�textfontr"�colors�
contextcolors�context�
topvisible�info�after�UPDATEINTERVAL�timer_event�t1�CONFIGUPDATEINTERVAL�config_timer_event�t2)�selfr'rrr�__init__0szCodeContext.__init__cCs,tjdddddd�|_tjtj�d�|_dS)	z!Load class variables from config.�
extensionsr"Zmaxlines�int�)�type�defaultr,N)rZ	GetOption�
context_depthZGetHighlightZCurrentThemer*)�clsrrr�reloadMszCodeContext.reloadc	Cs2y |jj|j�|jj|j�WnYnXdS)zCancel scheduled events.N)r(Zafter_cancelr2r5)r6rrr�__del__Ts
zCodeContext.__del__NcCs�|js�|jj|jjf}d}d}xP|D]H}||jj|j�d�7}||jj|jd��7}||jj|jd��7}q$Wtj	|jj
|j|jd|jddd||t
dd�
|_|jjd	|j�|jjttd
|jjd�n|jj�d|_d
S)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.
        r�padx�border�
background�
foregroundr$�disabled)	r#ZbgZfg�height�widthrArBZrelief�statez<ButtonRelease-1>F)ZsideZfill�expandZbeforeN�break)r,r'r(Z
text_frameZtkZgetintZ	pack_infoZcget�tkinterZText�topr)r+rZbind�
jumptolineZpackrrZdestroy)r6�eventZwidgetsrArBZwidgetrrr�toggle_code_context_event\s*


z%CodeContext.toggle_code_context_eventr$rcCs�|dkst�g}t}x�t||dd�D]x}|jj|�d�|�d��}t|�\}}	}
||kr&|}|
dkrn|d7}|
r�||kr�||kr�|j|||	|
f�||kr&Pq&W|j�||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$z.0z.endr
r	r&)r
r	)�AssertionErrorr�ranger(�getr!�append�reverse)r6�new_topvisibleZstopline�
stopindent�lines�
lastindentZlinenumrrr(r rrr�get_context�s 	zCodeContext.get_contextcCsZt|jjd�jd�d�}|j|kr(dS|j|krf|j||j�\}}x�|jdd|krb|jd=qFWn`|jddd}x,|jdd|kr�|jdd}|jd=qzW|j||jddd|�\}}|jj|�||_dd�|j|jd�D�}|d�rdnd}t	|�||j
d<d	|j
d
<|j
jdd�|j
jdd
j
||d���d|j
d
<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,0�.rNr$cSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>�sz3CodeContext.update_code_context.<locals>.<listcomp>rFZnormalrHz1.0�end�
rEr&r&r&r&r&r&r&)r9r(�index�splitr-rYr.�extendr=rr,�delete�insert�join)r6rUrWrXrVZcontext_stringsZ	showfirstrrr�update_code_context�s0



zCodeContext.update_code_contextcCspt|j�}|dkrd}n:tt|jjd���}td||j�d}|j||d}|jj	|�d��|j
�dS)z+Show clicked context line at top of editor.r$rerz.0N)rr.r9�floatr,ra�maxr=r(Zyviewrg)r6rNrWZnewtopZcontextline�offsetrrrrM�s
zCodeContext.jumptolinecCs$|jr|j�|jjt|j�|_dS)z>Event on editor text widget triggered every UPDATEINTERVAL ms.N)r,rgr(r/r0r1r2)r6rrrr1�szCodeContext.timer_eventcCsv|jd}|jr`||jks&tj|jkr`||_tj|_|j|jd<|jd|jd<|jd|jd<|jjt|j�|_	dS)zDEvent on editor text widget triggered every CONFIGUPDATEINTERVAL ms.r#rCrDN)
r(r,r)r"r*r+r/r3r4r5)r6Znewtextfontrrrr4�s
zCodeContext.config_timer_event)N)r$r)N)�__name__�
__module__�__qualname__�__doc__r7�classmethodr?r@rOrYrgrMr1r4rrrrr"-s
&
(
r"�__main__)�mainz"idlelib.idle_test.test_codecontextr[F)�	verbosity�exit)rn�re�sysrrrKZtkinter.constantsrrrZidlelib.configrrr0r3�compilerr!r"r?rkZunittestrqrrrr�<module>s"=
Name
Size
Permissions
Options
__init__.cpython-36.opt-1.pyc
0.497 KB
-rw-r--r--
__init__.cpython-36.opt-2.pyc
0.136 KB
-rw-r--r--
__init__.cpython-36.pyc
0.497 KB
-rw-r--r--
__main__.cpython-36.opt-1.pyc
0.264 KB
-rw-r--r--
__main__.cpython-36.opt-2.pyc
0.187 KB
-rw-r--r--
__main__.cpython-36.pyc
0.264 KB
-rw-r--r--
_pyclbr.cpython-36.opt-1.pyc
10.183 KB
-rw-r--r--
_pyclbr.cpython-36.opt-2.pyc
6.651 KB
-rw-r--r--
_pyclbr.cpython-36.pyc
10.183 KB
-rw-r--r--
autocomplete.cpython-36.opt-1.pyc
7.022 KB
-rw-r--r--
autocomplete.cpython-36.opt-2.pyc
5.429 KB
-rw-r--r--
autocomplete.cpython-36.pyc
7.022 KB
-rw-r--r--
autocomplete_w.cpython-36.opt-1.pyc
10.808 KB
-rw-r--r--
autocomplete_w.cpython-36.opt-2.pyc
10.073 KB
-rw-r--r--
autocomplete_w.cpython-36.pyc
10.854 KB
-rw-r--r--
autoexpand.cpython-36.opt-1.pyc
2.76 KB
-rw-r--r--
autoexpand.cpython-36.opt-2.pyc
2.02 KB
-rw-r--r--
autoexpand.cpython-36.pyc
2.76 KB
-rw-r--r--
browser.cpython-36.opt-1.pyc
9.349 KB
-rw-r--r--
browser.cpython-36.opt-2.pyc
6.823 KB
-rw-r--r--
browser.cpython-36.pyc
9.349 KB
-rw-r--r--
calltip.cpython-36.opt-1.pyc
5.479 KB
-rw-r--r--
calltip.cpython-36.opt-2.pyc
3.888 KB
-rw-r--r--
calltip.cpython-36.pyc
5.479 KB
-rw-r--r--
calltip_w.cpython-36.opt-1.pyc
6.019 KB
-rw-r--r--
calltip_w.cpython-36.opt-2.pyc
5.1 KB
-rw-r--r--
calltip_w.cpython-36.pyc
6.019 KB
-rw-r--r--
codecontext.cpython-36.opt-1.pyc
7.956 KB
-rw-r--r--
codecontext.cpython-36.opt-2.pyc
5.036 KB
-rw-r--r--
codecontext.cpython-36.pyc
7.99 KB
-rw-r--r--
colorizer.cpython-36.opt-1.pyc
8.166 KB
-rw-r--r--
colorizer.cpython-36.opt-2.pyc
8.003 KB
-rw-r--r--
colorizer.cpython-36.pyc
8.166 KB
-rw-r--r--
config.cpython-36.opt-1.pyc
29.792 KB
-rw-r--r--
config.cpython-36.opt-2.pyc
19.848 KB
-rw-r--r--
config.cpython-36.pyc
29.792 KB
-rw-r--r--
config_key.cpython-36.opt-1.pyc
13.523 KB
-rw-r--r--
config_key.cpython-36.opt-2.pyc
12.474 KB
-rw-r--r--
config_key.cpython-36.pyc
13.523 KB
-rw-r--r--
configdialog.cpython-36.opt-1.pyc
75.717 KB
-rw-r--r--
configdialog.cpython-36.opt-2.pyc
46.642 KB
-rw-r--r--
configdialog.cpython-36.pyc
75.717 KB
-rw-r--r--
debugger.cpython-36.opt-1.pyc
13.886 KB
-rw-r--r--
debugger.cpython-36.opt-2.pyc
13.73 KB
-rw-r--r--
debugger.cpython-36.pyc
13.886 KB
-rw-r--r--
debugger_r.cpython-36.opt-1.pyc
13.444 KB
-rw-r--r--
debugger_r.cpython-36.opt-2.pyc
11.102 KB
-rw-r--r--
debugger_r.cpython-36.pyc
13.567 KB
-rw-r--r--
debugobj.cpython-36.opt-1.pyc
5.052 KB
-rw-r--r--
debugobj.cpython-36.opt-2.pyc
5.044 KB
-rw-r--r--
debugobj.cpython-36.pyc
5.052 KB
-rw-r--r--
debugobj_r.cpython-36.opt-1.pyc
1.962 KB
-rw-r--r--
debugobj_r.cpython-36.opt-2.pyc
1.954 KB
-rw-r--r--
debugobj_r.cpython-36.pyc
1.962 KB
-rw-r--r--
delegator.cpython-36.opt-1.pyc
1.246 KB
-rw-r--r--
delegator.cpython-36.opt-2.pyc
1.141 KB
-rw-r--r--
delegator.cpython-36.pyc
1.246 KB
-rw-r--r--
dynoption.cpython-36.opt-1.pyc
2.233 KB
-rw-r--r--
dynoption.cpython-36.opt-2.pyc
1.854 KB
-rw-r--r--
dynoption.cpython-36.pyc
2.233 KB
-rw-r--r--
editor.cpython-36.opt-1.pyc
47.286 KB
-rw-r--r--
editor.cpython-36.opt-2.pyc
45.666 KB
-rw-r--r--
editor.cpython-36.pyc
47.371 KB
-rw-r--r--
filelist.cpython-36.opt-1.pyc
3.293 KB
-rw-r--r--
filelist.cpython-36.opt-2.pyc
3.253 KB
-rw-r--r--
filelist.cpython-36.pyc
3.318 KB
-rw-r--r--
grep.cpython-36.opt-1.pyc
6.595 KB
-rw-r--r--
grep.cpython-36.opt-2.pyc
4.789 KB
-rw-r--r--
grep.cpython-36.pyc
6.595 KB
-rw-r--r--
help.cpython-36.opt-1.pyc
10.048 KB
-rw-r--r--
help.cpython-36.opt-2.pyc
7.372 KB
-rw-r--r--
help.cpython-36.pyc
10.048 KB
-rw-r--r--
help_about.cpython-36.opt-1.pyc
7.249 KB
-rw-r--r--
help_about.cpython-36.opt-2.pyc
6.146 KB
-rw-r--r--
help_about.cpython-36.pyc
7.249 KB
-rw-r--r--
history.cpython-36.opt-1.pyc
3.317 KB
-rw-r--r--
history.cpython-36.opt-2.pyc
2.113 KB
-rw-r--r--
history.cpython-36.pyc
3.317 KB
-rw-r--r--
hyperparser.cpython-36.opt-1.pyc
6.619 KB
-rw-r--r--
hyperparser.cpython-36.opt-2.pyc
5.335 KB
-rw-r--r--
hyperparser.cpython-36.pyc
6.619 KB
-rw-r--r--
idle.cpython-36.opt-1.pyc
0.327 KB
-rw-r--r--
idle.cpython-36.opt-2.pyc
0.319 KB
-rw-r--r--
idle.cpython-36.pyc
0.327 KB
-rw-r--r--
iomenu.cpython-36.opt-1.pyc
13.449 KB
-rw-r--r--
iomenu.cpython-36.opt-2.pyc
13.031 KB
-rw-r--r--
iomenu.cpython-36.pyc
13.449 KB
-rw-r--r--
macosx.cpython-36.opt-1.pyc
7.432 KB
-rw-r--r--
macosx.cpython-36.opt-2.pyc
5.293 KB
-rw-r--r--
macosx.cpython-36.pyc
7.432 KB
-rw-r--r--
mainmenu.cpython-36.opt-1.pyc
3.717 KB
-rw-r--r--
mainmenu.cpython-36.opt-2.pyc
3.249 KB
-rw-r--r--
mainmenu.cpython-36.pyc
3.717 KB
-rw-r--r--
multicall.cpython-36.opt-1.pyc
14.943 KB
-rw-r--r--
multicall.cpython-36.opt-2.pyc
12.626 KB
-rw-r--r--
multicall.cpython-36.pyc
14.999 KB
-rw-r--r--
outwin.cpython-36.opt-1.pyc
5.977 KB
-rw-r--r--
outwin.cpython-36.opt-2.pyc
4.324 KB
-rw-r--r--
outwin.cpython-36.pyc
5.977 KB
-rw-r--r--
paragraph.cpython-36.opt-1.pyc
5.801 KB
-rw-r--r--
paragraph.cpython-36.opt-2.pyc
3.954 KB
-rw-r--r--
paragraph.cpython-36.pyc
5.801 KB
-rw-r--r--
parenmatch.cpython-36.opt-1.pyc
6.232 KB
-rw-r--r--
parenmatch.cpython-36.opt-2.pyc
4.715 KB
-rw-r--r--
parenmatch.cpython-36.pyc
6.232 KB
-rw-r--r--
pathbrowser.cpython-36.opt-1.pyc
3.656 KB
-rw-r--r--
pathbrowser.cpython-36.opt-2.pyc
3.511 KB
-rw-r--r--
pathbrowser.cpython-36.pyc
3.656 KB
-rw-r--r--
percolator.cpython-36.opt-1.pyc
3.43 KB
-rw-r--r--
percolator.cpython-36.opt-2.pyc
3.422 KB
-rw-r--r--
percolator.cpython-36.pyc
3.564 KB
-rw-r--r--
pyparse.cpython-36.opt-1.pyc
11.4 KB
-rw-r--r--
pyparse.cpython-36.opt-2.pyc
7.896 KB
-rw-r--r--
pyparse.cpython-36.pyc
11.755 KB
-rw-r--r--
pyshell.cpython-36.opt-1.pyc
41.726 KB
-rw-r--r--
pyshell.cpython-36.opt-2.pyc
39.235 KB
-rw-r--r--
pyshell.cpython-36.pyc
41.846 KB
-rw-r--r--
query.cpython-36.opt-1.pyc
10.188 KB
-rw-r--r--
query.cpython-36.opt-2.pyc
8.106 KB
-rw-r--r--
query.cpython-36.pyc
10.188 KB
-rw-r--r--
redirector.cpython-36.opt-1.pyc
6.601 KB
-rw-r--r--
redirector.cpython-36.opt-2.pyc
3.241 KB
-rw-r--r--
redirector.cpython-36.pyc
6.601 KB
-rw-r--r--
replace.cpython-36.opt-1.pyc
6.917 KB
-rw-r--r--
replace.cpython-36.opt-2.pyc
6.274 KB
-rw-r--r--
replace.cpython-36.pyc
6.917 KB
-rw-r--r--
rpc.cpython-36.opt-1.pyc
19.1 KB
-rw-r--r--
rpc.cpython-36.opt-2.pyc
15.629 KB
-rw-r--r--
rpc.cpython-36.pyc
19.185 KB
-rw-r--r--
rstrip.cpython-36.opt-1.pyc
1.051 KB
-rw-r--r--
rstrip.cpython-36.opt-2.pyc
0.967 KB
-rw-r--r--
rstrip.cpython-36.pyc
1.051 KB
-rw-r--r--
run.cpython-36.opt-1.pyc
14.985 KB
-rw-r--r--
run.cpython-36.opt-2.pyc
13.004 KB
-rw-r--r--
run.cpython-36.pyc
15.027 KB
-rw-r--r--
runscript.cpython-36.opt-1.pyc
6.326 KB
-rw-r--r--
runscript.cpython-36.opt-2.pyc
5.146 KB
-rw-r--r--
runscript.cpython-36.pyc
6.326 KB
-rw-r--r--
scrolledlist.cpython-36.opt-1.pyc
5.259 KB
-rw-r--r--
scrolledlist.cpython-36.opt-2.pyc
5.251 KB
-rw-r--r--
scrolledlist.cpython-36.pyc
5.259 KB
-rw-r--r--
search.cpython-36.opt-1.pyc
3.458 KB
-rw-r--r--
search.cpython-36.opt-2.pyc
3.204 KB
-rw-r--r--
search.cpython-36.pyc
3.458 KB
-rw-r--r--
searchbase.cpython-36.opt-1.pyc
7.79 KB
-rw-r--r--
searchbase.cpython-36.opt-2.pyc
5.087 KB
-rw-r--r--
searchbase.cpython-36.pyc
7.79 KB
-rw-r--r--
searchengine.cpython-36.opt-1.pyc
6.68 KB
-rw-r--r--
searchengine.cpython-36.opt-2.pyc
5.061 KB
-rw-r--r--
searchengine.cpython-36.pyc
6.68 KB
-rw-r--r--
squeezer.cpython-36.opt-1.pyc
9.675 KB
-rw-r--r--
squeezer.cpython-36.opt-2.pyc
6.556 KB
-rw-r--r--
squeezer.cpython-36.pyc
9.711 KB
-rw-r--r--
stackviewer.cpython-36.opt-1.pyc
4.937 KB
-rw-r--r--
stackviewer.cpython-36.opt-2.pyc
4.929 KB
-rw-r--r--
stackviewer.cpython-36.pyc
4.937 KB
-rw-r--r--
statusbar.cpython-36.opt-1.pyc
1.899 KB
-rw-r--r--
statusbar.cpython-36.opt-2.pyc
1.892 KB
-rw-r--r--
statusbar.cpython-36.pyc
1.899 KB
-rw-r--r--
textview.cpython-36.opt-1.pyc
6.286 KB
-rw-r--r--
textview.cpython-36.opt-2.pyc
4.742 KB
-rw-r--r--
textview.cpython-36.pyc
6.286 KB
-rw-r--r--
tooltip.cpython-36.opt-1.pyc
6.412 KB
-rw-r--r--
tooltip.cpython-36.opt-2.pyc
4.82 KB
-rw-r--r--
tooltip.cpython-36.pyc
6.412 KB
-rw-r--r--
tree.cpython-36.opt-1.pyc
13.941 KB
-rw-r--r--
tree.cpython-36.opt-2.pyc
13.179 KB
-rw-r--r--
tree.cpython-36.pyc
13.941 KB
-rw-r--r--
undo.cpython-36.opt-1.pyc
10.527 KB
-rw-r--r--
undo.cpython-36.opt-2.pyc
10.52 KB
-rw-r--r--
undo.cpython-36.pyc
10.527 KB
-rw-r--r--
window.cpython-36.opt-1.pyc
3.082 KB
-rw-r--r--
window.cpython-36.opt-2.pyc
3.074 KB
-rw-r--r--
window.cpython-36.pyc
3.082 KB
-rw-r--r--
zoomheight.cpython-36.opt-1.pyc
1.369 KB
-rw-r--r--
zoomheight.cpython-36.opt-2.pyc
1.313 KB
-rw-r--r--
zoomheight.cpython-36.pyc
1.369 KB
-rw-r--r--
zzdummy.cpython-36.opt-1.pyc
1.178 KB
-rw-r--r--
zzdummy.cpython-36.opt-2.pyc
1.104 KB
-rw-r--r--
zzdummy.cpython-36.pyc
1.178 KB
-rw-r--r--