AlkantarClanX12

Your IP : 3.140.186.189


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-1.pyc



��Yf-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)zuShow Idle-format warning after replacing warnings.showwarning.

    The only difference is the formatter called.
    N)�sys�stderr�writerZidle_formatwarning�IOError)�message�category�filename�lineno�file�line�r�0/opt/alt/python35/lib64/python3.5/idlelib/run.py�idle_showwarning_subproc s	
rcCsF|r'tdkrBtjatt_ntdk	rBtt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)�_warnings_showwarning�warnings�showwarningr)Zcapturerrr�capture_warnings0s		r!TcCs|jd�dS)z�Process any tk events that are ready to be dispatched if tkinter
    has been imported, a tcl interpreter has been created and tk has been
    loaded.�updateN)�eval)�tclrrr�handle_tk_events@sr%FcCs�|ayttjd�}Wntddtj�dSYnXtd�dgtjdd�<tjdt	dd	d
t
|ff�}d|_|j�x\y�t
r�yt�Wntk
r�w�YnXy%tjjdddd
�\}}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)ajStart the Python execution server in a subprocess

    In the Python subprocess, RPCServer is instantiated with handlerclass
    MyHandler, which inherits register/unregister methods from RPCHandler via
    the mix-in class SocketIO.

    When the RPCServer 'server' is instantiated, the TCPServer initialization
    creates an instance of run.MyHandler and calls its handle() method.
    handle() instantiates a run.Executive object, passing it a reference to the
    MyHandler object.  That reference is saved as attribute rpchandler of the
    Executive instance.  The Executive methods have access to the reference and
    can pass it on to entities that they command
    (e.g. RemoteDebugger.Debugger.start_debugger()).  The latter, in turn, can
    call MyHandler(SocketIO) register/unregister methods via the reference to
    register and unregister themselves.

    �z/IDLE Subprocess: no IP port passed in sys.argv.rNT��target�nameZ
SockThread�args�blockZtimeoutg�������?F���)�no_exitfunc�intr�argv�print�
__stderr__r!�	threadingZThread�
manage_socket�	LOCALHOSTZdaemon�start�exit_now�exit�KeyboardInterruptrZ
request_queue�get�queueZEmptyr%Zresponse_queueZput�quitting�
SystemExit�exc_info�print_exception�	traceback)Zdel_exitfuncZportZ
sockthread�seq�request�methodr*�kwargsZret�type�value�tbrrr�mainNsZ	
	
	

%


rGcCs�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�OSErrorr0r*rr1�show_socket_errorr6Zhandle_request)�address�iZserver�errZsocket_errorrrrr3�s
	

r3cCs�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)rRrPrUZtkMessageBox�root�msgrrrrO�s
	rOcs�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')rXrYrZr[r\r])�add�__context__�	__cause__rD�
__traceback__r0�__suppress_context__r?�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrF�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrro�s.
			

	

z"print_exception.<locals>.print_exc)
�	linecache�
checkcache�flush_stdoutrrr=�	last_type�
last_value�last_traceback�set)rqrh�valrFZexcinfor)rnrorprr>�s
		r>c
Csn|dd�}x;|rMx'|D]}|ddj|�r Pq WP|d=qWx;|r�x'|D]}|ddj|�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)zARemove excluded traces from beginning/end of tb; get cached linesNrr&z** IDLE Internal Exception: r�exec�?z
-toplevel-z	<pyshell#rq�getliner,r,)�count�lenr0rrrZobjecttable�
rpchandlerrI�
startswithZ
remotecall)
rFrlZorig_tbZrpcfiler~rQ�fn�lnZnmrrrrre�s2	
	
recCsdS)zXXX How to do this now?Nrrrrrrs�srscCs7trddl}|j�td�tjd�dS)z�Exit subprocess, possibly after first clearing exit functions.

    If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any
    functions registered with atexit will be removed before exiting.
    (VPython support)

    rNF)r-�atexitZ_clearr!rr7)r�rrrr7s


r7c@seZdZdd�ZdS)rLcCs	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)zrOverride RPCServer method for IDLE

        Interrupt the MainThread and exit server if link is dropped.

        T�
�-�(rzUnhandled server exception!z
Thread: %szClient Address: z	Request: z#
*** Unrecoverable, server exiting!N)r<�EOFErrorr6�thread�interrupt_mainrr1r0r2Zcurrent_threadr)�reprr?ror;)�selfrAZclient_addressZerfrrr�handle_errors&

	zMyRPCServer.handle_errorN)�__name__�
__module__�__qualname__r�rrrrrLsrLc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rMcCs�t|�}|jd|�|jd�|_tj|jdtj�t_	tj
|jdtj�t_tj
|jdtj�t_t
jt_ddl}|j|_tj	|_|jd�|_t
jj|d	dd
d�dS)zOverride base methodry�console�stdin�stdoutrrN�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)z>override SocketIO method - wait for MainThread to shut us down�
N)rJrK)r�rrr�exithookFszMyHandler.exithookcCsdatj�dS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)r;r�r�)r�rrr�EOFhookJszMyHandler.EOFhookcCsdatj�dS)zinterrupt awakened threadTN)r;r�r�)r�rrr�decode_interrupthookPszMyHandler.decode_interrupthookN)r�r�r�r�r�r�r�rrrrrM,srMc@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�
interruptableryr�r<rr=r;r7r>r~r�Zgetvarr�Zopen_remote_stack_viewerrs)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)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r~Z
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_nextrrtrurZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrhrxrFZflist�itemrrr�stackviewer�s	
		zExecutive.stackviewer)r�r�r�r�r�r�r�r�r�r�r�rrrrr�Wsr�)r
rrr
rrr).rrqrJr?�_threadr�r2r:rUZidlelibrrrrrrrr	r��mod�delattr�modulesr4rrrr!ZTclr$r%r6r;r�rGr3rOr>rersr7Z	RPCServerrLr�rM�objectr�rrrr�<module>sV




I$+A