AlkantarClanX12

Your IP : 18.222.92.56


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/PyShell.cpython-35.opt-2.pyc



���]���@s_ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZyddlTWn2ek
r�eddej�ejd�YnXddljZddlmZmZdd	lmZdd
lmZddl m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)ddl&m*Z*dZ+dZ,eja-ddl.Z.ddd�Z/dddd�Z0da1dd�Z2e2d�dej3dd�Z4e4e_3Gdd�de�Z5Gdd�de�Z6Gd d!�d!e�Z7Gd"d#�d#e!�Z8Gd$d%�d%e'j9�Z:Gd&d'�d'e
�Z;Gd(d)�d)e#�Z<Gd*d+�d+e
j=�Z>Gd,d-�d-e>�Z?Gd.d/�d/e>�Z@d0d1�ZAd2ZBd3d4�ZCeDd5krQejEd5ejEd)<eC�e2d6�dS)7�N)�InteractiveInterpreter)�python_version�system)�*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **�file�)�EditorWindow�
fixwordbreaks)�FileList)�ColorDelegator)�
UndoDelegator)�OutputWindow)�idleConf)�rpc)�Debugger)�RemoteDebugger)�
macosxSupportz	127.0.0.1cCssd}|d||f7}|dkr8tj||�}|j�}|rX|d|7}|d|j|f7}|S)Nz!
Warning (from warnings module):
z  File "%s", line %s
z    %s
z%s: %s
)�	linecache�getline�strip�__name__)�message�category�filename�lineno�line�s�r�,/opt/alt/python35/lib64/python3.5/PyShell.py�idle_formatwarning0srcCsd|dkrt}y3|jt||||d|��|jd�Wnttfk
r_YnXdS)Nrz>>> )�warning_stream�writer�AttributeError�OSError)rrrrrrrrr�idle_showwarning=s	r$cCsF|r'tdkrBtjatt_ntdk	rBtt_dadS)N)�_warnings_showwarning�warnings�showwarningr$)�capturerrr�capture_warningsPs		r)TcCsxtj}i}xKt|�D]=}|dd�|dd�dkr|j|�||<qW||�|j|�dS)Nrz<>���)r�cache�list�pop�update)rZorig_checkcacher+�save�keyrrr�extended_linecache_checkcache_s	$
r1c@s�eZdZdd�Zd&d'd(d)d*d+gZddd�Zdd�Zddd�Zddd�Zdd�Z	dd�Z
dd�Zd d!�Zd"d#�Z
d$d%�ZdS),�PyShellEditorWindowcGs�g|_tj||�|jjd|j�|jjd|j�|jjd|jj�t	j
jtj
�d�|_|jj|dd�}|jj|�|jjr�|j�|j�dS)Nz<<set-breakpoint-here>>z<<clear-breakpoint-here>>z<<open-python-shell>>zbreakpoints.lstcSs|j�|�dS)N)�restore_file_breaks)Zold_hook�selfrrr�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�joinrZ
GetUserCfgDir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookrr3�color_breakpoint_text)r4�argsr5rrrr7ys		
zPyShellEditorWindow.__init__�Cut�<<cut>>�rmenu_check_cut�Copy�<<copy>>�rmenu_check_copy�Paste�	<<paste>>�rmenu_check_pasteN�Set Breakpoint�<<set-breakpoint-here>>�Clear Breakpoint�<<clear-breakpoint-here>>TcCsc|jdkrdS|r:tj�}tj|d�}nddddi}|jjd|�dS)N�break�
foreground��
background�BREAK)rBr�CurrentTheme�GetHighlightr8Z
tag_config)r4Zcolor�themeZcfgrrrrC�sz)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|jdd|d|d�y|jj|�Wn"tk
rl|jj|�YnXy&|jj	j
j}|j||�WnYnXdS)NrVz%d.0r)
r8rBr�tag_addr6�index�
ValueError�appendr<�pyshell�interp�debuggerr:)r4rr8r�debugrrr�set_breakpoint�s	
z"PyShellEditorWindow.set_breakpointcCsU|j}|jj}|s)|j�dStt|jd���}|j|�dS)N�insert)r8rBr�bell�int�floatr[rb)r4�eventr8rrrrrr:�s	
z'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s)|j�dStt|jd���}y|jj|�WnYnX|j	ddd�y&|j
jjj
}|j||�WnYnXdS)NrcrVzinsert linestartzinsert lineend +1char)r8rBrrdrerfr[r6�remove�
tag_remover<r^r_r`r;)r4rgr8rrrarrrr;�s"	
z)PyShellEditorWindow.clear_breakpoint_herec	Cs�|jr||j}|jj}|s2|j�dSg|_|jddt�y#|jjj	j
}|j|�WnYnXdS)NrVz1.0)r6r8rBrrdriZENDr<r^r_r`�clear_file_breaks)r4r8rrarrrrj�s		
	z%PyShellEditorWindow.clear_file_breaksc Cs[|j}|jj}y,t|jd��}|j�}WdQRXWntk
r[g}YnXy�t|jd��p}x.|D]&}|j|d�s{|j|�q{W|j	�|j}|r�|j|dt
|�d�WdQRXWnotk
rV}zOt|jdd�sDd|j_
tjdd	d
dt
|�d|j�WYdd}~XnXdS)
N�r�w�=�
�breakpoint_error_displayedFT�titlez
IDLE Errorrz$Unable to update breakpoint list:
%s�parent)r6rBr�openrA�	readlinesr#�
startswithr!�update_breakpoints�str�getattr�rootro�tkMessageBox�	showerrorr8)r4Zbreaksr�fp�linesZnew_filer�errrrr�store_file_breaks�s.	


	*
z%PyShellEditorWindow.store_file_breakscCs�|jj�|jdkr dS|jj}|dkr<dStjj|j�r�t|jd��}|j	�}WdQRXx_|D]W}|j
|d�r�t|t|�dd��}x|D]}|j
|�q�Wq�WdS)Nrkrmr)r8r.rBrr>r?�isfilerArrrsrt�eval�lenrb)r4rr{r|rZbreakpoint_linenumbersZbreakpoint_linenumberrrrr3s

 
z'PyShellEditorWindow.restore_file_breakscCs4|j}|jd�}|j|�}||_dS)NrV)r8Z
tag_ranges�ranges_to_linenumbersr6)r4r8�rangesZlinenumber_listrrrrus	z&PyShellEditorWindow.update_breakpointscCs�g}x�tdt|�d�D]f}tt||j��}tt||dj��}x'||kr�|j|�|d7}q^WqW|S)Nr�r)�ranger�rerf�stringr])r4r�r|r[r�endrrrr�s
z)PyShellEditorWindow.ranges_to_linenumberscCs|j�tj|�dS)N)rjr�_close)r4rrrr�-s
zPyShellEditorWindow._close)rErFrG)rHrIrJ)rKrLrM)NNN)rNrON)rPrQN)r�
__module__�__qualname__r7Zrmenu_specsrCrbr:r;rjr~r3rur�r�rrrrr2vs"		*r2c@s+eZdZeZdZddd�ZdS)�PyShellFileListNcCsN|jr|jjj�n+t|�|_|jrG|jj�sGdS|jS)N)r^�top�wakeup�PyShell�begin)r4rgrrrr=<s		zPyShellFileList.open_shell)rr�r�r2rr^r=rrrrr�3sr�c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ModifiedColorDelegatorcCstj|�|j�dS)N)rr7�LoadTagDefs)r4rrrr7Js
zModifiedColorDelegator.__init__cCs7|jddd�|jddd�tj|�dS)NZTODOz1.0�iomarkZSYNC)rirZr�recolorize_main)r4rrrr�Nsz&ModifiedColorDelegator.recolorize_maincCsutj|�tj�}|jjdddddidtj|d�dtj|d�dtj|d�i�dS)N�stdinrUrS�stdout�stderr�console)rr�rrW�tagdefsr.rX)r4rYrrrr�Ss
	z"ModifiedColorDelegator.LoadTagDefscCs+x$|jD]}|j|dd�q
WdS)Nr�r�)r�ri)r4�tagrrr�removecolors]sz#ModifiedColorDelegator.removecolorsN)rr�r�r7r�r�r�rrrrr�Gs
r�c@s.eZdZddd�Zddd�ZdS)�ModifiedUndoDelegatorNc
Cs\y-|jj|dd�r,|jj�dSWntk
rAYnXtj||||�dS)N�<r�)�delegate�comparerd�TclErrorrrc)r4r[�chars�tagsrrrrces

zModifiedUndoDelegator.insertcCsYy-|jj|dd�r,|jj�dSWntk
rAYnXtj|||�dS)Nr�r�)r�r�rdr�r�delete)r4Zindex1Zindex2rrrr�ns

zModifiedUndoDelegator.delete)rr�r�rcr�rrrrr�bs	r�c@seZdZdd�ZdS)�MyRPCClientcCs
t�dS)N)�EOFError)r4rrr�
handle_EOFzszMyRPCClient.handle_EOFN)rr�r�r�rrrrr�xsr�c@s�eZdZdd�ZdZdZdZdd�Zdd�Zdd	�Z	d
ddd
�Z
dd�Zdd�Zdd�Z
dd�Zd
dd�ZdZdd�ZdZdd�Zdd�Zdd�Zd d!�Zd"Zd#d$�Zdd%d&�Zd'd(�Zd)d*�Zd+d,�Zdd-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%dS)?�ModifiedInterpretercCsf||_tjdj}tj|d|�d|_d|_d|_t	|_
|jjj
|_dS)N�__main__�localsF)�	tkconsole�sys�modules�__dict__rr7�save_warnings_filters�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r4r�r�rrrr7�s					zModifiedInterpreter.__init__NcCs7|jdkr|j�|_tj|j�|_dS)N)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubproc)r4rrr�spawn_subprocess�sz$ModifiedInterpreter.spawn_subprocesscCs�dd�tjD�}tjddddddd	�}td
krSd|f}n
d|f}tjg|d
|t|j�gS)NcSsg|]}d|�qS)z-Wr)�.0rrrr�
<listcomp>�s	z@ModifiedInterpreter.build_subprocess_arglist.<locals>.<listcomp>�main�Generalzdelete-exitfunc�defaultF�type�boolzidlelib.PyShellz&__import__('idlelib.run').run.main(%r)z__import__('run').main(%r)z-c)r��warnoptionsr�	GetOptionr�
executablervr�)r4rlZ	del_exitfZcommandrrrr��s
z,ModifiedInterpreter.build_subprocess_arglistcCs�t|jf}xXtd�D]<}tj|�yt|�|_PWqtk
rWYqXqW|j�dS|jj	j
�d|_tdkr�|jj	jt
jt
jd�|j�|jj	jd�y|jj�Wn#t
jk
r|j�dSYnX|jjd|j�|jjd|jj�|jjd|jj�|jjd|jj�|jjd	|jj�|jjd
t�|jjd|�|jdd
�|j�|jS)N�rr�
r�r�r�r�r<rr_�with_cwdT)�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�r<r�
transfer_path�poll_subprocess)r4�addr�irrr�start_subprocess�s>

	



	
z$ModifiedInterpreter.start_subprocessFrTcCs�|jr|jSd|_|j�}|rJytj|j�WnYnX|jj�|j�|j}|j}d|_|j	�y|jj
�Wn#tjk
r�|j
�dSYnX|jd|�|j�|jjdd�d|r�|nd}t|j�t|�dd	d
}|jdj||��|jjdd�|jjdd
�|st|j�|r�tj|j�|j�|j|jj_d|_|jS)NTFr�r�zend-1cz	RESTART: ZShell�r�rmz
{0} {1} {0}�restart�left) r�r��getdebuggerrZclose_subprocess_debugger�close�terminate_subprocessr��	executingr�r�r�r�r�r��
stop_readliner8r�re�widthr�r!�format�mark_set�mark_gravity�
showpromptZrestart_subprocess_debugger�load_breakpointsr�r�r�r�)r4r�rrar�Z
was_executingr�Zhalfbarrrr�restart_subprocess�sH		

			

	
%

	z&ModifiedInterpreter.restart_subprocesscCs|jjddfi�dS)N�execZinterrupt_the_server)r�Z
remotecall)r4rrrZ__request_interrupt�sz'ModifiedInterpreter.__request_interruptcCstjd|j�j�dS)N�target)�	threading�Thread�'_ModifiedInterpreter__request_interrupt�start)r4rrr�interrupt_subprocess�sz(ModifiedInterpreter.interrupt_subprocesscCs�|jdk	r%|jjj|j�y|jjj�Wntk
rMYnXy|jj�Wntk
rsYnX|j�d|j_	d|_dS)NF)
�_afteridr�r8Zafter_cancelr�r�r�r"r�r�)r4rrr�kill_subprocesss


z#ModifiedInterpreter.kill_subprocesscCsXy|jj�Wntk
r)dSYn+Xy|jj�Wntk
rSdSYnXdS)N)r��killr#�wait)r4rrrr�s
	
z(ModifiedInterpreter.terminate_subprocesscCsC|r"dg}|jtj�n	tj}|jd|f�dS)NrTzRif 1:
        import sys as _sys
        _sys.path = %r
        del _sys
        
)�extendr�r?�
runcommand)r4r�r?rrrr�s		z!ModifiedInterpreter.transfer_pathcCs�|j}|dkrdSy|j|jdd�}Wn;tttfk
rr|jjr^dSd}|j�YnX|rd|jj	�d|_|\}}|jj
}|dkr�|dk	r>tt|�d|�nf|dkr|jj
d�r>|j�n;|dkr>d}t||dtj�t||d|�y|jj�Wntk
rcYnX|jjs�|jjj|jj|j�|_dS)	Nr�g�������?ZOKrZ	EXCEPTIONz<<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"r8�after�pollintervalr�r�)r4Zclt�response�howZwhatr��errmsgrrrr�,s@	
	

z#ModifiedInterpreter.poll_subprocesscCs
||_dS)N)r`)r4r`rrr�setdebuggerTszModifiedInterpreter.setdebuggercCs|jS)N)r`)r4rrrr�WszModifiedInterpreter.getdebuggercCs|jjjd|j�dS)Ni,)r�r8rr)r4rrr�open_remote_stack_viewerZs
z,ModifiedInterpreter.open_remote_stack_viewercCs�ddlm}|jjdddi�}|dkrK|jjj�dS|j|j|�}ddlm	}m
}t|jj�}tj
�}tj|d�d}||d	|d
d�}	|	jjddd
d�||	jd|�}
|
j�dS)Nr)�RemoteObjectBrowserr�Zstackviewerr<)�ScrolledCanvas�TreeNodeZnormalrU�bgZhighlightthickness�expandr�fillZboth)r<)�idlelibrr��remotequeuer�rxrdZStubObjectTreeItemZidlelib.TreeWidgetrr
ZToplevelrrWrX�frame�packZcanvasr)r4rZoid�itemrr
r�rYrUZscZnoderrrrgsz'ModifiedInterpreter.remote_stack_viewerrcCs#|j|�}|j||�dS)N)�stuffsource�execfile)r4�sourcerrrr�
execsourcezszModifiedInterpreter.execsourcecCs�|dkr1tj|��}|j�}WdQRXyt||d�}WnXttfk
r�|jj�tdd|jj	�t
j||�|jj�YnX|j
|�dS)Nr�zB*** Error in script or command!
Traceback (most recent call last):r)�tokenizerr�readr��
OverflowError�SyntaxErrorr�r�r�r�r�showsyntaxerrorr��runcode)r4rrr{�coderrrrs
	
zModifiedInterpreter.execfilec
Cs�|j|�}d|_tjdd�|_tjdddt�ztj|||�SWd|jdk	r�|jtjdd�<d|_XdS)Nr�action�errorr)	rZmorer&�filtersr��filterwarnings�
SyntaxWarningr�	runsource)r4rrrrrr&�s	zModifiedInterpreter.runsourcecCsSd|j}|jd|_|jd�}t|�dd||ftj|<|S)Nz<pyshell#%d>rrnr)�gid�splitr�rr+)r4rrr|rrrr�s

#zModifiedInterpreter.stuffsourcecCs|jd|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�)r4rrrr�prepend_syspath�sz#ModifiedInterpreter.prepend_syspathcCs|j}|j}|jddd�tj�\}}}t|dd�pU|pUd}t|dd�pmd}t|d	d�p�d
}	|	d
kr�|d7}|dkr�d|	d}
nd|d|	df}
|j||
�|j�|jd
|�|j	�dS)Nr�z1.0r��msgrTz<no detail available>rr�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
)
r�r8rir��exc_inforwZcolorize_syntax_errorr�r!r�)r4rr�r8r��value�tbr*rr+�posrrrr�s"		

z#ModifiedInterpreter.showsyntaxerrorcCsG|jj�|j�tj|�|jjd�rC|jj�dS)Nz<<toggle-jit-stack-viewer>>)r�r��checklinecacher�
showtracebackr�open_stack_viewer)r4rrrr1�s



z!ModifiedInterpreter.showtracebackcCsUtj}xEt|j��D]1}|dd�|dd�dkr||=qWdS)Nrz<>r*)rr+r,�keys)r4�cr0rrrr0�s	$z"ModifiedInterpreter.checklinecachecCsV|jjr|j�dS|jrB|jjdd|fi�nt||j�dS)Nrr�rr)r�r��display_executing_dialogr�rr�r�)r4r rrrr��s
	zModifiedInterpreter.runcommandcCs�|jjr|jj�|j�|jdk	rQ|jtjdd�<d|_|j}zNyw|jj	�|r�|j
dk	r�|j
jdd|fi�|_n,|r�|j
||j�nt||j�Wn�tk
r.|jjs'tjddddd|jj�r�q*|j�n�Ynytrgtdd	|jj�|j�|jj�n;|jjr�d
|j_tdd	|jj�n
|j�YnXWdts�y|jj�Wntk
r�YnXXdS)Nr�rzExit?zDo you want to exit altogether?r��yesrqz IDLE internal error in runcode()rFr�)r�r�r_r�r0r�r&r#r`�beginexecutingr�Z
asyncqueuer��runr�r��
SystemExitr�ryZaskyesnor8r1�use_subprocessr�r�r�canceledr")r4r r`rrrr�sP

		


	


zModifiedInterpreter.runcodecCs|jjj|�S)N)r�r�r!)r4rrrrr!"szModifiedInterpreter.writecCs tjddd|jj�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.rq)ryrzr�r8)r4rrrr�&sz.ModifiedInterpreter.display_port_binding_errorcCs tjddd|jj�dS)NzSubprocess Startup Errorz�IDLE's subprocess didn't make connection.  Either IDLE can't start a subprocess or personal firewall software is blocking the connection.rq)ryrzr�r8)r4rrrr�1sz/ModifiedInterpreter.display_no_subprocess_errorcCs tjddd|jj�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.rq)ryrzr�r8)r4rrrr59sz,ModifiedInterpreter.display_executing_dialog)&rr�r�r7r�r�r�r�r�r�r�r�r�r�r�r�r�r�r`r	r�r
rr'rrr&rr)rr1r0r�rr!r�r�r5rrrrr�sF
+-

&
1r�cs/eZdZde�dZeZeZdVdWdXdYdZd[gZ	ddl
mZddd�Zdd�Z
dZdZdZdZdZdZdd�Zdd�Zddd�Zdd�Zddd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z d1Z!d2d3�Z"d4d5�Z#d6d7�Z$d8d9�Z%dd:d;�Z&d<d=�Z'd>d?�Z(d@dA�Z)dBdC�Z*dDdE�Z+ddFdG�Z,ddHdI�Z-ddJdK�Z.dLdM�Z/dNdO�Z0fdPdQ�Z1�fdRdS�Z2�fdTdU�Z3�S)\r�zPython z Shellr�_File�edit�_Editra�_Debug�options�_Options�windows�_Window�help�_Helpr)�HistoryNc	Cs�tr3|j}|dddkr3|jdd�t|�|_|dkrwt�}t|�|j�t|�}t	j
||dd�d|_d|_d|_
|j}|jdd�|jd	|j�|jd
|j�|jd|j�|jd|j�|jd
|j�|jd|j�|jd|j�trr|jd|j�|jd|j�tj|_tj|_tj|_ ddl!m"}t#|d|j$�|_t%|d|j$�|_t%|d|j$�|_t%|d|j$�|_&ts0|jt_|jt_|jt_yddl'}|j(|_)Wntj*t_�YnX|j+|j�|_,d|_-dS)Nr�r�shell�She_llT��wrap�charz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>z<<toggle-debugger>>z<<toggle-jit-stack-viewer>>z<<view-restart>>z<<restart-shell>>)�	IOBindingr�r�r�r��2)rGrH).r:�
menu_specsrcr�r_�Tkr	�withdrawr�r
r7ZusetabsZindentwidthZcontext_use_ps1r8Z	configurer9�enter_callback�linefeed_callback�cancel_callback�eof_callbackr2�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark�
restart_shellr�r��save_stdoutr��save_stderrr��
save_stdinrrL�PseudoInputFile�encoding�PseudoOutputFiler��pydocZ
plainpagerZpagerrrF�historyr)r4r<�msrxr8rLr_rrrr7Ws\		

				zPyShell.__init__cCstjdd�S)NZ
shell_onlyT)rZ
GetExtensions)r4rrr�get_standard_extension_names�sz$PyShell.get_standard_extension_namesFcCs
|adS)N)r )r4�streamrrr�set_warning_stream�szPyShell.set_warning_streamcCstS)N)r )r4rrr�get_warning_stream�szPyShell.get_warning_streamcCs`|jr0tjddd|j�|j�dS|jj�}|rR|j�n
|j�dS)NzDon't debug nowz*You can only toggle the debugger when idlerqrR)	r�ryrzr8�set_debugger_indicatorr_r��close_debugger�
open_debugger)r4rg�dbrrrrU�s		


zPyShell.toggle_debuggercCs%|jj�}|jd|�dS)Nz<<toggle-debugger>>)r_r�Zsetvar)r4rirrrrf�szPyShell.set_debugger_indicatorcCsdS)Nr)r4rgrrrrV�szPyShell.toggle_jit_stack_viewercCs�|jj�}|r{|jjd�|j�|jjrNtj|jj�|j�|jj	d�dt
_|j�|j
�dS)Nz[DEBUG OFF]
z>>> )r_r�r	r�r�rZclose_remote_debuggerr�r�r!r��ps1r�rf)r4rirrrrg�s

	
zPyShell.close_debuggercCsq|jjr'tj|jj|�}ntj|�}|jj|�|j�dt_|j	�|j
�dS)Nz[DEBUG ON]
>>> )r_r�rZstart_remote_debuggerrr	r�r�rjr�rf)r4Zdbg_guirrrrh�s
	
zPyShell.open_debuggercCs|j�d|_dS)Nr)r�r�)r4rrrr7�s
zPyShell.beginexecutingcCs d|_d|_|j�dS)Nr)r�r;r�)r4rrrr�s		zPyShell.endexecutingcCsc|jr:tjddddd|j�}|dkr:dS|j�d|_d|_tj|�S)	NzKill?z7Your program is still running!
 Do you want to kill it?r��okrqF�cancelT)	r�ryZaskokcancelr8r�r;r�rr�)r4rrrrr��s	
		z
PyShell.closecCsy|j�tr|jj�|jt_|jt_|j	t_
d|_d|_d|j_
d|_tj|�dS)N)rgr:r_r�rYr�r�rZr�r[r�r�r<r^r`rr�)r4rrrr��s

			zPyShell._closecCsdS)NTr)r4rrrr�ispythonsource�szPyShell.ispythonsourcecCs|jS)N)�shell_title)r4rrr�short_title�szPyShell.short_titlez@Type "copyright", "credits" or "license()" for more information.cCs�|jjdd�|j�trOd}|jj�}|sm|j�dSndddd}tjt	_|j
d	t	jt	j|j
|f�|jj�|j�d
dl}d|_dS)Nr�rcrTFz==== No Subprocess ====

z9WARNING: Running IDLE without a Subprocess is deprecated
z;and will be removed in a later version. See Help/IDLE Help
zfor details.

zPython %s on %s
%s
%srT)r8r�r�r:r_r�r�r�displayhookr�r!�version�platform�	COPYRIGHTZfocus_forcer��tkinterZ
_default_root)r4Znosub�clientrtrrrr�s$

	

	z
PyShell.begincCs'|js
dSd|_|jj�dS)NT)�reading�_stop_readline_flagr��quit)r4rrrr�s		zPyShell.stop_readlinecCs�|j}zd|_|jj�Wd||_X|jrFd|_dS|jjdd�}t|�dkrsd}|j�|jr�d|_t	s�t
�|jr�d|_d}|S)NrFrTr�zend-1crrn)rvr��mainlooprwr8�getr�r�r;r:r��	endoffile)r4r/rrrr�readline"s(		
		
				zPyShell.readlinecCsdS)NTr)r4rrr�isatty9szPyShell.isattyc
Cs�y |jjddd�rdSWnYnX|jp:|jse|j�|jjd�|j�dSd|_d|_	|jr�|jj
r�|jj�r�|jj�n
|jj
�|jr�|jj�dS)Nz	sel.firstz!=zsel.lastzKeyboardInterrupt
rRrr)r8r�r�rvr�r_r!r�r{r;r�r�r�r�r�rx)r4rgrrrrS<s&

		
	
zPyShell.cancel_callbackcCs�|jr|jrdS|jjddd�oD|jjddd�sKdS|jsk|j�|j�nd|_d|_|jj	�dS)Nr�z==rczend-1crrrR)
r�rvr8r�r�r�r;r{r�rx)r4rgrrrrTRs	

		
zPyShell.eof_callbackcCs@|jr/|jjdd�|jjd�n
|j|�dS)NrcrnrR)rvr8rc�see�newline_and_indent_event)r4rgrrrrRas
	
zPyShell.linefeed_callbackcCs�|jr|jrdSyK|jjdd�}|ra|jjddd�ra|j||�dSWnYnX|jjddd�r�|jjd	d�}|r�|jjdd|d
�r�|j|jj|d|d
�|�dS|jjd	d�}|rI|jjdd
|d�rI|j|jj|d|d
�|�dS|jjdd�}|r�|jj|ddd�r�|j|jj|d
d�|�n|j|jjdd�|�dS|jjddd�r�|jjdd�|jjdd�}|r/|j	�r/|jj
dd�|jjddd�rX|j|�dS|jjdd�|jr�|jjdd�|jj
d�n
|j|�|jjd	dd�|jj�|jr�|jj�n
|j�dS)Nz	sel.firstzsel.lastz<=r�rRrcr�ziomark linestartr�rrzinsert lineendz>=r�zinsert linestartzend-1czend-1c linestartrn)r�rvr8rzr��recallZ
tag_prevrangeZ
tag_nextranger�rr�rrcr~rZZupdate_idletasksr�rx�runit)r4rg�sel�prev�next�indicesrrrrrQjsX"'"'&
	

	
zPyShell.enter_callbackcCs�tjdd|�}tjdd|�}|jd�}|jj�zC|jjddd�|jjdd	�|jjd
d�}|j�j	d�r�|j
|�|jjd
d�}|jjd|dj��t
|�d
kr�tjd|d�jd�}tjd|�jd�}x^|d
d�D]L}|j|�rg||t
|�d�}|jjdd|j��q8WWd|jjd�|jj�XdS)Nz^\s*\nrTz\n\s*$rnr�z1.0r�rczend-1czinsert linestart�:rrz	^([ \t]*))�re�subr(r8Zundo_block_startrir�rz�rstrip�endswithrrcrr��search�grouprtr~Zundo_block_stop)r4rrgr|�prefixZorig_base_indentZnew_base_indentrrrrr��s*

%zPyShell.recallcCs�|jjdd�}t|�}x.|dkrQ||ddkrQ|d}q$W|dkr|||ddkr||d}x.|dkr�||ddkr�|d}qW|d|�}|jj|�dS)Nr�zend-1crrz 	rn)r8rzr�r_r&)r4rr�rrrr��s# 
#z
PyShell.runitcCss|jjr|jj�SytjWn%tjddd|j�dSYnXddlm	}||j
|j�dS)NzNo stack tracez@There is no stack trace yet.
(sys.last_traceback is not defined)rqr)�StackBrowser)r_r�rr��last_tracebackryrzr8Zidlelib.StackViewerr�rxr<)r4rgr�rrrr2�s
	
	zPyShell.open_stack_viewercCs$|jjd�|jjd�dS)Nr�r�)r8r~)r4rgrrrrW�szPyShell.view_restart_markcCs|jjdd�dS)Nr�T)r_r�)r4rgrrrrX�szPyShell.restart_shellc	Csl|j�yttj�}Wnd}YnX|jj|�|jjdd�|j�|j	j
�dS)NrTrczend-1c)r�rvr�rjr�r!r8r��set_line_and_columnrBZ
reset_undo)r4rrrrr��s

zPyShell.showpromptcCsz|jjdd�}|jr.|jj|�|jjd�dkrY|jjdd�|jjdd�|j�dS)Nr�zend-1czend-2crn)r8rzr`�storercr�r�)r4rrrrr��s	zPyShell.resetoutputcCs�t|t�rst|�rst|�dkrsx't|�D]\}}|dkr:Pq:Wtd|||dd��yB|jjdd�tj	|||d�}|jjdd�Wn�YnX|j
r�d|_
ts�t�|S)	Nu￿zUCS-2rz%Non-BMP character not supported in Tkr��rightr�r)
�
isinstancervr��max�	enumerate�UnicodeEncodeErrorr8r�r
r!r;r:r�)r4rr�r�rK�countrrrr!�s"-			z
PyShell.writecsFy |jjddd�rdSWntk
r8dSYnXt�j�S)Nz	sel.firstr�r��disabled)r8r�r��superrG)r4)�	__class__rrrGs
	zPyShell.rmenu_check_cutcs)|jjddd�rdSt�j�S)Nrcr�r�r�)r8r�r�rM)r4)r�rrrMszPyShell.rmenu_check_paste)rr<)r=r>)rar?)r@rA)rBrC)rDrE)4rr�r�rrnr�rr�rrNZidlelib.IdleHistoryrFr7rbrvr�r;r{r�rwrdrerUrfrVrgrhr7rr�r�rmrorsr�r�r|r}rSrTrRrQr�r�r2rWrXr�r�r!rGrMrr)r�rr�Asd	:
	?	r�c@sOeZdZddd�Zedd��Zedd��Zdd	�ZdS)
�
PseudoFileNcCs||_||_||_dS)N)rGr��	_encoding)r4rGr�r]rrrr7"s		zPseudoFile.__init__cCs|jS)N)r�)r4rrrr]'szPseudoFile.encodingcCsd|jS)Nz<%s>)r�)r4rrr�name+szPseudoFile.namecCsdS)NTr)r4rrrr}/szPseudoFile.isatty)rr�r�r7�propertyr]r�r}rrrrr� sr�c@s(eZdZdd�Zdd�ZdS)r^cCsdS)NTr)r4rrr�writable5szPseudoOutputFile.writablecCst|jrtd��t|�tk	r^t|t�sOtdt|�j��tj|�}|jj	||j
�S)Nzwrite to closed filezmust be str, not )�closedr\r�rvr��	TypeErrorr�__str__rGr!r�)r4rrrrr!8s	zPseudoOutputFile.writeN)rr�r�r�r!rrrrr^3sr^c@sUeZdZddd�Zdd�Zd
dd�Zdd	d
�Zdd�ZdS)r\NcCs#tj||||�d|_dS)NrT)r�r7�_line_buffer)r4rGr�r]rrrr7EszPseudoInputFile.__init__cCsdS)NTr)r4rrr�readableIszPseudoInputFile.readablercCs�|jrtd��|dkr*d}n(t|t�sRtdt|�j��|j}d|_|dkr�x�|jj	�}|s�P||7}qsWn\x6t
|�|kr�|jj	�}|s�P||7}q�W||d�|_|d|�}|S)Nzread from closed filerzmust be int, not rTrr*)r�r\r�rer�r�rr�rGr|r�)r4�size�resultrrrrrLs,				zPseudoInputFile.readcCs�|jrtd��|dkr*d}n(t|t�sRtdt|�j��|jpg|jj	�}|dkr�t
|�}|jdd|�}|dkr�|d}||d�|_|d|�S)Nzread from closed filerzmust be int, not rrnr*)r�r\r�rer�r�rr�rGr|r��find)r4r�rZeolrrrr|cs		
zPseudoInputFile.readlinecCs|jj�dS)N)rGr�)r4rrrr�sszPseudoInputFile.closer*r*)rr�r�r7r�rr|r�rrrrr\Cs
r\cCsG|jdkrCx1dD])}|j|dd|j|d��qWdS)NZx11�Text�Entry�Spinboxz	<<Paste>>z%catch {%W delete sel.first sel.last}
)r�r�r�)Z_windowingsystemZ
bind_class)rx�clsrrr�
fix_x11_pastews
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].
cs�td�dad}d}d}d}d}d}y)tjtjdd�d�\}}WnRtjk
r�}z/td|tfdtj�tj	d�WYdd}~XnXx*|D]"\}	}
|	dkr�|
}d}|	d	kr�d}d}|	d
krd}|	dkr-tj
jt�tj	�|	dkr?d}|	d
krdtddtj�da|	dkr�|
}tj
j|�r�ntd|�tj	�d}|	dkr�d}d}|	dkr�|
t_d}q�W|r
|ddkr
tjj�}d}x=tttj
��D]&}tj
jtj
|�tj
|<q W|r}|ddkr}dg|dd�t_n�|r�dg|t_n�|r�|g|t_n�|r3d}g}x'|D]}
|jtj
j|
��q�Wxs|D]:}tj
j|�}|tj
kr�tj
jd|�q�Wn.tj�}|tj
kratj
jd|�tjddddd�}|p�|}|p�|}tdd�atj�tj
jtj
jt �d��t!�dkrtj
j�d�}tj"d |�nct#d!krit#d"kr$d#nd$���fd%d&�d3D�}d*d&�|D�}tj$d|�t%t�t&t�t't�a(t)j*tt(�t)j+�r�tj,d+d,�tj,d+d-�tj,d+d.�|r4|p�|s4x:|dd�D](}
t(j-|
�dkr�|j.|
�q�W|s4t(j/�|rut(j0�}|sPdSt)j+�r~t(j1r~|j2j3�n	t(j4}|r�|j5�|r�tj6j7d/�p�tj6j7d0�}
|
r�tj
j|
�r�|j8j9|
�|s�|rH|j8j:d1tjf�|r|j8j;|�qw|rw|j8j<|�|j8j9|�n/|rwt)j=t�}|rw|j8j:d2|�xt(j>r�tj?�qzWtj@�td�dS)4NTFrzc:deihnr:st:zError: %s
%srr�z-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-tr�-rTr�r�zeditor-on-startupr�r�Z	classNameZIdleZIconsZWindowszidle.icor�g!@g333333!@z.pngz.gifcs/g|]%}tjj�d|�f��qS)z	idle_%d%s)r>r?r@)r�r�)�ext�icondirrrr�s	zmain.<locals>.<listcomp>�� �0cSsg|]}td|��qS)r)Z
PhotoImage)r��iconfilerrrr�s	r�z<B2>z<B2-Motion>z<<PasteSelection>>ZIDLESTARTUPZ
PYTHONSTARTUPzbif 1:
            import sys as _sys
            _sys.argv = %r
            del _sys
            
zprint('%s'))r�r�r�)Ar)r:�getoptr��argvr"r��	usage_msgr��exitr�r!r>r?rr�rnr�rr�r��abspathr]�dirnamerc�getcwdrr�rOrxrPr@�__file__rZ
wm_iconbitmapZ	TkVersionZwm_iconphotor	r�r�r<rZsetupAppZisAquaTkZunbind_classrrrh�newr=�dictr��lowerr^rh�environrzr_rr�rr)ZtkVersionWarningZinversedictryZdestroy)Zenable_shellZenable_editra�cmdZscriptZstartupZoptsrDr*�o�ar�Zpathxr�dirZ
edit_startr�Z	iconfilesZiconsrGZtkversionwarningr)r�r�rr��s
) 
	


	
$



!



	
	
r�r�F)Fr�r>Zos.pathr�r�r�r�r�r�rrBrr rrrrrrt�ImportErrorr�rr�Ztkinter.messageboxZ
messageboxryZidlelib.EditorWindowrr	Zidlelib.FileListr
Zidlelib.ColorDelegatorrZidlelib.UndoDelegatorrZidlelib.OutputWindowr
Zidlelib.configHandlerrrrrrrr�r�r r&rr$r%r)�
checkcacher1r2r�r�r�Z	RPCClientr�r�r��
TextIOBaser�r^r\r�r�r�rr�rrrr�<module>sz
	
	
	�����4?�