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__/squeezer.cpython-37.pyc
B

� f(2�@s�dZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddd	�ZGd
d�dej�ZGdd
�d
�Ze��edkr�ddlmZedddd�dS)aAn IDLE extension to avoid having very long texts printed in the shell.

A common problem in IDLE's interactive shell is printing of large amounts of
text into the shell. This makes looking at the previous history difficult.
Worse, this can cause IDLE to become very slow, even to the point of being
completely unusable.

This extension will automatically replace long texts with a small button.
Double-clicking this button will remove it and insert the original text instead.
Middle-clicking will copy the text to the clipboard. Right-clicking will open
the text in a separate viewing window.

Additionally, any output can be manually "squeezed" by the user. This includes
output written to the standard error stream ("stderr"), such as exception
messages and their tracebacks.
�N)�idleConf)�	view_text)�Hovertip)�macosx�PcCs�d}d}d}d}x�t�d|�D]�}|��|}||7}||7}||dkrp||krb||d|7}|d7}d}n4||dks�t�||||7}||kr�|d7}|}|d7}qW|t|�|7}|dkr�||d|7}n|d8}|S)z�Count the number of lines in a given string.

    Lines are counted as if the string was wrapped so that lines are never over
    linewidth characters long.

    Tabs are considered tabwidth characters long.
    �r�z[\t\n]�
�	)�re�finditer�start�AssertionError�len)�sZ	linewidthZtabwidth�posZ	linecountZcurrent_column�m�numchars�r�5/opt/alt/python37/lib64/python3.7/idlelib/squeezer.py�count_lines_with_wrappings0rc@sJeZdZdZdd�Zdd�Zddd�Zdd	d
�Zddd�Zd
Z	dd�Z
dS)�ExpandingButtona�Class for the "squeezed" text buttons used by Squeezer

    These buttons are displayed inside a Tk Text widget in place of text. A
    user can then use the button to replace it with the original text, copy
    the original text to the clipboard or view the original text in a separate
    window.

    Each button is tied to a Squeezer instance, and it knows to update the
    Squeezer instance when it is expanded (and therefore removed).
    c
s��|_||_||_||_|j|_}|j|_}|jj|_|dkrFdnd}d|�d|�d�}t	j
j|||ddd	�d
}	t||	dd�|�
d
|j�t��r�|�
d|j�n|�
d|j�|��fdd��d|_|�|j�dS)Nr�lines�linezSqueezed text (� z).z#FFFFC0z#FFFFE0)�textZ
backgroundZactivebackgroundz5Double-click to expand, right-click for more options.r)Zhover_delayz<Double-Button-1>z
<Button-2>z
<Button-3>cs�t|�t|�t|��S)N)�int)�offset�length)rrr�<lambda>z�z*ExpandingButton.__init__.<locals>.<lambda>)r�tags�
numoflines�squeezer�editwinr�per�bottom�	base_text�tk�Button�__init__rZbind�expandrZisAquaTk�context_menu_eventZselection_handle�is_dangerousZ
after_idle�set_is_dangerous)
�selfrr!r"r#r$rZline_pluralityZbutton_textZbutton_tooltip_textr)rrr*_s*

zExpandingButton.__init__csLd|j���|jdkpDt|j�dkpDt�fdd�t�d|j�D��|_dS)N�2i�iP�c3s |]}t|�d���kVqdS)rN)r�group)�.0Z
line_match)�dangerous_line_lenrr�	<genexpr>�sz3ExpandingButton.set_is_dangerous.<locals>.<genexpr>z[^\n]+)	rZwinfo_widthr"rr�anyrrr-)r/r)r3rr.s

z ExpandingButton.set_is_dangerousNcCs�|jdkr|��|jrTtjdd�ddddg�|jt|j�ftj|j	d�}|sTd	S|j
�|j	�|�|j|j
�|j
�|�|jj�|�dS)
aAexpand event handler

        This inserts the original text in place of the button in the Text
        widget, removes the button and updates the Squeezer instance.

        If the original text is dangerously long, i.e. expanding it could
        cause a performance degradation, ask the user for confirmation.
        NzExpand huge output?z

z5The squeezed output is very long: %d lines, %d chars.z2Expanding it could make IDLE slow or unresponsive.z5It is recommended to view or copy the output instead.zReally expand?)�title�message�default�parent�break)r-r.�tkMessageBoxZaskokcancel�joinr"rrZCANCELrr'�insert�indexr!�deleter#�expandingbuttons�remove)r/�eventZconfirmrrrr+�s$	

zExpandingButton.expandcCs|��|�|j�dS)zMcopy event handler

        Copy the original text to the clipboard.
        N)Zclipboard_clearZclipboard_appendr)r/rBrrr�copy�szExpandingButton.copycCst|jd|jddd�dS)z]view event handler

        View the original text in a separate text viewer window.
        zSqueezed Output ViewerFZnone)ZmodalZwrapN)rrr)r/rBrrr�view�szExpandingButton.view))rCrC)rDrDcCsf|j�dd|j|jf�tj|jdd�}x&|jD]\}}|j|t||�d�q2W|�	|j
|j�dS)Nr=z@%d,%dr)Ztearoff)�labelZcommandr:)rZmark_set�x�yr(ZMenu�rmenu_specsZadd_command�getattrZtk_popupZx_rootZy_root)r/rBZrmenurEZmethod_namerrrr,�sz"ExpandingButton.context_menu_event)N)N)N)�__name__�
__module__�__qualname__�__doc__r*r.r+rCrDrHr,rrrrrTs
 



rc@s4eZdZdZedd��Zdd�Zdd�Zdd	�Zd
S)�Squeezerz�Replace long outputs in the shell with a simple button.

    This avoids IDLE's shell slowing down considerably, and even becoming
    completely unresponsive, when very long outputs are written.
    cCstjdddddd�|_dS)z!Load class variables from config.�mainZPyShellzauto-squeeze-min-linesrr0)�typer8N)rZ	GetOption�auto_squeeze_min_lines)�clsrrr�reload�szSqueezer.reloadcsd|�_|j�_�|jj�_dt��d��t��d���_g�_d|j	f��fdd�	}||_	dS)aeInitialize settings for Squeezer.

        editwin is the shell's Editor window.
        self.text is the editor window text widget.
        self.base_test is the actual editor window Tk text widget, rather than
            EditorWindow's wrapper.
        self.expandingbuttons is the list of all buttons representing
            "squeezed" output.
        �Zborder�padxrcs�|dkr|||�S�j}t|�|kr.|||�S��|�}||krJ|||�St|||��}��dtj��jd|ddd���d���	���dtj
��j�|�dS)N�stdoutZiomark��)�windowrU�pady)
rQr�count_linesrZmark_gravityr(ZRIGHT�
window_createZsee�updateZLEFTr@�append)rr!�writerQr"�expandingbutton)r/rrr�mywrite�s 





z"Squeezer.__init__.<locals>.mywriteN)
r$rr%r&r'rZcgetZwindow_width_deltar@r_)r/r$rar)r/rrr*�s

zSqueezer.__init__cCst||jj�S)abCount the number of lines in a given text.

        Before calculation, the tab width and line length of the text are
        fetched, so that up-to-date values are used.

        Lines are counted as if the string was wrapped so that lines are never
        over linewidth characters long.

        Tabs are considered tabwidth characters long.
        )rr$�width)r/rrrrr[szSqueezer.count_linesc
Cs|j�tj�}x$dD]}||krPqW|j��dS|j�|tjd�\}}|j�||�}t|�dkr�|ddkr�|j�d|�}|dd�}|j	�
||�|�|�}t||||�}|jj
||d	d
d�t|j�}	x2|	dk�r|j�|j|	dd
|��r|	d8}	q�W|j�|	|�dS)z�squeeze-current-text event handler

        Squeeze the block of text inside which contains the "insert" cursor.

        If the insert cursor is not in a squeezable block of text, give the
        user a small warning and do nothing.
        )rV�stderrr:z+1cr���r	z%s-1cNrWrX)rYrUrZr�>)r�	tag_namesr(ZINSERTZbellZ
tag_prevrange�getrr>r'r?r[rr\r@Zcomparer=)
r/rBrfZtag_namer
�endrr"r`�irrr�squeeze_current_text_event s,	






z#Squeezer.squeeze_current_text_eventN)	rJrKrLrM�classmethodrSr*r[rjrrrrrN�s
?
rN�__main__)rOzidlelib.idle_test.test_squeezerrTF)�	verbosity�exit)r)rMrZtkinterr(Ztkinter.messageboxZ
messageboxr;Zidlelib.configrZidlelib.textviewrZidlelib.tooltiprZidlelibrrr)rrNrSrJZunittestrOrrrr�<module>s
8r

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--