Your IP : 18.217.26.8


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



���]-6�@s2ddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
ddl	mZddl	mZddl	mZdd	l	mZddlZx)d/D]!Zeee�ejde=q�WdZddlZdddd�Zdadd�Zed�ej�Zedd�Zdadada ddd�Z!dd�Z"dd �Z#d!d"�Z$d#d$�Z%d%d&�Z&d'd(�Z'Gd)d*�d*ej(�Z)Gd+d,�d,ej*�Z+Gd-d.�d.e,�Z-ed�dS)0�N)�CallTips)�AutoComplete)�RemoteDebugger)�RemoteObjectBrowser)�StackViewer)�rpc)�PyShell)�	IOBinding�simpledialog�
messagebox�font�dialog�
filedialog�commondialog�colorchooserztkinter.z	127.0.0.1c
CsT|dkrtj}y&|jtj|||||��Wntk
rOYnXdS)N)�sys�stderr�writerZidle_formatwarning�IOError)�message�category�filename�lineno�file�line�r�(/opt/alt/python35/lib64/python3.5/run.py�idle_showwarning_subproc s	
rcCsF|r'tdkrBtjatt_ntdk	rBtt_dadS)N)�_warnings_showwarning�warnings�showwarningr)�capturerrr�capture_warnings0s		r"TcCs|jd�dS)N�update)�eval)�tclrrr�handle_tk_events@sr&FcCs�|ayttjd�}Wntddtj�dSYnXtd�dgtjdd�<tjdt	ddd	t
|ff�}d|_|j�x\y�t
r�yt�Wntk
r�w�YnXy%tjjd
ddd�\}}Wntjk
rt�w�YnX|\}}}|||�}tjj||f�Wq�tk
rgtr`da
w�Yq�tk
r�td
��Yq�tj�\}	}
}y!t�tjj|df�Wn+tj|	|
|dtj�t�YnXw�Yq�Xq�WdS)N�z/IDLE Subprocess: no IP port passed in sys.argv.rT��target�nameZ
SockThread�args�block�timeoutg�������?F���)�no_exitfunc�intr�argv�print�
__stderr__r"�	threading�Thread�
manage_socket�	LOCALHOST�daemon�start�exit_now�exit�KeyboardInterruptrZ
request_queue�get�queue�Emptyr&Zresponse_queue�put�quitting�
SystemExit�exc_info�print_exception�	traceback)Zdel_exitfunc�portZ
sockthread�seq�request�methodr+�kwargs�ret�type�value�tbrrr�mainNsZ	
	
	

%


rOcCs�x�td�D]w}tj|�yt|t�}PWq
tk
r�}z-td|jdddtj	�|}WYdd}~Xq
Xq
Wtddtj	�t
||�dadS|j�dS)N�zIDLE Subprocess: OSError: r'z, retrying....rz8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
�range�time�sleep�MyRPCServer�	MyHandler�OSErrorr2r+rr3�show_socket_errorr:Zhandle_request)�address�iZserver�errZsocket_errorrrrr6�s
	

r6cCs�ddl}ddlj}|j�}|j�|jddkrgd|}|jd|d|�n!|jdd|jdd|�|j�dS)Nr�=z�IDLE's subprocess can't connect to %s:%d.  This may be due to your personal firewall configuration.  It is safe to allow this internal connection because no data is visible on external ports.zIDLE Subprocess Error�parentzSocket Error: %sr')�tkinterZtkinter.messageboxrZTkZwithdrawr+Z	showerrorZdestroy)rZrXr]�tkMessageBox�root�msgrrrrW�s
	rWcs�ddl}|j�t�tj�tj�\}}}}|\t_t_t_t	�����fdd���|||�dS)Nrc	s6�j|�|j}|j}|dk	rc|�krc�t|�||j�tdd��nK|dk	r�|jr�|�kr��t|�||j�tdd��|r�tj|�}tdd��d
}t	||�tj
|d��tj||�}x$|D]}t|ddd��qWdS)NzF
The above exception was the direct cause of the following exception:
rzE
During handling of the above exception, another exception occurred:
z"Traceback (most recent call last):�run.py�rpc.py�threading.py�queue.py�RemoteDebugger.py�bdb.py�endr()rarbrcrdrerf)�add�__context__�	__cause__rL�
__traceback__r2�__suppress_context__rE�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrN�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrrx�s.
			

	

z"print_exception.<locals>.print_exc)
�	linecache�
checkcache�flush_stdoutrrrC�	last_type�
last_value�last_traceback�set)rzrq�valrNZexcinfor)rwrxryrrD�s
		rDc
Csn|dd�}x;|rMx'|D]}|ddj|�r Pq WP|d=qWx;|r�x'|D]}|ddj|�r^Pq^WP|d=qQWt|�dkr�|dd�|dd�<tddtj�tjdj}x�tt|��D]x}||\}}}}	|dkrd}|	rP|j	d�rP|j
d	d
||fi�}	||||	f||<q�WdS)
Nrr'z** IDLE Internal Exception: r�exec�?z
-toplevel-z	<pyshell#rz�getliner.r.)�count�lenr2rrrZobjecttable�
rpchandlerrQ�
startswithZ
remotecall)
rNruZorig_tbZrpcfiler�rY�fn�lnZnmrrrrrn�s2	
	
rncCsdS)Nrrrrrr|�sr|cCs7trddl}|j�td�tjd�dS)NrF)r/�atexit�_clearr"rr;)r�rrrr;s


r;c@seZdZdd�ZdS)rTcCs	y�Wn�tk
r�Yn�tk
r?datj�Yn�tj}tdddd|�tdd|�tdtj	�j
d|�td|d|�td	t|�d|�tj
d|�td
d|�tddd|�datj�YnXdS)NT�
�-�(rzUnhandled server exception!z
Thread: %szClient Address: z	Request: z#
*** Unrecoverable, server exiting!)rB�EOFErrorr:�thread�interrupt_mainrr3r2r4�current_threadr*�reprrErxrA)�selfrHZclient_address�erfrrr�handle_errors&

	zMyRPCServer.handle_errorN)�__name__�
__module__�__qualname__r�rrrrrTsrTc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rUcCs�t|�}|jd|�|jd�|_tj|jdtj�t_	tj
|jdtj�t_tj
|jdtj�t_t
jt_ddl}|j|_tj	|_|jd�|_t
jj|ddd	d
�dS)Nr��console�stdin�stdoutrr�interpZmyseq�waitg�������?)�	Executive�register�get_remote_proxyr�rZPseudoInputFiler	�encodingrr�ZPseudoOutputFiler�rr�displayhook�pydocZ
plainpagerZpagerZ_keep_stdinr��
RPCHandlerZgetresponse)r�Z	executiver�rrr�handle.szMyHandler.handlecCstjd�dS)N�
)rRrS)r�rrr�exithookFszMyHandler.exithookcCsdatj�dS)NT)rAr�r�)r�rrr�EOFhookJszMyHandler.EOFhookcCsdatj�dS)NT)rAr�r�)r�rrr�decode_interrupthookPszMyHandler.decode_interrupthookN)r�r�r�r�r�r�r�rrrrrU,srUc@sseZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)r�cCs7||_tj|_tj�|_tj�|_dS)N)r��__main__�__dict__�localsr�calltipr�autocomplete)r�r�rrr�__init__Ys	zExecutive.__init__cCs�y1d|_dazt||j�WddaXWngtk
rEYn]tj�|_trdt�t	�|j
jjd�}|r�|j
j
j�YnXt�dS)NTFz<<toggle-jit-stack-viewer>>)�usr_exc_info�
interruptabler�r�rBrrCrAr;rDr�r�Zgetvarr�Zopen_remote_stack_viewerr|)r��codeZjitrrr�runcode_s"	
zExecutive.runcodecCstrtj�dS)N)r�r�r�)r�rrr�interrupt_the_serverxszExecutive.interrupt_the_servercCstj|j|�S)N)rZstart_debuggerr�)r�Zgui_adap_oidrrr�start_the_debugger|szExecutive.start_the_debuggercCs|jj|�dS)N)r��
unregister)r�Zidb_adap_oidrrr�stop_the_debuggerszExecutive.stop_the_debuggercCs|jj|�S)N)r�Z	fetch_tip)r�r*rrr�get_the_calltip�szExecutive.get_the_calltipcCs|jj||�S)N)r�Zfetch_completions)r�Zwhat�moderrr�get_the_completion_list�sz!Executive.get_the_completion_listNcCs�|jr|j\}}}ndSd}|dk	rF|jj|�}x)|rq|jjddkrq|j}qIW|t_|t_t	j
||�}tj|�S)Nr�r�run)rr�)
r�r�r��tb_frame�	f_globals�tb_nextrr}r~rZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrqr�rN�flist�itemrrr�stackviewer�s	
		zExecutive.stackviewer)r�r�r�r�r�r�r�r�r�r�r�rrrrr�Wsr�)r
rrr
rrr).rrzrRrE�_threadr�r4r>r]Zidlelibrrrrrrrr	r��mod�delattr�modulesr7rrrr"ZTclr%r&r:rAr�rOr6rWrDrnr|r;Z	RPCServerrTr�rU�objectr�rrrr�<module>sV




I$+A

?>