AlkantarClanX12

Your IP : 3.149.25.117


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/idlelib/__pycache__/run.cpython-35.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|ay2ttj�dks$t�ttjd�}Wntddtj�dSYnXtd�dgtjdd�<t	j
dtdd	d
t|ff�}d|_
|j�x\y�tr�yt�Wntk
r�w�YnXy%tjjdddd
�\}}Wntjk
r)t�w�YnX|\}}}|||�}tjj||f�Wq�tk
r�tr{daw�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�lenr�argv�AssertionError�int�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�mainNs\	
	
	

%


rIcCs�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_errorr8Zhandle_request)�address�iZserver�errZsocket_errorrrrr5�s
	

r5cCs�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)rTrRrWZtkMessageBox�root�msgrrrrQ�s
	rQcs�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')rZr[r\r]r^r_)�add�__context__�	__cause__rF�
__traceback__r2�__suppress_context__rA�
extract_tb�cleanup_traceback�
print_list�format_exception_only)	�typ�excrH�context�causeZtbe�exclude�linesr)�efile�	print_exc�seenrrrq�s.
			

	

z"print_exception.<locals>.print_exc)
�	linecache�
checkcache�flush_stdoutrrr?�	last_type�
last_value�last_traceback�set)rsrj�valrHZexcinfor)rprqrrrr@�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#rs�getliner,r,)�countr.r2rrrZobjecttable�
rpchandlerrK�
startswithZ
remotecall)
rHrnZorig_tbZrpcfilerrS�fn�lnZnmrrrrrg�s2	
	
rgcCsdS)zXXX How to do this now?Nrrrrrru�srucCs7trddl}|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!rr9)r�rrrr9s


r9c@seZdZdd�ZdS)rNcCs	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>�EOFErrorr8�thread�interrupt_mainrr3r2r4Zcurrent_threadr)�reprrArqr=)�selfrCZclient_addressZerfrrr�handle_errors&

	zMyRPCServer.handle_errorN)�__name__�
__module__�__qualname__r�rrrrrNsrNc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rOcCs�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 methodr{�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)rLrM)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�rrrrrO,srOc@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�rrrr�__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�r>rr?r=r9r@rr�Zgetvarr�Zopen_remote_stack_viewerru)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)rZ
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�rr��tb_frame�	f_globals�tb_nextrrvrwrZ
StackTreeItemrZremote_object_tree_item)r�Z	flist_oidrjrzrHZflist�itemrrr�stackviewer�s	
		zExecutive.stackviewer)r�r�r�r�r�r�r�r�r�r�r�rrrrr�Wsr�)r
rrr
rrr).rrsrLrA�_threadr�r4r<rWZidlelibrrrrrrrr	r��mod�delattr�modulesr6rrrr!ZTclr$r%r8r=r�rIr5rQr@rgrur9Z	RPCServerrNr�rO�objectr�rrrr�<module>sV




I$+A