HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/idlelib/__pycache__/pyshell.cpython-310.opt-2.pyc
o

�i���
@s,ddlZedkrejdejd<zddlTWney(edejd�ed��wejdkrKzddl	Z	dZ
e	�d	��e
�Wnee
efyJYnwdd
lmZedkrte�at��ddlmZet�ejd
detd�ed��ddlmZddlZddlZddlZddlZddlmZddlZddlZddl Z ddl!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/ddl0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl-m7Z7ddl-m8Z8ddlm9Z9m:Z:m;Z;ddl<m=Z=da>d Z?dZ@z
d!ZAeAeB_AeAeC_AWn
eD�yYnwejaE	d@d"d#�ZFdaGd$d%�ZHeHd&�dejIfd'd(�ZJeJe_IGd)d*�d*e1�ZKGd+d,�d,e4�ZLGd-d.�d.e(�ZMGd/d0�d0e=�ZNGd1d2�d2e,�ZOGd3d4�d4e8jP�ZQd5d6�ZRGd7d8�d8e�ZSGd9d:�d:e6�ZTd;d<�ZUd=ZVd>d?�ZWedk�r�eW�eHd�dS)A�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)�	Delegator��debugger)�
debugger_r)�EditorWindow�
fixwordbreaks)�FileList)�OutputWindow)�replace)�rpc)�idle_formatwarning�StdInputFile�
StdOutputFile)�
UndoDelegatorFz	127.0.0.1zCtrl-D (end-of-file)c	CsP	|durt}z|�t|||||d��|�d�WdSttfy'YdSw)N)�linez>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorr �r)�,/usr/local/lib/python3.10/idlelib/pyshell.py�idle_showwarningRs
��r+cCs<	|rtdurtjatt_dSdStdurtt_dadSdS�N)�_warnings_showwarning�warnings�showwarningr+)�capturer)r)r*�capture_warningses
��r1TcCsZ	tj}i}t|�D]}|dd�|dd�dkr!|�|�||<q
||�|�|�dS�Nr���z<>)�	linecache�cache�list�pop�update)r'Zorig_checkcacher5�save�keyr)r)r*�extended_linecache_checkcachets	�r;c@steZdZ	dd�Zgd�Zddd�Zdd�Zdd
d�Zddd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd	S)�PyShellEditorWindowcGs�g|_tj|g|�R�|j�d|j�|j�d|j�|j�d|jj�t	j
�tj
d�|_|jj|fdd�}|j�|�|jjrE|��|��dS)N�<<set-breakpoint-here>>�<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|��|�dSr,)�restore_file_breaks)Zold_hook�selfr)r)r*�filename_changed_hook�s
z;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@�argsrAr)r)r*rC�s�
�zPyShellEditorWindow.__init__))ZCutz<<cut>>�rmenu_check_cut)�Copyz<<copy>>�rmenu_check_copy)ZPastez	<<paste>>�rmenu_check_paste)NNN)zSet Breakpointr=N)zClear Breakpointr>NTcCsF	|jdurdS|rt��}t�|d�}nddd�}|j�d|�dS)N�break�)�
foreground�
background�BREAK)rNr�CurrentTheme�GetHighlightrDZ
tag_config)r@Zcolor�themeZcfgr)r)r*rO�s

z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|�dd|d|d�z|j�|�Wnty+|j�|�Ynwz|jj	j
j}|�||�WdSYdS)NrYz%d.0r)
rDrNr'�tag_addrB�index�
ValueError�appendrH�pyshell�interprrF)r@r(rDr'�debugr)r)r*�set_breakpoint�s�z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|��dStt|�d���}|�|�dS)N�insert)rDrNr'�bell�int�floatr^rd)r@�eventrDr'r(r)r)r*rF�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|��dStt|�d���}z|j�|�WnY|�	ddd�z|j
jjj
}|�||�WdSYdS)NrerY�insert linestartzinsert lineend +1char)rDrNr'rfrgrhr^rB�remove�
tag_removerHrarbrrG)r@rirDr'r(rcr)r)r*rG�s$�z)PyShellEditorWindow.clear_breakpoint_herecCsf|jr1|j}|jj}|s|��dSg|_|�ddt�z|jjj	j
}|�|�WdSYdSdS)NrY�1.0)rBrDrNr'rfrlZENDrHrarbr�clear_file_breaks)r@rDr'rcr)r)r*rn�s�z%PyShellEditorWindow.clear_file_breaksc
Cs\	|j}|jj}zt|jd��}|��}Wd�n1swYWnty/g}YnwzKt|jd��:}|D]}|�|d�sH|�|�q:|�	�|j}|rh|�|dt
|�d�Wd�WdSWd�WdS1stwYWdSty�}z&t|jdd�s�d|j_
tjdd	t
|�|jd
�WYd}~dSWYd}~dSd}~ww)N�r�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titler%r)rBrNr'�openrM�	readlinesr$�
startswithr"�update_breakpoints�str�getattr�rootrsr�	showerrorrD)r@Zbreaksr'�fp�linesZnew_filer �errr)r)r*�store_file_breaks�sH
���
��&������z%PyShellEditorWindow.store_file_breakscCs�|j��|jdurdS|jj}|durdStj�|j�rYt|jd��}|�	�}Wd�n1s2wY|D]!}|�
|d�rXt|t|�dd��}|D]}|�
|�qPq9dSdS)Nrorqr)rDr8rNr'rJrK�isfilerMrurvrw�eval�lenrd)r@r'r}r~r Zbreakpoint_linenumbersZbreakpoint_linenumberr)r)r*r?s$


���z'PyShellEditorWindow.restore_file_breakscCs&	|j}|�d�}|�|�}||_dS)NrY)rDZ
tag_ranges�ranges_to_linenumbersrB)r@rD�rangesZlinenumber_listr)r)r*rx+s



z&PyShellEditorWindow.update_breakpointscCshg}tdt|�d�D]'}tt||j��}tt||dj��}||kr1|�|�|d7}||ks$q
|S)Nr�r)�ranger�rgrh�stringr`)r@r�r~r^r(�endr)r)r*r�2s
��z)PyShellEditorWindow.ranges_to_linenumberscCs	|��t�|�dSr,)rnr�_close�r@r)r)r*r�CszPyShellEditorWindow._close)Tr,)�__name__�
__module__�__qualname__rC�rmenu_specsrOrdrFrGrnr�r?rxr�r�r)r)r)r*r<�s
	

	*r<c@s eZdZ	eZdZddd�ZdS)�PyShellFileListNcCs<|jr|jj��|jSt|�|_|jr|j��sdS|jSr,)ra�top�wakeup�PyShell�begin�r@rir)r)r*rIRs
�
zPyShellFileList.open_shellr,)r�r�r�r<rrarIr)r)r)r*r�Is
r�c@seZdZ	dd�Zdd�ZdS)�ModifiedColorDelegatorcCs*|�ddd�|�ddd�t�|�dS)NZTODOrm�iomarkZSYNC)rlr]r�recolorize_mainr�r)r)r*r�_sz&ModifiedColorDelegator.recolorize_maincCs|jD]	}|�|dd�qdS)Nr�r�)Ztagdefsrl)r@�tagr)r)r*�removecolorsds
�z#ModifiedColorDelegator.removecolorsN)r�r�r�r�r�r)r)r)r*r�]sr�cs2eZdZ	ddd�Zddd�Z�fdd�Z�ZS)	�ModifiedUndoDelegatorNcCsLz|j�|dd�r|j��WdSWn	tyYnwt�||||�dS�N�<r�)�delegate�comparerf�TclErrorrre�r@r^�chars�tagsr)r)r*rels
��zModifiedUndoDelegator.insertcCsJz|j�|dd�r|j��WdSWn	tyYnwt�|||�dSr�)r�r�rfr�r�delete)r@Zindex1�index2r)r)r*r�us
��zModifiedUndoDelegator.deletecs>|jj��fdd�|j_z
t��|�W�|j_dS�|j_w)Ncs�||d�S�N�stdinr))r^r��Zorig_insertr)r*�<lambda>��z2ModifiedUndoDelegator.undo_event.<locals>.<lambda>)r�re�super�
undo_eventr���	__class__r�r*r�~s
�z ModifiedUndoDelegator.undo_eventr,)r�r�r�rer�r��
__classcell__r)r)r�r*r�js


		r�c@seZdZ	ddd�ZdS)�UserInputTaggingDelegatorNcCs |durd}|j�|||�dSr�)r�rer�r)r)r*re�sz UserInputTaggingDelegator.insertr,)r�r�r�rer)r)r)r*r��sr�c@seZdZdd�ZdS)�MyRPCClientcCs	t�r,)�EOFErrorr�r)r)r*�
handle_EOF��zMyRPCClient.handle_EOFN)r�r�r�r�r)r)r)r*r��sr�cCs\	d|pd�d�}|t|�kr(t|t|�d�\}}||d�|�|d��S|dd�S)Nz= RESTART: ZShellz =r�rq���)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,�ZdAd-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%dS)B�ModifiedInterpretercCsB||_tjdj}tj||d�d|_d|_t|_	|j
jj|_
dS)Nr)�localsF)�	tkconsole�sys�modules�__dict__r
rC�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r@r�r�r)r)r*rC�szModifiedInterpreter.__init__NcCs&|jdur
|��|_t�|j�|_dSr,)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubprocr�r)r)r*�spawn_subprocess�s

z$ModifiedInterpreter.spawn_subprocesscCsJdd�tjD�}tjdddddd�}d	|f}tjg|d
|t|j�gS)NcSsg|]}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��warnoptionsr�	GetOption�
executableryr�)r@rpZ	del_exitfZcommandr)r)r*r��s
�
z,ModifiedInterpreter.build_subprocess_arglistc	CsPt|jf}td�D]}t�|�zt|�|_Wnty!Yq	w|��dS|jj	�
�d|_tdkr@|jj	�t
jt
jd�|��|jj	�d�z|j��Wnty`|��YdSw|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�
�consoler��stdout�stderrrHr4rbT��with_cwd)�HOSTr�r��time�sleepr��rpccltr$�display_port_binding_error�listening_sock�getsocknamer��
setsockopt�socket�
SOL_SOCKET�SO_REUSEADDRr��
settimeout�accept�TimeoutError�display_no_subprocess_error�registerr�r�r�r�rHr4�
transfer_path�poll_subprocess)r@�addr�ir)r)r*�start_subprocess�sD


���z$ModifiedInterpreter.start_subprocessFrVcCs&|jr|jSd|_|��}|rzt�|j�WnY|j��|��|j}|j}d|_|�	�z|j�
�WntyG|��YdSw|j
|d�|��|j�dd�|�d�|�t|j|��|j�dd�|j�dd�|s{|��|r�t�|j�|��|j|jj_d|_|jS)	NTFr�r��end-1crr�restart�left)r�r��getdebuggerrZclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r��
stop_readlinerDr�r"r�r��mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r@r�r'rcr�Z
was_executingr)r)r*�restart_subprocess�sH
�
z&ModifiedInterpreter.restart_subprocesscCs|j�dddi�dS)N�execZinterrupt_the_serverr))r�Z
remotecallr�r)r)r*Z__request_interrupt�z'ModifiedInterpreter.__request_interruptcCstj|jd���dS)N)�target)�	threading�Thread�'_ModifiedInterpreter__request_interrupt�startr�r)r)r*�interrupt_subprocess"rz(ModifiedInterpreter.interrupt_subprocesscCsz|jdur
|jj�|j�z|jj��Wn	tyYnwz|j��Wn	ty/Ynw|��d|j_	d|_dS�NF)
�_afteridr�rDZafter_cancelr�r�r�r#r�r�r�r)r)r*�kill_subprocess%s
��
z#ModifiedInterpreter.kill_subprocesscCsL	z|j��Wn
tyYdSwz|j��WdSty%YdSwr,)r��killr$�waitr�r)r)r*r�4s��z(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|�tj�ntj}|�d|f�dS)NrVzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�rK�
runcommand)r@r�rKr)r)r*r�As
�z!ModifiedInterpreter.transfer_pathc
Cs2|j}|dur	dSz
|j|jdd�}Wntttfy,|jjr$YdSd}|��Ynw|r�|j�	�d|_|\}}|jj
}|dkrP|durOtt|�|d�n$|dkr_|j�
d�r^|��n|dkrtd}t||tjd�t|||d�z|j��Wn	ty�Ynw|jjs�|jj�|jj|j�|_dSdS)	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#rD�after�pollintervalr�r)r@Zclt�response�howZwhatr��errmsgr)r)r*r�PsL�
���

��z#ModifiedInterpreter.poll_subprocesscCs
||_dSr,r)r@rr)r)r*�setdebuggerxs
zModifiedInterpreter.setdebuggercC�|jSr,rr�r)r)r*r�{�zModifiedInterpreter.getdebuggercCs	|jj�d|j�dS)Ni,)r�rDrrr�r)r)r*�open_remote_stack_viewer~s	z,ModifiedInterpreter.open_remote_stack_viewercCs�ddlm}|j�dddi�}|dur|jj��dS|�|j|�}ddlm	}m
}t|jj�}t�
�}t�|d�d}|||dd	�}	|	jjd
dd�||	jd|�}
|
��dS)
Nr)�
debugobj_rrZstackviewer)rH)�ScrolledCanvas�TreeNode�normalrX)�bgZhighlightthicknessrZboth)�expand�fill)�idlelibr&r��remotequeuer�r{rfZStubObjectTreeItemZidlelib.treer'r(ZToplevelrrZr[�frame�packZcanvasr+)r@r&Zoid�itemr'r(r�r\rXZscZnoder)r)r*r�sz'ModifiedInterpreter.remote_stack_viewerrcCs	|�|�}|�||�dSr,)�stuffsource�execfile�r@�sourcer'r)r)r*�
execsource�s
zModifiedInterpreter.execsourcec	Cs�	|dur.t�|��}|��}trdtj�|��d�|d}Wd�n1s)wYzt||d�}Wn$tt	fyZ|j
��td|j
j
d�t�||�|j
��YdSw|�|�dS)Nz__file__ = r'''z'''
z
del __file__rzB*** Error in script or command!
Traceback (most recent call last):r)�tokenizeru�read�use_subprocessrJrK�abspathr��
OverflowError�SyntaxErrorr�rrr�r
�showsyntaxerrorr��runcode)r@r'r5r}�coder)r)r*r3�s.����
��zModifiedInterpreter.execfilecCs	|�|�}t�|||�Sr,)r2r
�	runsourcer4r)r)r*r@�s
zModifiedInterpreter.runsourcecCs@	d|j}|jd|_|�d�}t|�dd||ftj|<|S)Nz<pyshell#%d>rrrr)�gid�splitr�r4r5)r@r5r'r~r)r)r*r2�s

zModifiedInterpreter.stuffsourcecCs	|�d|f�dS)Na(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
            
)r�r@r'r)r)r*�prepend_syspath�s
�z#ModifiedInterpreter.prepend_syspathcCs�	|j}|j}|�ddd�t��\}}}t|dd�p|pd}t|dd�p&d}t|d	d�p.d
}	|	d
kr7|d7}|dkrBd|	d}
n
d|d|	df}
|�||
�|��|�d
|�|�	�dS)Nrrmr��msgrVz<no detail available>r(r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
)
r�rDrlr��exc_inforzZcolorize_syntax_errorrr"r�)r@r'r�rDr��value�tbrEr(rF�posr)r)r*r=�s&�z#ModifiedInterpreter.showsyntaxerrorcCs<	|j��|��t�|�|j�d�r|j��dSdS)Nr)r�r�checklinecacher
�
showtracebackr�open_stack_viewerr�r)r)r*rL�s

�z!ModifiedInterpreter.showtracebackcCs>tj}t|���D]}|dd�|dd�dkr||=q	dSr2)r4r5r6�keys)r@�cr:r)r)r*rK�s��z"ModifiedInterpreter.checklinecachecCsD	|jjr|��dS|jr|j�dd|fi�dSt||j�dS)Nrrr>r)r�r��display_executing_dialogr�r.rr�)r@r?r)r)r*r�s�zModifiedInterpreter.runcommandcCsf	|jjr	|��|��|j}z�z*|j��|s*|jdur*|j�dd|fi�|_n|r4|�	||j
�nt||j
�WnKtyZ|jj
sWtjddd|jjd�rR�|��n�Yn-trqtd|jjd�|��|j��n|jjr�d	|j_td
|jjd�n|��YWts�z|j��WdSty�YdSwdSts�z|j��Wwty�Ywww)Nrr>zExit?zDo you want to exit altogether?Zyes�r�rz IDLE internal error in runcode()rFr)r�r�rrKr�beginexecutingr�Z
asyncqueuer�runr�r�
SystemExitrrZaskyesnorDrLr9rr�r�canceledr#)r@r?rr)r)r*r>sh

���
�������zModifiedInterpreter.runcodecCs	|jj�|�Sr,)r�r�r")r@r�r)r)r*r"6szModifiedInterpreter.writecC�tjdd|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�rr|r�rDr�r)r)r*r�:s

�z.ModifiedInterpreter.display_port_binding_errorcCrV)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-failurerrWr�r)r)r*r�Es

�z/ModifiedInterpreter.display_no_subprocess_errorcCrV)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rrWr�r)r)r*rPMs

�z,ModifiedInterpreter.display_executing_dialog)FrV)Fr,)&r�r�r�rCrr�r�r�r�r�rrr	rr�r�rr�rr"r�r%rrAr6r3r@r2rDr=rLrKrr>r"r�r�rPr)r)r)r*r��sH	
+,


&

	
.r�cs&eZdZddlmZde�ZeZe	Z
gd�Zej
dgZ
deee�dd�e
���Ze
�ed	�[d
ZdZddlmZdd
lmZdfdd�Z�fdd�Z�fdd�Zdd�Zdd�Zdd�Zdfdd�Z d
Z!d
Z"d
Z#d
Z$d
Z%d
Z&dd�Z'dd �Z(dfd!d"�Z)d#d$�Z*dfd%d&�Z+d'd(�Z,d)d*�Z-d+d,�Z.d-d.�Z/d/d0�Z0d1d2�Z1d3d4�Z2d5d6�Z3d7d8�Z4d9Z5d:d;�Z6d<d=�Z7d>d?�Z8d@dA�Z9dfdBdC�Z:dDdE�Z;dFdG�Z<dHdI�Z=dJdK�Z>e?�@dL�ZAdMdN�ZBdfdOdP�ZCdfdQdR�ZDdfdSdT�ZEdUdV�ZFdWdX�ZGdYdZ�ZHdgd\d]�ZI�fd^d_�ZJ�fd`da�ZKdfdbdc�ZLddde�ZM�ZNS)hr�r)�SqueezerzIDLE Shell ))rZ_File)ZeditZ_Edit)rcZ_Debug)�optionsZ_Options)ZwindowZ_Window)�helpZ_Help)ZSqueeze�<<squeeze-current-text>>rcCs|ddkS)NrrRr))Z
rmenu_itemr)r)r*r�mr�zPyShell.<lambda>)zCopy with prompts�<<copy-with-prompts>>rSFr�)�History)�ShellSidebarNcCsXtr|j}|dddkr|�dd�t|�|_|dur+t�}t|�|��t|�}d|_	t
�||dd�d|_d|_
ttd�rDtjnd|_|j�d	�d
|_|j|_|j}|jdd�|�d
|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�tr�|�d|j �|�d|j!�|�"|�|_#|�d|j$�tj%|_&tj'|_(tj)|_*ddl+m,}t-|d|j.|j/�|_)t0|d|j.|j/�|_%t0|d|j.d�|_'t0|d|j.|j/�|_1ts�|j%t_%|j't_'|j)t_)z
ddl2}|j3|_4Wntj5t_'�|�6|j�|_7d|_8|�9|�|_	|j:j;j|j_|j:�<t=��dS)Nr�r�shell)r_ZShe_llF��ps1z>>>
rrr3�char)�wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>�<<toggle-debugger>>rr\z<<view-restart>>z<<restart-shell>>r[)�iomenur�r�r��backslashreplacer��2)>r9�
menu_specsrer�rb�Tkr�withdrawr��
shell_sidebarrrCZusetabsZindentwidth�hasattrr�ra�sys_ps1rBZprompt_last_line�promptrDZ	configurerE�enter_callback�linefeed_callback�cancel_callback�eof_callbackrM�toggle_debugger�toggle_jit_stack_viewer�copy_with_prompts_callback�view_restart_mark�
restart_shellrX�squeezer�squeeze_current_text_eventr��save_stdoutr��save_stderrr��
save_stdinr-rer�encoding�errorsrr��pydocZ
plainpagerZpagerrr]�historyrr^�perr�Zinsertfilterr�)r@rH�msr{rDrerr)r)r*rC{s�
�����zPyShell.__init__cs&t���|jdur|j��dSdSr,)r��	ResetFontrkZupdate_fontr�r�r)r*r��s

�zPyShell.ResetFontcs�t���t��}ddd�t�|d�t�|d�t�|d�d�}|��D]\}}|jj|fi|��q#|jdur>|j�	�dSdS)N)rXrWr�r�r))r�r�r�r�)
r��ResetColorizerrrZr[�itemsrDZ
tag_configurerkZ
update_colors)r@r\Z
tag_colorsr�Ztag_colors_configr�r)r*r��s



�
�zPyShell.ResetColorizercCstj|jdd�dS)Nr�)Zinsert_tagsrU)rrDr�r)r)r*�
replace_event�szPyShell.replace_eventcCstjdd�S)NT)Z
shell_only)rZ
GetExtensionsr�r)r)r*�get_standard_extension_names�sz$PyShell.get_standard_extension_namescs^	�j�||�}ttt|��tt|���}�fdd�|D�}d�dd�t||���D��dS)Ncsg|]	}�jj�|��qSr))rkZline_prompts�get)r�r(r�r)r*r��s��z+PyShell.get_prompt_text.<locals>.<listcomp>rrcss.�|]\}}|dur|n|�d|��VqdS)N� r))r�rnr r)r)r*�	<genexpr>�s
��
�z*PyShell.get_prompt_text.<locals>.<genexpr>)rDr�r�rgrhrL�zip�
splitlines)r@�firstZlastrDZlineno_rangeZpromptsr)r�r*�get_prompt_text�s

�
�
��zPyShell.get_prompt_textcCs`	|j}|�d�}|durdS|�d�}|ddkr|�d�}|��|�||�}|�|�dS)Nzsel.first linestart�sel.lastr3�0zsel.last+1line linestart)rDr^Zclipboard_clearr�Zclipboard_append)r@rirDZselfirstZsellastZprompt_textr)r)r*ru�s


z"PyShell.copy_with_prompts_callbackcCs|adSr,�r!)r@�streamr)r)r*�set_warning_streamszPyShell.set_warning_streamcCstSr,r�r�r)r)r*�get_warning_stream�zPyShell.get_warning_streamcCsJ|jrtjdd|jd�|��dS|j��}|r|��dS|��dS)NzDon't debug nowz*You can only toggle the debugger when idlerrU)	r�rr|rD�set_debugger_indicatorrbr��close_debugger�
open_debugger)r@ri�dbr)r)r*rss�
zPyShell.toggle_debuggercCs|j��}|�d|�dS)Nrd)rbr�Zsetvar�r@r�r)r)r*r�'s
zPyShell.set_debugger_indicatorcCsdSr,r)r�r)r)r*rt+r�zPyShell.toggle_jit_stack_viewercCsh|j��}|r.|j�d�|��|jjrt�|jj�|��|j�	d�|j
|_|��|�
�dS)Nz[DEBUG OFF]
)rbr�r"r�r�rZclose_remote_debuggerrr�r"rmrnr�r�r�r)r)r*r�.s
zPyShell.close_debuggercCsX|jjr
t�|jj|�}nt�|�}|j�|�|��d|j|_	|�
�|��dS)Nz[DEBUG ON]
)rbr�rZstart_remote_debuggerrZDebuggerr"rrmrnr�r�)r@Zdbg_guir)r)r*r�;s
�
zPyShell.open_debuggercCs |jrdnd}|�dd|�dS)N�disabledr)rcz*tack*iewer)r�Zupdate_menu_state)r@�stater)r)r*�debug_menu_postcommandGszPyShell.debug_menu_postcommandcCs	|��d|_dS�NT)rr�r�r)r)r*rRKs
zPyShell.beginexecutingcCs	d|_d|_|��dSr
)r�rUr�r�r)r)r*rPszPyShell.endexecutingcCsF	|jrtjddd|jd�}|durdS|��d|_d|_t�|�S)NzKill?z7Your program is still running!
 Do you want to kill it?�okrQF�cancelT)	r�rZaskokcancelrDr�rUrrr�)r@rr)r)r*r�Vs�
z
PyShell.closecCsX	|��tr|j��|jt_|jt_|j	t_
d|_d|_d|j_
d|_t�|�dSr,)r�r9rbrrzr�r�r{r�r|r�r�rHrar�rr�r�r)r)r*r�es
zPyShell._closecCs	dSr�r)rCr)r)r*�ispythonsourceur�zPyShell.ispythonsourcecCr#r,)�shell_titler�r)r)r*�short_titleyr$zPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs�|j�dd�|��trd}|j��}|s|��dSnd}tjt	_|�
dt	jt	j|j
|f�|j��|��ddl}d|_d|_dS)	Nr�rerVFz�==== 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)rDr�rr9rbr�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|jsdSd|_|j��dSr�)�reading�_stop_readline_flagr��quitr�r)r)r*r��szPyShell.stop_readlinecCs�|j}z
d|_|j��W||_n||_w|jrd|_dS|j�dd�}t|�dkr,d}|��|jr:d|_t	s:t
�|jrBd|_d}|S)NTFrVr�r�rrr)r�r��mainloopr�rDr�r�rrUr9r�	endoffile)r@r9r r)r)r*�readline�s(zPyShell.readlinecCsdSr�r)r�r)r)r*�isatty�r�zPyShell.isattycCs�z
|j�ddd�rWdSWnY|js(|js(|��|j�d�|��dSd|_d|_	|jrE|jj
rE|j��r@|j��n|j�
�|jrM|j��dS)N�	sel.firstz!=r�zKeyboardInterrupt
rUFT)rDr�r�r�rrbr"r�r�rUr�r�rr	r�r�r�r)r)r*rq�s(�


zPyShell.cancel_callbackcCsh|jr|jsdS|j�ddd�r|j�ddd�sdS|js'|��|��dSd|_d|_|j�	�dS)Nr�z==rer�FTrU)
r�r�rDr�rr�rUr�r�r�r�r)r)r*rr�s��
zPyShell.eof_callbackcCs2|jr|j�dd�|j�d�dS|�|�dS)NrerrrU)r�rDre�see�newline_and_indent_eventr�r)r)r*rp�s
�zPyShell.linefeed_callbackc	Cs|jr|jsdSz|j�dd�}|r#|j�ddd�r#|�||�WdSWnY|j�ddd��r|j�d	d�}|r�|j�dd|d
�r�d|j�d�vr�|j�dd�}|rj|j�|d
d|d
�rj|d
|d
f}|j�dd�}|r�|j�|d
d|d
�r�|d
|j�	|d
d�f}|�|j�|d
|d
�|�dS|j�d	d�}|r�|j�dd|d
�r�|j�dd�}|r�|j�|d
d|d
�r�|d
|j�	|d
d�f}|�|j�|d
|d
�|�dS|j�dd�}|�r	|j�|d
dd��r	|�|j�|d
d�|�dS|�|j�dd�|�dS|j�ddd��r&|j�
dd�|j�dd�}|�r<|���s<|j�dd�|j�ddd��rL|�
|�dS|j�
dd�|j�re|j�dd�|j�d�n|�
|�|j��|j�rz|j��dS|��dS)Nr�r�z<=r�rUrer��iomark linestartr�rr�z>=rz+1czinsert lineendrjr�zend-1c linestartrr)r�r�rDr�r��recallZ
tag_prevrangeZ	tag_namesZ
tag_nextranger^r��stripr�r�rer�Zupdate_idletasksr�r��runit)	r@ri�sel�prevZ	prev_consZ	next_cons�next�indicesr�r)r)r*ro�sx�����



�zPyShell.enter_callbackc	Cslt�dd|�}t�dd|�}|�d�}|j��z�|j�ddd�|j�dd	�|j�d
d�}|���	d�rB|�
|�|j�d
d�}|j�d|d��|j
�t|�d
kr�t�d|d��d�}t�d|��d�}|d
d�D],}|�|�r�||t|�d�}|j�dd|��|j
�qoW|j�d�|j��dSW|j�d�|j��dS|j�d�|j��w)Nz^\s*\nrVz\n\s*$rrr�rmr�rer�rj�:rrz	^([ \t]*))�re�subrBrDZundo_block_startrlr�r��rstrip�endswithr�rer��user_input_insert_tagsr��search�grouprwr�Zundo_block_stop)r@r�rir~�prefixZorig_base_indentZnew_base_indentr r)r)r*r�6s>


�
��
��zPyShell.recallz[ \t]*(\n[ \t]*)?\ZcCsj|j�d�}|j�dd�}|j�d|�}|j�|�}|s3|j�|�dkr,|j�|j|�|j	�
�dSdS)N�end-2cr�r�rVrr)rDr^r��_last_newline_rer�rbr@rlr�rk�update_sidebar)r@Zindex_beforer Zinput_is_completer)r)r*r�Ss�z
PyShell.runitcCsZ|jjr	|j��SztjWntjdd|jd�YdSddlm	}||j
|j�dS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)rr)�StackBrowser)rbr�rr��last_tracebackrr|rDZidlelib.stackviewerr�r{rH)r@rir�r)r)r*rM_s

�zPyShell.open_stack_viewercCs|j�d�|j�d�dS)Nr�r�)rDr�r�r)r)r*rvmszPyShell.view_restart_markcCs	|jjdd�dS)NTr�)rbrr�r)r)r*rwqszPyShell.restart_shellcCs||��|j}|jr|�|j�r|dt|j��}|j�dd�|j�|�|j	�
�|j�dd�|��|j
��dS)Nr�z	iomark-1crer�)rrnrmr�r�rDr]r�r"rkr�r��set_line_and_columnrNZ
reset_undo)r@rnr)r)r*r�us
zPyShell.showpromptcCsP|jjj}t|ddd�}d�|�|��}|�d�s|d7}|jj�	d|d�dS)N�T)r��tabsizeZexpand_tabsrrr�r�)
rbr�r�rrLrcr�r�Zbottomre)r@rEr��wrapperZwrapped_msgr)r)r*�show_warning�s

zPyShell.show_warningcCsb|j�dd�}|jr|j�|�|j�d�dkr|j�dd�|j�dd�|��|j��dS)Nr�r�r�rr)	rDr�r��storerer�r�ZctipZremove_calltip_window)r@r5r)r)r*r�szPyShell.resetoutputr)cCsRz|j�dd�t�|||d�}|j�dd�Wn�|jr'd|_ts't�|S)Nr��rightr�F)rDr�rr"rUr9r)r@r�r��countr)r)r*r"�sz
PyShell.writecs:z
|j�ddd�rWdSWn
tyYdSwt���S)Nr�r�r�r�)rDr�r�r�rQr�r�r)r*rQ�s��
zPyShell.rmenu_check_cutcs|j�ddd�r
dSt���S)Nrer�r�r�)rDr�r�rTr�r�r)r*rT�s
zPyShell.rmenu_check_pastecCs|j��|j��dSr,)rxZsqueeze_current_textrkr�r�r)r)r*ry�s
z"PyShell.squeeze_current_text_eventcCs|j��dSr,)rkr�)r@r^rDr�r)r)r*�on_squeezed_expand�szPyShell.on_squeezed_expandr,)r))Or�r�r�Zidlelib.squeezerrXrr�r�rr�rrhrr�r�r6�	itertools�	takewhileZ_idxreZallow_line_numbersr�Zidlelib.historyr]Zidlelib.sidebarr^rCr�r�r�r�r�rur�r�rUr�rr�r�r�rsr�rtr�r�r�rRrr�r�r�r�r�r�r�r�r�rqrrrpror�r�r�r�r�rMrvrwr�r�rr"rQrTryr�r�r)r)r�r*r�Us�

�

�
N



�
	O






r�c
Cs8	|jdkrdD]}|�|dd|�|d��qdSdS)NZx11)ZTextZEntryZSpinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
)Z_windowingsystemZ
bind_class)r{�clsr)r)r*�
fix_x11_paste�s

���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
sJddl}ddlm}ddlm}ddlm}td�dad}d}d}d}d}d}	z|�tj	dd�d�\}
}Wn#|j
yZ}ztd	|tftj
d
�t�d�WYd}~nd}~ww|
D]d\}
}|
dkri|}d}|
d
krqd}d}|
dkrwd}|
dkr�tj�t�t��|
dkr�d}|
dkr�tdtj
d
�da|
dkr�|}tj�|�r�n	td|�t��d}|
dkr�d}	d}|
dkr�|t_d}q]|r�|ddkr�tj��}d}tttj��D]}tj�tj|�tj|<q�|r�|ddkr�dg|dd�t_	nU|�rdg|t_	nK|�r|g|t_	nA|�r>d}g}|D]}|�tj�|���q|D]}tj�|�}|tjv�r;tj�d|��q&nt��}|tjv�rOtj�d|�tj ddddd�}|�p\|}|�pb|}t�rl|�slt!�t"dd�a#t#�$�dd l%m&}|t#�tj�'tj�t(�d!��|�d"k�r�tj�'�d#�}t#j)|d$�n-|�*��s�t+d%k�r�d&�d'}nd(�d)}��fd*d+�|D�}d,d+�|D�}t#j,dg|�R�t-t#�t.t#�t/t#�a0|�1t#t0�|�r|�s|�s|dd�D]}t0�2|�du�r�|�3|��q�|�st0�4�|�rt0�5�}|�sdS|�*��rt0j6�r|j7�8�nt0j9}|�r)|�:�|	�rItj;�<d-��p8tj;�<d.�}|�rItj�|��rI|j=�>|�|�sO|�rs|j=�?d/tj	f�|�rc|j=�@|�n,|�rr|j=�A|�|j=�>|�n|�r�|�Bt#�}|�r�|�C|�|�D�}|�r�|�C|�t0jE�r�t#�F�t0jE�s�t#�G�td�dS)0Nr)�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�-rVr�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)rJrKrL)r��size��extZicondirr)r*r�bs�zmain.<locals>.<listcomp>cSsg|]}tt|d��qS))Zmasterr)Z
PhotoImager{)r��iconfiler)r)r*r�ds�ZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
)H�getoptr�r�r-r�r�r1r9r��argv�errorr�	usage_msgr��exitr�r"rJrKr�r�r�r�r8r�r�r:r`�dirnamere�getcwdrr�Z
NoDefaultRootrir{rj�idlelib.runr
rL�__file__Z
wm_iconbitmapZisAquaTk�	TkVersionZwm_iconphotorr�r�rHZsetupApprurk�newrI�dictr��lowerrar��environr�rbr3rr6rDZtkVersionWarningr�ZpreferTabsPreferenceWarningZinversedictr�Zdestroy)r�r�r�r�Zenable_shellZenable_editrc�cmdZscriptZstartupZoptsrPrE�o�ar�Zpathxr'�dirZ
edit_startr
r�ZsizesZ	iconfilesZiconsr_ZtkversionwarningZprefer_tabs_preference_warningr)r�r*r��s6���
�
���



��
�
�
���


�r�)NN)Xr�r�r�r��ImportErrorrrrTr�ZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessr#r$rr�rir{rjr�r
r|r?r
r�r4rJZos.pathrr�r�r��textwraprrr�r7r.Zidlelib.colorizerrZidlelib.configrZidlelib.delegatorrr-rrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrrZidlelib.undorr9r�r��eofr�r��	NameErrorr!r+r-r1�
checkcacher;r<r�r�r�r�Z	RPCClientr�r�r�r�r�r�r�r)r)r)r*�<module>s���
��
�
�

�?
"0g6
6