Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.10/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.10/idlelib/__pycache__/query.cpython-310.pyc
o

�9j�:�@s6dZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
mZmZddlmZmZmZmZmZddl	mZddlmZddlmZGd	d
�d
e
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�Z e!dkr�ddl"m#Z#e#dddd�ddl$m%Z%e%eee �dSdS)a|
Dialogs that query users and verify the answer before accepting.

Query is the generic base class for a popup dialog.
The user must either enter a valid answer or close the dialog.
Entries are validated when <Return> is entered or [Ok] is clicked.
Entries are ignored when [Cancel] or [X] are clicked.
The 'return value' is .result set to either a valid answer or None.

Subclass SectionName gets a name for a new config file section.
Configdialog uses it for new highlight theme and keybinding set names.
Subclass ModuleName gets a name for File => Open Module.
Subclass HelpSource gets menu item and path for additions to Help menu.
�N)�
executable�platform)�Toplevel�	StringVar�
BooleanVar�W�E�S)�Frame�Button�Entry�Label�Checkbutton)�
filedialog)�Font)�
_setup_dialogcsleZdZdZdiddd�dd�Zddd	�Zd
d�Zdd
d�Zdd�Zddd�Z	ddd�Z
�fdd�Z�ZS)�QueryzoBase class for getting verified answer from a user.

    For this base class, accept any non-blank string.
    �F��text0�
used_names�_htest�_utestcCs:||_||_||_||_t�||�|��|�|�|�|�|s&|�	�t
|�|jdkr6|�d|j
�|�d|j
�|�d|j
�|�d|j�|�d|j�|��|��|�d|��|��d|��d|��|s}|��d|��dnd	f�|jd
d
d�|s�|��|j��|��dSdS)
a�Create modal popup, return when destroyed.

        Additional subclass init must be done before this unless
        _utest=True is passed to suppress wait_window().

        title - string, title of popup dialog
        message - string, informational message to display
        text0 - initial value for entry
        used_names - names already in use
        _htest - bool, change box location when running htest
        _utest - bool, leave window hidden and not modal
        �aquaz<Command-.>z<Key-Escape>�WM_DELETE_WINDOWz<Key-Return>z
<KP_Enter>z+%d+%d��F)�height�widthN)�parent�messagerrr�__init__�withdraw�title�	transient�grab_setr�_windowingsystem�bind�cancel�protocol�ok�create_widgets�update_idletasks�geometry�winfo_rootx�winfo_width�winfo_reqwidth�winfo_rooty�winfo_height�winfo_reqheight�	resizable�	deiconify�entry�	focus_set�wait_window)�selfrr#r rrrr�r:�$/usr/lib/python3.10/idlelib/query.pyr!&sJ


�����
�zQuery.__init__�OKcCs,t|dd�|_}|jdddd�|jddd�t|dd	|jd
�}t||j�|_t	|d|jd�|_
td
d|jd�|_
t|dd|j
d�|_|jddddtd�|j
jddddttddgd�|jjddddttd�|��t||d|jd�|_t|d|jd�|_|jjdddd�|jjdddd�dS)z�Create entry (rows, extras, buttons.

        Entry stuff on rows 0-2, spanning cols 0-2.
        Buttons on row 99, cols 1, 2.
        �
)�paddingr�news)�column�row�sticky�)�weight�w�left��anchor�justify�text�)r�textvariable�
TkCaptionFontT)�name�exists�root� �red�rJ�
foreground�font���r@rA�
columnspan�padxrB�r@rArYrZrB�padyr�active)rJ�default�command�Cancel)rJr_�c)r@rArZN)r
�frame�grid�grid_columnconfigurer
r rr�entryvarrr6rr�
error_font�entry_errorrr�create_extrarr*�	button_okr(�
button_cancel)r9�ok_textrb�
entrylabelr:r:r;r+Ys<�����
��zQuery.create_widgetscCsdS�Nr:�r9r:r:r;rh}szQuery.create_extraNcCsd||p|jd<dS)NzERROR: rJ)rg)r9r �widgetr:r:r;�	showerrorszQuery.showerrorcCs$|j����}|s|�d�dS|S)zReturn non-blank entry or None.zblank line.N)r6�get�striprp)r9r6r:r:r;�entry_ok�s

zQuery.entry_okcCs:d|jd<|��}|dur||_|��dS|j��dS)z�If entry is valid, bind it to 'result' and destroy tk widget.

        Otherwise leave dialog open for user to correct entry or cancel.
        rrJN)rgrs�result�destroyr6r7)r9�eventr6r:r:r;r*�s
zQuery.okcCsd|_|��dS)z0Set dialog result to None and destroy tk widget.N)rtru)r9rvr:r:r;r(�szQuery.cancelcs|��t���dSrm)�grab_release�superrurn��	__class__r:r;ru�sz
Query.destroy)r<rm)
�__name__�
__module__�__qualname__�__doc__r!r+rhrprsr*r(ru�
__classcell__r:r:ryr;r!s�
3$


rc�0eZdZdZddd��fdd�
Zdd�Z�ZS)�SectionNamez*Get a name for a config file section name.F�rrc�t�j||||||d�dS)N)rrr�rxr!)r9rr#r rrrryr:r;r!��
�zSectionName.__init__cCsV|j����}|s|�d�dSt|�dkr|�d�dS||jvr)|�d�dS|S)z2Return sensible ConfigParser section name or None.�no name specified.NrKz"name is longer than 30 characters.zname is already in use.)r6rqrrrp�lenr)r9rNr:r:r;rs�s



zSectionName.entry_ok�r{r|r}r~r!rsrr:r:ryr;r���
�r�cr�)�
ModuleNamez-Get a module name for Open Module menu entry.Fr�cr�)N�rrrr�)r9rr#r rrrryr:r;r!�r�zModuleName.__init__cCs|j����}|s|�d�dSztj�|�}Wnttfy4}z|�t	|��WYd}~dSd}~ww|dur@|�d�dSt
|jtjj
�sO|�d�dSz	|j�|�}W|Styg|�d�YdSty�z	|j��}WY|Sty�|�d�YYdSww)z0Return entered module name as file path or None.r�Nzmodule not found.znot a source-based module.z%loader does not support get_filename.zloader failed to get filename.)r6rqrrrp�	importlib�util�	find_spec�
ValueError�ImportError�str�
isinstance�loader�abc�SourceLoader�get_filename�AttributeError�	TypeError)r9rN�spec�msg�	file_pathr:r:r;rs�s@
��

�
�
��zModuleName.entry_okr�r:r:ryr;r��r�r�c@seZdZdZdd�ZdS)�Gotoz1Get a positive line number for editor Go To Line.cCsLz	t|j���}Wnty|�d�YdSw|dkr$|�d�dS|S)Nznot a base 10 integer.rznot a positive integer.)�intr6rqr�rp)r9�linenor:r:r;rs�s
�
z
Goto.entry_okN)r{r|r}r~rsr:r:r:r;r��sr�cs\eZdZdZddiddd��fdd�
Zdd�Zd	d
�Zdd�Zej	Z
d
d�Zdd�Z	�ZS)�
HelpSourcez,Get menu name and help source for Help menu.rF)�menuitem�filepathrrrc		s(||_d}t�j|||||||d�dS)z�Get menu entry and url/local file for Additional Help.

        User enters a name for the Help resource and a web url or file
        name. The user can browse for the file.
        zName for item on Help menu:rN)r�rxr!)	r9rr#r�r�rrrr ryr:r;r!�s
�zHelpSource.__init__cCs�|j}t|dddd�}t||j�|_t||jdd�|_t|dd|jd	�}t|d
d|j	d�|_
|jd
ddddd
gtd�|jjd
dddtt
dd
gd�|jdddttd�|j
jd
dddtt
d�dS)zAdd path widjets to rows 10-12.rErFz,Help File Path: Enter URL or browse for filerG�()rLr�Browse�)rJrr_rQrRrSrr=rVrW)r@rArYrZr\rB�rr[)r@rArZrB�rXN)rbr
rr��pathvarr�pathr�browse_filerf�
path_errorrcrrr	)r9rb�	pathlabel�browser:r:r;rhs,�����
�zHelpSource.create_extracCstj||d�j||d�S)N)r�	filetypes)�
initialdir�initialfile)r�Open�show)r9r��initdir�initfiler:r:r;�askfilenames�zHelpSource.askfilenamecCs�gd�}|j��}|rtj�|�\}}n$d}tdd�dkr4tj�tj�t�d�}tj�	|�s3t�
�}nt�
�}|�|||�}|rI|j�|�dSdS)N))z
HTML Filesz*.htm *.html�TEXT)z	PDF Filesz*.pdfr�)zWindows Help Filesz*.chm)z
Text Filesz*.txtr�)z	All Files�*rV�win�Doc)
r�rq�osr��splitr�join�dirnamer�isdir�getcwdr��set)r9r�r��dir�base�filer:r:r;r�!s
��zHelpSource.browse_filecCs||j����}|s|�d|j�dS|�d�s<|dd�dkr%|dd�}tj�|�s4|�d|j�dStdkr<d|}|S)	z(Simple validity check for menu file pathzno help file path specified.N)zwww.�httprWzfile:zhelp file path does not exist.�darwinzfile://)	r�rqrrrpr��
startswithr�rOr)r9r�r:r:r;�path_ok9s
�zHelpSource.path_okcCs6d|jd<|��}|��}|dus|durdS||fS)z,Return apparently valid (name, path) or NonerrJN)r��item_okr�)r9rNr�r:r:r;rsJs
zHelpSource.entry_ok)
r{r|r}r~r!rhr�r�r�rsr�r�rr:r:ryr;r��s�
r�csBeZdZdZgddd��fdd�
Zdd�Zdd	�Zd
d�Z�ZS)�	CustomRunz�Get settings for custom run of module.

    1. Command line arguments to extend sys.argv.
    2. Whether to restart Shell or not.
    F)�cli_argsrrcs d}t�j||||||d�dS)z�cli_args is a list of strings.

        The list is assigned to the default Entry StringVar.
        The strings are displayed joined by ' ' for display.
        z$Command Line Arguments for sys.argv:r�Nr�)r9rr#r�rrr ryr:r;r!Ys

�zCustomRun.__init__cCsj|j}t|dd�|_t||jdddd�}t|dd|jd�|_|jd	d
ddd
d�|jjd	ddddd�dS)zAdd run mode on rows 10-12.T)�valueFz
Restart shell)�variable�onvalue�offvaluerJrQrRrSrr=rVrWrErXr��weN)rbr�
restartvarrr
rf�
args_errorrc)r9rb�restartr:r:r;rhes
��
�zCustomRun.create_extrac
CsX|j����}z
tj|dd�}W|Sty+}z|�t|��WYd}~dSd}~ww)z6Validity check and parsing for command line arguments.T)�posixN)r6rqrr�shlexr�r�rpr�)r9�
cli_stringr��errr:r:r;�cli_args_okrs���zCustomRun.cli_args_okcCs&|��}|j��}|durdS||fS)z4Return apparently valid (cli_args, restart) or None.N)r�r�rq)r9r�r�r:r:r;rs|s
zCustomRun.entry_ok)	r{r|r}r~r!rhr�rsrr:r:ryr;r�Qs�

r��__main__)�mainzidlelib.idle_test.test_queryrF)�	verbosity�exit)�run)&r~�importlib.utilr��
importlib.abcr�r��sysrr�tkinterrrrrrr	�tkinter.ttkr
rrr
rr�tkinter.fontr�tkinter.simpledialogrrr�r�r�r�r�r{�unittestr��idlelib.idle_test.htestr�r:r:r:r;�<module>s. *\2�

Youez - 2016 - github.com/yon3zu
LinuXploit