Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/idlelib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/idlelib/__pycache__/pyshell.cpython-38.pyc
U

@��gZ��
@s�ddlZedkr ejdejd<zddlTWn*ek
rVedejd�ed��YnXejdkr�z ddl	Z	dZ
e	�d	��e
�Wnee
efk
r�YnXdd
lmZedkr�e�at��ddlmZet�ejd
detd�ed��ddlmZddlZddlZddlZddlmZddlZddlZddlZddl m!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl*m,Z,ddl-m.Z.m/Z/ddl0m1Z1ddl2m3Z3ddl*m4Z4ddlm5Z5m6Z6m7Z7ddl8m9Z9dZ:dZ;eja<d;dd�Z=da>d d!�Z?e?d"�dej@fd#d$�ZAeAe_@Gd%d&�d&e.�ZBGd'd(�d(e1�ZCGd)d*�d*e'�ZDGd+d,�d,e9�ZEGd-d.�d.e4jF�ZGd/d0�ZHGd1d2�d2e�ZIGd3d4�d4e3�ZJd5d6�ZKd7ZLd8d9�ZMedk�r�eM�e?d:�dS)<�N�__main__zidlelib.pyshell)�*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **��file��win32Zshcore)�
messageboxg!@��fix_scalingzIdle Cannot Startz"Idle requires tcl/tk 8.5+, not %s.��parent)�InteractiveInterpreter)�python_version)�TextWrapper)�ColorDelegator)�idleConf��debugger)�
debugger_r)�EditorWindow�
fixwordbreaks)�FileList)�OutputWindow)�rpc)�idle_formatwarning�StdInputFile�
StdOutputFile)�
UndoDelegatorz	127.0.0.1c	CsP|dkrt}z&|�t|||||d��|�d�Wnttfk
rJYnXdS)aShow Idle-format warning (after replacing warnings.showwarning).

    The differences are the formatter called, the file=None replacement,
    which can be None, the capture of the consequence AttributeError,
    and the output of a hard-coded prompt.
    N)�line�>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorr�r(�./opt/cppython/lib/python3.8/idlelib/pyshell.py�idle_showwarningEs�r*cCs0|rtdkr,tjatt_ntdk	r,tt_dadS)z>Replace warning.showwarning with idle_showwarning, or reverse.N)�_warnings_showwarning�warnings�showwarningr*)�capturer(r(r)�capture_warningsXsr/TcCsXtj}i}t|�D].}|dd�|dd�dkr|�|�||<q||�|�|�dS)aoExtend linecache.checkcache to preserve the <pyshell#...> entries

    Rather than repeating the linecache code, patch it to save the
    <pyshell#...> entries, call the original linecache.checkcache()
    (skipping them), and then restore the saved entries.

    orig_checkcache is bound at definition time to the original
    method, allowing it to be patched.
    Nr����<>)�	linecache�cache�list�pop�update)r&Zorig_checkcacher3�save�keyr(r(r)�extended_linecache_checkcachegsr9c@s~eZdZdZdd�Zdddddd	gZd dd�Zd
d�Zd!dd�Zd"dd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)#�PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointscGs�g|_tj|f|��|j�d|j�|j�d|j�|j�d|jj�t	j
�tj
d�|_|jj|fdd�}|j�|�|jjr�|��|��dS)N�<<set-breakpoint-here>>�<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|��|�dS�N)�restore_file_breaks)Zold_hook�selfr(r(r)�filename_changed_hook�sz;PyShellEditorWindow.__init__.<locals>.filename_changed_hook)�breakpointsr�__init__�text�bind�set_breakpoint_here�clear_breakpoint_here�flist�
open_shell�os�path�joinrZuserdir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookr&r>�color_breakpoint_text)r?�argsr@r(r(r)rB�s ��
zPyShellEditorWindow.__init__)ZCutz<<cut>>�rmenu_check_cut)ZCopyz<<copy>>Zrmenu_check_copy)ZPastez	<<paste>>�rmenu_check_paste)NNN)zSet Breakpointr;N)zClear Breakpointr<NTcCsD|jdkrdS|r(t��}t�|d�}n
ddd�}|j�d|�dS)z,Turn colorizing of breakpoint text on or offN�break�)�
foreground�
background�BREAK)rMr�CurrentTheme�GetHighlightrCZ
tag_config)r?Zcolor�themeZcfgr(r(r)rN�s

z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|�dd|d|d�z|j�|�Wn tk
rX|j�|�YnXz|jj	j
j}|�||�WnYnXdS)NrVz%d.0r)
rCrMr&�tag_addrA�index�
ValueError�appendrG�pyshell�interprrE)r?r'rCr&�debugr(r(r)�set_breakpoint�sz"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|��dStt|�d���}|�|�dS)N�insert)rCrMr&�bell�int�floatr[ra)r?�eventrCr&r'r(r(r)rE�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|��dStt|�d���}z|j�|�WnYnX|�	ddd�z|j
jjj
}|�||�WnYnXdS)NrbrV�insert linestartzinsert lineend +1char)rCrMr&rcrdrer[rA�remove�
tag_removerGr^r_rrF)r?rfrCr&r'r`r(r(r)rF�s$�z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$|��dSg|_|�ddt�z|jjj	j
}|�|�WnYnXdS)NrV�1.0)rArCrMr&rcriZENDrGr^r_r�clear_file_breaks)r?rCr&r`r(r(r)rk�sz%PyShellEditorWindow.clear_file_breaksc
Cs|j}|jj}z$t|jd��}|��}W5QRXWntk
rJg}YnXzjt|jd��T}|D]}|�|d�s`|�|�q`|�	�|j}|r�|�|dt
|�d�W5QRXWnTtk
�r
}z4t|jdd�s�d|j_
tjdd	t
|�|jd
�W5d}~XYnXdS)z#Save breakpoints when file is saved�r�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titler$rN)rArMr&�openrL�	readlinesr#�
startswithr!�update_breakpoints�str�getattr�rootrpr�	showerrorrC)r?Zbreaksr&�fp�linesZnew_filer�errr(r(r)�store_file_breaks�s2
(��z%PyShellEditorWindow.store_file_breaksc	Cs�|j��|jdkrdS|jj}|dkr,dStj�|j�r�t|jd��}|�	�}W5QRX|D]>}|�
|d�r^t|t|�dd��}|D]}|�
|�q�q^dS)Nrlrnr)rCr6rMr&rIrJ�isfilerLrrrsrt�eval�lenra)r?r&rzr{rZbreakpoint_linenumbersZbreakpoint_linenumberr(r(r)r>
s

z'PyShellEditorWindow.restore_file_breakscCs$|j}|�d�}|�|�}||_dS)z3Retrieves all the breakpoints in the current windowrVN)rCZ
tag_ranges�ranges_to_linenumbersrA)r?rC�rangesZlinenumber_listr(r(r)rus

z&PyShellEditorWindow.update_breakpointscCsbg}tdt|�d�D]H}tt||j��}tt||dj��}||kr|�|�|d7}q@q|S)Nr�r)�ranger�rdre�stringr])r?r�r{r[r'�endr(r(r)r�%s
z)PyShellEditorWindow.ranges_to_linenumberscCs|��t�|�dS)z7Extend base method - clear breaks when module is closedN)rkr�_close�r?r(r(r)r�6szPyShellEditorWindow._close)T)N)N)�__name__�
__module__�__qualname__�__doc__rB�rmenu_specsrNrarErFrkr}r>rur�r�r(r(r(r)r:~s&�	

	
*r:c@s"eZdZdZeZdZddd�ZdS)�PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNcCs8|jr|jj��nt|�|_|jr2|j��s2dS|jSr=)r^�top�wakeup�PyShell�begin�r?rfr(r(r)rHEs

zPyShellFileList.open_shell)N)r�r�r�r�r:rr^rHr(r(r(r)r�<sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfcCst�|�|��dSr=)rrB�LoadTagDefsr�r(r(r)rBSs
zModifiedColorDelegator.__init__cCs*|�ddd�|�ddd�t�|�dS)NZTODOrj�iomarkZSYNC)rirZr�recolorize_mainr�r(r(r)r�Wsz&ModifiedColorDelegator.recolorize_mainc	CsJt�|�t��}|j�ddd�t�|d�t�|d�t�|d�d��dS)N)rUrT�stdout�stderr�console)�stdinr�r�r�)rr�rrW�tagdefsr6rX)r?rYr(r(r)r�\s



�z"ModifiedColorDelegator.LoadTagDefscCs|jD]}|�|dd�qdS)Nr�r�)r�ri)r?�tagr(r(r)�removecolorsfs
z#ModifiedColorDelegator.removecolorsN)r�r�r�r�rBr�r�r�r(r(r(r)r�Ps

r�c@s$eZdZdZddd�Zddd�ZdS)	�ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markNcCsNz$|j�|dd�r"|j��WdSWntk
r8YnXt�||||�dS�N�<r�)�delegate�comparerc�TclErrorrrb)r?r[�chars�tagsr(r(r)rbns

zModifiedUndoDelegator.insertcCsLz$|j�|dd�r"|j��WdSWntk
r8YnXt�|||�dSr�)r�r�rcr�r�delete)r?Zindex1Zindex2r(r(r)r�ws

zModifiedUndoDelegator.delete)N)N)r�r�r�r�rbr�r(r(r(r)r�ks
	r�c@seZdZdd�ZdS)�MyRPCClientcCst�dS)z0Override the base class - just re-raise EOFErrorN)�EOFErrorr�r(r(r)�
handle_EOF�szMyRPCClient.handle_EOFN)r�r�r�r�r(r(r(r)r��sr�cCs^d|pd�d�}|t|�krNt|t|�d�\}}||d�|�|d��S|dd�SdS)z�Return width long restart line formatted with filename.

    Fill line with balanced '='s, with any extras and at least one at
    the beginning.  Do not end with a trailing space.
    z= RESTART: ZShellz =r�rnN���)r��divmod)�widthr&r�Zdiv�modr(r(r)�restart_line�s
r�c@seZdZdd�ZdZdZdZdd�Zdd�Zdd	�Z	d?dd
�Z
dd�Zdd�Zdd�Z
dd�Zd@dd�ZdZdd�ZdZdd�Zdd�Zdd�Zd d!�Zd"Zd#d$�ZdAd%d&�Zd'd(�Zd)d*�Zd+d,�ZdBd-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%dS)C�ModifiedInterpretercCsB||_tjdj}tj||d�d|_d|_t|_	|j
jj|_
dS)Nr)�localsF)�	tkconsole�sys�modules�__dict__r
rB�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r?r�r�r(r(r)rB�szModifiedInterpreter.__init__NcCs&|jdkr|��|_t�|j�|_dSr=)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubprocr�r(r(r)�spawn_subprocess�s

z$ModifiedInterpreter.spawn_subprocesscCs\|jdkstd��dd�tjD�}tjddddd	d
�}d|f}tjg|d|t|j�gS)
Nrz/Socket should have been assigned a port number.cSsg|]}d|�qS)z-Wr()�.0�sr(r(r)�
<listcomp>�sz@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>�main�Generalzdelete-exitfuncF�bool)�default�typez&__import__('idlelib.run').run.main(%r)�-c)r��AssertionErrorr��warnoptionsr�	GetOption�
executablerv)r?rmZ	del_exitfZcommandr(r(r)r��s�
�
z,ModifiedInterpreter.build_subprocess_arglistc	Cs\t|jf}td�D]8}t�|�zt|�|_WqXWqtk
rHYqXq|��dS|jj	�
�d|_tdkr�|jj	�t
jt
jd�|��|jj	�d�z|j��Wn t
jk
r�|��YdSX|j�d|j�|j�d|jj�|j�d|jj�|j�d|jj�|j�d	|jj�|j�d
t�|j�d|�|jdd
�|��|jS)N�rr�
r�r�r�r�rGr2r_T��with_cwd)�HOSTr�r��time�sleepr��rpccltr#�display_port_binding_error�listening_sock�getsocknamer��
setsockopt�socket�
SOL_SOCKET�SO_REUSEADDRr��
settimeout�accept�timeout�display_no_subprocess_error�registerr�r�r�r�rGr2�
transfer_path�poll_subprocess)r?�addr�ir(r(r)�start_subprocess�sB



�z$ModifiedInterpreter.start_subprocessFrScCs2|jr|jSd|_|��}|r<zt�|j�WnYnX|j��|��|j}|j}d|_|�	�z|j�
�Wn tjk
r�|�
�YdSX|j|d�|��|j�dd�|�d�|�t|j|��|j�dd�|j�dd�|�s|��|�rt�|j�|��|j|jj_d|_|jS)	NTFr�r��end-1cro�restart�left)r�r��getdebuggerrZclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r�r��
stop_readlinerCr�r!r�r��mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r?r�r&r`r�Z
was_executingr(r(r)�restart_subprocess�sF

z&ModifiedInterpreter.restart_subprocesscCs|j�dddi�dS)N�execZinterrupt_the_serverr()r�Z
remotecallr�r(r(r)Z__request_interruptsz'ModifiedInterpreter.__request_interruptcCstj|jd���dS)N)�target)�	threading�Thread�'_ModifiedInterpreter__request_interrupt�startr�r(r(r)�interrupt_subprocesssz(ModifiedInterpreter.interrupt_subprocesscCs~|jdk	r|jj�|j�z|jj��Wntk
r>YnXz|j��Wntk
rbYnX|��d|j_	d|_dS)NF)
�_afteridr�rCZafter_cancelr�r�r�r"r�r�r�r(r(r)�kill_subprocesss
z#ModifiedInterpreter.kill_subprocesscCsPz|j��Wntk
r$YdSXz|j��Wntk
rJYdSXdS)z"Make sure subprocess is terminatedN)r��killr#�waitr�r(r(r)r�!sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|�tj�ntj}|�d|f�dS)NrSzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�rJ�
runcommand)r?r�rJr(r(r)r�.s�z!ModifiedInterpreter.transfer_pathc
Cs8|j}|dkrdSz|j|jdd�}Wn4tttfk
rZ|jjrJYdSd}|��YnX|�r|j�	�d|_|\}}|jj
}|dkr�|dk	r�tt|�|d�nH|dkr�|j�
d�r�|��n*|dkr�d}t||tjd�t|||d�z|j��Wntk
�rYnX|jj�s4|jj�|jj|j�|_dS)	Ng�������?)rZOKrZ	EXCEPTION�<<toggle-jit-stack-viewer>>�ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR:
)r�Zpollresponse�
active_seqr�r#�KeyboardInterruptr��closingr��resetoutputr��print�repr�getvar�remote_stack_viewerr��
__stderr__�endexecutingr"rC�after�pollintervalr�r�)r?Zclt�response�howZwhatr��errmsgr(r(r)r�=sD


�z#ModifiedInterpreter.poll_subprocesscCs
||_dSr=r)r?rr(r(r)�setdebuggereszModifiedInterpreter.setdebuggercCs|jSr=rr�r(r(r)r�hszModifiedInterpreter.getdebuggercCs|jj�d|j�dS)a�Initiate the remote stack viewer from a separate thread.

        This method is called from the subprocess, and by returning from this
        method we allow the subprocess to unblock.  After a bit the shell
        requests the subprocess to open the remote stack viewer which returns a
        static object looking at the last exception.  It is queried through
        the RPC mechanism.

        i,N)r�rCrrr�r(r(r)�open_remote_stack_viewerks
z,ModifiedInterpreter.open_remote_stack_viewercCs�ddlm}|j�dddi�}|dkr6|jj��dS|�|j|�}ddlm	}m
}t|jj�}t�
�}t�|d�d}|||dd	�}	|	jjd
dd�||	jd|�}
|
��dS)
Nr)�
debugobj_rr�Zstackviewer)rG)�ScrolledCanvas�TreeNode�normalrU)�bgZhighlightthicknessrZboth)�expand�fill)�idlelibrr��remotequeuer�rxrcZStubObjectTreeItemZidlelib.treerrZToplevelrrWrX�frame�packZcanvasr)r?rZoid�itemrrr�rYrUZscZnoder(r(r)rxsz'ModifiedInterpreter.remote_stack_viewerrcCs|�|�}|�||�dS)z1Like runsource() but assumes complete exec sourceN)�stuffsource�execfile�r?�sourcer&r(r(r)�
execsource�s
zModifiedInterpreter.execsourcec	Cs�|dkrFt�|��.}|��}tr<dtj�|��d�|d}W5QRXzt||d�}WnHtt	fk
r�|j
��td|j
j
d�t�||�|j
��YnX|�|�dS)zExecute an existing fileNz__file__ = r'''z'''
z
del __file__r�zB*** Error in script or command!
Traceback (most recent call last):r)�tokenizerr�read�use_subprocessrIrJ�abspathr��
OverflowError�SyntaxErrorr�rr	r�r
�showsyntaxerrorr��runcode)r?r&r%rz�coder(r(r)r#�s&��
�zModifiedInterpreter.execfilecCs&|�|�}t|t�st�t�|||�S)zBExtend base class method: Stuff the source in the line cache first)r"�
isinstancervr�r
�	runsourcer$r(r(r)r1�s
zModifiedInterpreter.runsourcecCs>d|j}|jd|_|�d�}t|�dd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rror)�gid�splitr�r2r3)r?r%r&r{r(r(r)r"�s


zModifiedInterpreter.stuffsourcecCs|�d|f�dS)z>Prepend sys.path with file's directory if not already includeda(if 1:
            _filename = %r
            import sys as _sys
            from os.path import dirname as _dirname
            _dir = _dirname(_filename)
            if not _dir in _sys.path:
                _sys.path.insert(0, _dir)
            del _filename, _sys, _dirname, _dir
            
N)r�r?r&r(r(r)�prepend_syspath�s�z#ModifiedInterpreter.prepend_syspathcCs�|j}|j}|�ddd�t��\}}}t|dd�p:|p:d}t|dd�pJd}t|d	d�pZd
}	|	d
krl|d7}|dkr�d|	d}
nd|d|	df}
|�||
�|��|�d
|�|�	�dS)z�Override Interactive Interpreter method: Use Colorizing

        Color the offending position instead of printing it and pointing at it
        with a caret.

        rrjr��msgrSz<no detail available>r'r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
r�rCrir��exc_inforwZcolorize_syntax_errorrr!r�)r?r&r�rCr��value�tbr6r'r7�posr(r(r)r-�s$�z#ModifiedInterpreter.showsyntaxerrorcCs6|j��|��t�|�|j�d�r2|j��dS)z1Extend base class method to reset output properlyrN)r�r�checklinecacher
�
showtracebackr�open_stack_viewerr�r(r(r)r=�s


z!ModifiedInterpreter.showtracebackcCs>tj}t|���D]&}|dd�|dd�dkr||=qdS)Nrr0r1)r2r3r4�keys)r?�cr8r(r(r)r<�sz"ModifiedInterpreter.checklinecachecCs@|jjr|��dS|jr0|j�dd|fi�nt||j�dS)z*Run the code without invoking the debuggerrr�r.r)r�r��display_executing_dialogr�rr�r�)r?r/r(r(r)r�szModifiedInterpreter.runcommandcCsL|jjr|��|��|j}z�zT|j��|sR|j	dk	rR|j	�
dd|fi�|_n |rf|�||j
�nt||j
�Wn�tk
r�|jjs�tjddd|jjd�r��q�|��n�Yn`tr�td|jjd	�|��|j��n,|jj�rd
|j_td|jjd	�n|��YnXW5t�sFz|j��Wntk
�rDYnXXdS)�Override base class methodNr�r.zExit?zDo you want to exit altogether?Zyes�r�rz IDLE internal error in runcode()rFr)r�r�r�r<rr)rr"�beginexecutingr�Z
asyncqueuer�runr�r��
SystemExitrrZaskyesnorCr=r	r��canceled)r?r/rr(r(r)r.�sR

��
�
zModifiedInterpreter.runcodecCs|jj�|�S)rB)r�r�r!)r?r�r(r(r)r!#szModifiedInterpreter.writecCstjdd|jjd�dS)NzPort Binding ErroraAIDLE can't bind to a TCP/IP port, which is necessary to communicate with its Python execution server.  This might be because no networking is installed on this computer.  Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.r�rryr�rCr�r(r(r)r�'s
�z.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjd�dS)NzSubprocess Connection Errorz�IDLE's subprocess didn't make connection.
See the 'Startup failure' section of the IDLE doc, online at
https://docs.python.org/3/library/idle.html#startup-failurerrHr�r(r(r)r�2s
�z/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjd�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rrHr�r(r(r)rA:s
�z,ModifiedInterpreter.display_executing_dialog)FrS)F)N)N)&r�r�r�rBr�r�r�r�r�r�r�r�r�r�r�r�rr�rrr�rrr2r&r#r1r"r5r-r=r<rr.r!r�r�rAr(r(r(r)r��sF	+
,

&

	
.r�cs�eZdZde�ZeZeZddddddgZ	e
jdgZd	Zd
dl
mZdUd
d�Zdd�Zd	Zd	Zd	Zd	Zd	Zd	Zdd�Zdd�ZdVdd�Zdd�ZdWdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Z d%d&�Z!d'd(�Z"d)d*�Z#d+d,�Z$d-Z%d.d/�Z&d0d1�Z'd2d3�Z(d4d5�Z)dXd6d7�Z*d8d9�Z+d:d;�Z,d<d=�Z-d>d?�Z.d@dA�Z/dYdBdC�Z0dZdDdE�Z1d[dFdG�Z2dHdI�Z3dJdK�Z4dLdM�Z5d\dOdP�Z6�fdQdR�Z7�fdSdT�Z8�Z9S)]r�zIDLE Shell )rZ_File)ZeditZ_Edit)r`Z_Debug)�optionsZ_Options)ZwindowZ_Window)�helpZ_Help)ZSqueeze�<<squeeze-current-text>>Fr)�HistoryNcCs$tr&|j}|dddkr&|�dd�t|�|_|dkrVt�}t|�|��t|�}t	�
||dd�d|_d|_t
td�r�tjnd|_|j�d	�d
|_|j|_|j}|jdd�|�d
|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�t�r8|�d|j�|�d|j�|� |�}|�d|j!�tj"|_#tj$|_%tj&|_'ddl(m)}t*|d|j+|j,�|_&t-|d|j+|j,�|_"t-|d|j+d�|_$t-|d|j+|j,�|_.t�s�|j"t_"|j$t_$|j&t_&zddl/}|j0|_1Wntj2t_$�YnX|�3|j�|_4d|_5dS)Nr�r�shell)rMZShe_llT��ps1rror0�char)�wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>�<<toggle-debugger>>rz<<view-restart>>z<<restart-shell>>rK)�iomenur�r�r��backslashreplacer��2)6r)�
menu_specsrbr�r_�Tkr�withdrawr�rrBZusetabsZindentwidth�hasattrr�rO�sys_ps1r3Zprompt_last_line�promptrCZ	configurerD�enter_callback�linefeed_callback�cancel_callback�eof_callbackr>�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark�
restart_shellZSqueezerZsqueeze_current_text_eventr��save_stdoutr��save_stderrr��
save_stdinrrSr�encoding�errorsrr��pydocZ
plainpagerZpagerr
rL�historyr)r?rG�msrxrCZsqueezerrSrir(r(r)rB^s�

�����zPyShell.__init__cCstjdd�S)NT)Z
shell_only)rZ
GetExtensionsr�r(r(r)�get_standard_extension_names�sz$PyShell.get_standard_extension_namescCs|adSr=�r )r?�streamr(r(r)�set_warning_stream�szPyShell.set_warning_streamcCstSr=rmr�r(r(r)�get_warning_stream�szPyShell.get_warning_streamcCsH|jr$tjdd|jd�|��dS|j��}|r<|��n|��dS)NzDon't debug nowz*You can only toggle the debugger when idlerrR)	r�rryrC�set_debugger_indicatorr_r��close_debugger�
open_debugger)r?rf�dbr(r(r)r`�s�

zPyShell.toggle_debuggercCs|j��}|�d|�dS)NrR)r_r�Zsetvar�r?rtr(r(r)rq�s
zPyShell.set_debugger_indicatorcCsdSr=r(r�r(r(r)ra�szPyShell.toggle_jit_stack_viewercCsh|j��}|r\|j�d�|��|jjr8t�|jj�|��|j�	d�|j
|_|��|�
�dS)Nz[DEBUG OFF]
)r_r�rr�r�rZclose_remote_debuggerrr�r!rZr[r�rqrur(r(r)rr�s
zPyShell.close_debuggercCsX|jjrt�|jj|�}n
t�|�}|j�|�|��d|j|_	|�
�|��dS)Nz[DEBUG ON]
)r_r�rZstart_remote_debuggerrZDebuggerrr�rZr[r�rq)r?Zdbg_guir(r(r)rs�s
�
zPyShell.open_debuggercCs |jr
dnd}|�dd|�dS)N�disabledrr`z*tack*iewer)r�Zupdate_menu_state)r?�stater(r(r)�debug_menu_postcommand�szPyShell.debug_menu_postcommandcCs|��d|_dS)�Helper for ModifiedInterpreterTN)rr�r�r(r(r)rD�szPyShell.beginexecutingcCsd|_d|_|��dS)ryFN)r�rGr�r�r(r(r)r�szPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|��d|_d|_t�|�S)zExtend EditorWindow.close()zKill?z7Your program is still running!
 Do you want to kill it?�okrCF�cancelT)	r�rZaskokcancelrCr�rGrrr�)r?rr(r(r)r��s�z
PyShell.closecCsV|��tr|j��|jt_|jt_|j	t_
d|_d|_d|j_
d|_t�|�dS)zEExtend EditorWindow._close(), shut down debugger and execution serverN)rrr)r_r�rdr�r�rer�rfr�r�rGr^rjrr�r�r(r(r)r��s
zPyShell._closecCsdS)z8Override EditorWindow method: never remove the colorizerTr(r4r(r(r)�ispythonsourceszPyShell.ispythonsourcecCs|jSr=)�shell_titler�r(r(r)�short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs�|j�dd�|��tr:d}|j��}|sF|��dSnd}tjt	_|�
dt	jt	j|j
|f�|j��|��ddl}d|_d|_dS)	Nr�rbrSFz�==== No Subprocess ====

WARNING: Running IDLE without a Subprocess is deprecated
and will be removed in a later version. See Help/IDLE Help
for details.

zPython %s on %s
%s
%srT)rCr�rr)r_r�r�r�displayhookr�r!�version�platform�	COPYRIGHTZfocus_forcer��tkinterZ_support_default_rootZ
_default_root)r?Znosub�clientr�r(r(r)r�s&
�
z
PyShell.begincCs|js
dSd|_|j��dS�NT)�reading�_stop_readline_flagr��quitr�r(r(r)r�2szPyShell.stop_readlinecCs�|j}zd|_|j��W5||_X|jr4d|_dS|j�dd�}t|�dkrRd}|��|jrnd|_t	snt
�|jr~d|_d}|S)NTFrSr�r�rro)r�r��mainloopr�rC�getr�rrGr)r�	endoffile)r?r7rr(r(r)�readline8s(zPyShell.readlinecCsdSr�r(r�r(r(r)�isattyOszPyShell.isattycCs�z|j�ddd�rWdSWnYnX|jsT|jsT|��|j�d�|��dSd|_d|_	|jr�|jj
r�|j��r�|j��n
|j�
�|jr�|j��dS)N�	sel.firstz!=�sel.lastzKeyboardInterrupt
rRFT)rCr�r�r�rr_r!r�r�rGr�r�r�r�r�r�r�r(r(r)r^Rs&



zPyShell.cancel_callbackcCsf|jr|jsdS|j�ddd�r0|j�ddd�s4dS|jsL|��|��nd|_d|_|j�	�dS)Nr�z==rbr�FTrR)
r�r�rCr�rr�rGr�r�r�r�r(r(r)r_hs�

zPyShell.eof_callbackcCs0|jr"|j�dd�|j�d�n
|�|�dS)NrbrorR)r�rCrb�see�newline_and_indent_eventr�r(r(r)r]ws

zPyShell.linefeed_callbackcCs:|jr|jsdSz8|j�dd�}|rF|j�ddd�rF|�||�WdSWnYnX|j�ddd��rX|j�d	d�}|r�|j�dd|d
�r�|�|j�|d|d
�|�dS|j�d	d�}|r�|j�dd
|d�r�|�|j�|d|d
�|�dS|j�dd�}|�r>|j�|ddd��r>|�|j�|d
d�|�n|�|j�dd�|�dS|j�ddd��rx|j�dd�|j�dd�}|�r�|�	��s�|j�
dd�|j�ddd��r�|�|�dS|j�dd�|j�r�|j�dd�|j�
d�n
|�|�|j�d	dd�|j��|j�r.|j��n|��dS)Nr�r�z<=r�rRrbr��iomark linestartr�rrzinsert lineendz>=r�rgr�zend-1c linestartro)r�r�rCr�r��recallZ
tag_prevrangeZ
tag_nextranger��stripr�r�rbr�rZZupdate_idletasksr�r��runit)r?rf�sel�prev�next�indicesr�r(r(r)r\�sZ
�


zPyShell.enter_callbackc	Cs6t�dd|�}t�dd|�}|�d�}|j��z�|j�ddd�|j�dd	�|j�	d
d�}|�
��d�r�|�|�|j�	d
d�}|j�
d|d���t|�d
k�rt�d|d��d�}t�d|��d�}|d
d�D]8}|�|�r�||t|�d�}|j�
dd|�
��q�W5|j�d�|j��XdS)Nz^\s*\nrSz\n\s*$rorbr�rjr�r�rg�:rrz	^([ \t]*))�re�subr3rCZundo_block_startr�Zundo_block_stoprir�r��rstrip�endswithr�rbr�r��search�grouprt)r?r�rfr{�prefixZorig_base_indentZnew_base_indentrr(r(r)r��s*



zPyShell.recallcCs�|j�dd�}t|�}|dkr8||ddkr8|d}q|dkrX||ddkrX|d}|dkrz||ddkrz|d}qX|d|�}|j�|�dS)Nr�r�rrz 	ro)rCr�r�r_r1)r?rr�r(r(r)r��s

z
PyShell.runitcCs\|jjr|j��Sz
tjWn tjdd|jd�YdSXddlm	}||j
|j�dS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)rr)�StackBrowser)r_r�rr��last_tracebackrryrCZidlelib.stackviewerr�rxrG)r?rfr�r(r(r)r>�s

�zPyShell.open_stack_viewercCs|j�d�|j�d�dS)Nr�r�)rCr�r�r(r(r)rb�szPyShell.view_restart_markcCs|jjdd�dS)z&Callback for Run/Restart Shell Cntl-F6Tr�N)r_r�r�r(r(r)rc�szPyShell.restart_shellcCs:|��|j�|j�|j�dd�|��|j��dS)Nrbr�)	rr�r!r[rCr��set_line_and_columnrMZ
reset_undor�r(r(r)r��s
zPyShell.showpromptcCsP|jjj}t|ddd�}d�|�|��}|�d�s:|d7}|jj�	d|d�dS)NrNT)r��tabsizeZexpand_tabsror�r�)
r_r�r�rrKrQr�ZperZbottomrb)r?r6r��wrapperZwrapped_msgr(r(r)�show_warnings

zPyShell.show_warningcCsb|j�dd�}|jr |j�|�|j�d�dkr>|j�dd�|j�dd�|��|j��dS)Nr�r�zend-2cro)	rCr�rj�storerbr�r�ZctipZremove_calltip_window)r?r%r(r(r)rszPyShell.resetoutputr(cCsXz0|j�dd�t�|||d�}|j�dd�Wn�YnX|jrTd|_tsTt�|S)Nr��rightr�F)rCr�rr!rGr)r)r?r�r��countr(r(r)r!sz
PyShell.writecs<z|j�ddd�rWdSWntk
r0YdSXt���S)Nr�r�r�rv)rCr�r��superrPr���	__class__r(r)rP$s
zPyShell.rmenu_check_cutcs|j�ddd�rdSt���S)Nrbr�r�rv)rCr�r�rQr�r�r(r)rQ,szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r():r�r�r�rr}r�rr�rrVrr�Zallow_line_numbersZidlelib.historyrLrBrlr�r�rGr�rr�rorpr`rqrarrrsrxrDrr�r�r|r~r�r�r�r�r�r^r_r]r\r�r�r>rbrcr�r�rr!rPrQ�
__classcell__r(r(r�r)r�Bst
�
�
C


�
	?




r�c
Cs2|jdkr.dD]}|�|dd|�|d��qdS)z6Make paste replace selection on x11.  See issue #5124.Zx11)ZTextZEntryZSpinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
N)Z_windowingsystemZ
bind_class)rx�clsr(r(r)�
fix_x11_paste2s

��r�a�
USAGE: idle  [-deins] [-t title] [file]*
       idle  [-dns] [-t title] (-c cmd | -r file) [arg]*
       idle  [-dns] [-t title] - [arg]*

  -h         print this help message and exit
  -n         run IDLE without a subprocess (DEPRECATED,
             see Help/IDLE Help for details)

The following options will override the IDLE 'settings' configuration:

  -e         open an edit window
  -i         open a shell window

The following options imply -i and will open a shell:

  -c cmd     run the command in a shell, or
  -r file    run script from file

  -d         enable the debugger
  -s         run $IDLESTARTUP or $PYTHONSTARTUP before anything else
  -t title   set title of shell window

A default edit window will be bypassed when -c, -r, or - are used.

[arg]* are passed to the command (-c) or script (-r) in sys.argv[1:].

Examples:

idle
        Open an edit window or shell depending on IDLE's configuration.

idle foo.py foobar.py
        Edit the files, also open a shell if configured to start with shell.

idle -est "Baz" foo.py
        Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell
        window with the title "Baz".

idle -c "import sys; print(sys.argv)" "foo"
        Open a shell window and run the command, passing "-c" in sys.argv[0]
        and "foo" in sys.argv[1].

idle -d -s -r foo.py "Hello World"
        Open a shell window, run a startup script, enable the debugger, and
        run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in
        sys.argv[1].

echo "import sys; print(sys.argv)" | idle - "foobar"
        Open a shell window, run the script piped in, passing '' in sys.argv[0]
        and "foobar" in sys.argv[1].
c
sVddl}ddlm}ddlm}ddlm}td�dad}d}d}d}d}d}	z|�tj	dd�d�\}
}WnD|j
k
r�}z$td	|tftj
d
�t�d�W5d}~XYnX|
D]�\}
}|
dkr�|}d}|
d
kr�d}d}|
dkr�d}|
dk�r
tj�t�t��|
dk�rd}|
dk�r4tdtj
d
�da|
dk�rh|}tj�|��rRntd|�t��d}|
dk�rzd}	d}|
dkr�|t_d}q�|�r�|ddk�r�tj��}d}tttj��D]}tj�tj|�tj|<�q�|�r|ddk�rdg|dd�t_	n�|�rdg|t_	n�|�r0|g|t_	n�|�r�d}g}|D]}|�tj�|���qB|D],}tj�|�}|tjk�r`tj�d|��q`n"t��}|tjk�r�tj�d|�tj ddddd�}|�p�|}|�p�|}t�r�|�s�t!�t"dd�a#t#�$�dd l%m&}|t#�tj�'tj�t(�d!��|�d"k�rPtj�'�d#�}t#j)|d$�nV|�*��s�t+d%k�rnd&�d'}nd(�d)}��fd*d+�|D�}d,d+�|D�}t#j,d0|��t-t#�t.t#�t/t#�a0|�1t#t0�|�r|�s|�s|dd�D] }t0�2|�dk�r�|�3|��q�|�st0�4�|�rNt0�5�}|�s0dS|�*��rTt0j6�rT|j7�8�nt0j9}|�rb|�:�|	�r�tj;�<d-��p�tj;�<d.�}|�r�tj�|��r�|j=�>|�|�s�|�r�|j=�?d/tj	f�|�r�|j=�@|�n|�r.|j=�A|�|j=�>|�n8|�r.|�Bt#�}|�r|�C|�|�D�}|�r.|�C|�t0jE�rBt#�F��q.t#�G�td�dS)1Nr)�system)�testing)�macosxTFrzc:deihnr:st:zError: %s
%srr�r�z-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t�-rSr�r�zeditor-on-startupr�)r�ZIdle)Z	classNamer	ZIconsZWindowszidle.ico)r�g333333!@z.png)�� �0�z.gif)r�r�r�cs"g|]}tj��d|�f��qS)z	idle_%d%s)rIrJrK)r��size��extZicondirr(r)r��s�zmain.<locals>.<listcomp>cSsg|]}tt|d��qS))Zmasterr)Z
PhotoImagerx)r��iconfiler(r(r)r��s�ZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)T)H�getoptr�r�rr�r�r/r)r��argv�errorr	�	usage_msgr��exitr�r!rIrJr~r�r}r�r(r�r�r*r]�dirnamerb�getcwdrr�Z
NoDefaultRootrWrxrX�idlelib.runr
rK�__file__Z
wm_iconbitmapZisAquaTk�	TkVersionZwm_iconphotorr�r�rGZsetupApprrrh�newrH�dictr��lowerr^rs�environr�r_r#rr&r5ZtkVersionWarningr�ZpreferTabsPreferenceWarningZinversedictr�Zdestroy)r�r�r�r�Zenable_shellZenable_editr`�cmdZscriptZstartupZoptsrOr6�o�ar�Zpathxr&�dirZ
edit_startr
r�ZsizesZ	iconfilesZiconsrMZtkversionwarningZprefer_tabs_preference_warningr(r�r)r�ss&


�



�



��
��


r�F)NN)Nr�r�r�r��ImportErrorr	r
rFr�ZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr"r#rr�rWrxrXr�r
ryr/r
r2rIZos.pathrr�r�r��textwraprr�r�r'r,Zidlelib.colorizerrZidlelib.configrrrrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZidlelib.undorr�r�r r*r+r/�
checkcacher9r:r�r�r�Z	RPCClientr�r�r�r�r�r�r�r(r(r(r)�<module>s��
��

�
?0s66


F1le Man4ger