Viewing 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]!Zeeeejde=qWdZddlZddddZdaddZedejZeddZdadada dddZ!ddZ"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-eddS)0N)CallTips)AutoComplete)RemoteDebugger)RemoteObjectBrowser)StackViewer)rpc)PyShell)	IOBindingsimpledialog
messageboxfontdialog
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)sysstderrwriterZidle_formatwarningIOError)messagecategoryfilenamelinenofileliner0/opt/alt/python35/lib64/python3.5/idlelib/run.pyidle_showwarning_subproc s	
rcCsF|r'tdkrBtjatt_ntdk	rBtt_dadS)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)_warnings_showwarningwarningsshowwarningr)Zcapturerrrcapture_warnings0s		r!TcCs|jddS)zProcess 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)tclrrrhandle_tk_events@sr%FcCs|ayttjd}WntddtjdSYnXtddgtjdd<tjdt	dd	d
t
|ff}d|_|jx\yt
rytWntk
rwYnXy%tjjdddd
\}}Wntjk
rtwYnX|\}}}|||}tjj||fWqtk
rgtr`da
wYqtk
rtdYqtj\}	}
}y!ttjj|dfWn+tj|	|
|dtjtYnXwYqXqWdS)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.rNTtargetnameZ
SockThreadargsblockZtimeoutg?F)no_exitfuncintrargvprint
__stderr__r!	threadingZThread
manage_socket	LOCALHOSTZdaemonstartexit_nowexitKeyboardInterruptrZ
request_queuegetqueueZEmptyr%Zresponse_queueZputquitting
SystemExitexc_infoprint_exception	traceback)Zdel_exitfuncZportZ
sockthreadseqrequestmethodr*kwargsZrettypevaluetbrrrmainNsZ	
	
	

%


rGcCsxtdD]w}tj|yt|t}PWq
tk
r}z-td|jdddtj	|}WYdd}~Xq
Xq
Wtddtj	t
||dadS|jdS)NzIDLE Subprocess: OSError: r&z, retrying....rz8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T)
rangetimesleepMyRPCServer	MyHandlerOSErrorr0r*rr1show_socket_errorr6Zhandle_request)addressiZservererrZsocket_errorrrrr3s
	

r3cCsddl}ddlj}|j}|j|jddkrgd|}|jd|d|n!|jdd|jdd||jdS)Nr=zIDLE'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 ErrorparentzSocket Error: %sr&)tkinterZtkinter.messageboxrZTkZwithdrawr*Z	showerrorZdestroy)rRrPrUZtkMessageBoxrootmsgrrrrOs
	rOcsddl}|jttjtj\}}}}|\t_t_t_t	fdd|||dS)Nrc	s6j||j}|j}|dk	rc|krct|||jtddnK|dk	r|jr|krt|||jtdd|rtj|}tddd
}t	||tj
|dtj||}x$|D]}t|dddqWdS)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.pyrpc.pythreading.pyqueue.pyRemoteDebugger.pybdb.pyendr')rXrYrZr[r\r])add__context__	__cause__rD
__traceback__r0__suppress_context__r?
extract_tbcleanup_traceback
print_listformat_exception_only)	typexcrFcontextcauseZtbeexcludelinesr)efile	print_excseenrrros.
			

	

z"print_exception.<locals>.print_exc)
	linecache
checkcacheflush_stdoutrrr=	last_type
last_valuelast_tracebackset)rqrhvalrFZexcinfor)rnrorprr>s
		r>c
Csn|dd}x;|rMx'|D]}|ddj|r Pq WP|d=qWx;|rx'|D]}|ddj|r^Pq^WP|d
=qQWt|dkr|dd|dd<tddtjtjdj}xtt|D]x}||\}}}}	|dkrd}|	rP|j	d	rP|j
d
d||fi}	||||	f||<qWdS)zARemove excluded traces from beginning/end of tb; get cached linesNrr&z** IDLE Internal Exception: rexec?z
-toplevel-z	<pyshell#rqgetliner,r,)countlenr0rrrZobjecttable
rpchandlerrI
startswithZ
remotecall)
rFrlZorig_tbZrpcfiler~rQfnlnZnmrrrrres2	
	
recCsdS)zXXX How to do this now?NrrrrrrssrscCs7trddl}|jtdtjddS)zExit 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)rrrrr7s


r7c@seZdZddZdS)rLcCs	yWntk
rYntk
r?datjYntj}tdddd|tdd|tdtj	j
d|td|d|td	t|d|tj
d|td
d|tddd|datjYnXdS)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<EOFErrorr6threadinterrupt_mainrr1r0r2Zcurrent_threadr)reprr?ror;)selfrAZclient_addressZerfrrrhandle_errors&

	zMyRPCServer.handle_errorN)__name__
__module____qualname__rrrrrrLsrLc@s@eZdZddZddZddZddZd	S)
rMcCst|}|jd||jd|_tj|jdtjt_	tj
|jdtjt_tj
|jdtjt_t
jt_ddl}|j|_tj	|_|jd|_t
jj|d	dd
ddS)zOverride base methodryconsolestdinstdoutrrNinterpZmyseqwaitg?)	Executiveregisterget_remote_proxyrrZPseudoInputFiler	encodingrrZPseudoOutputFilerrrdisplayhookpydocZ
plainpagerZpagerZ_keep_stdinr
RPCHandlerZgetresponse)rZ	executiverrrrhandle.szMyHandler.handlecCstjddS)z>override SocketIO method - wait for MainThread to shut us down
N)rJrK)rrrrexithookFszMyHandler.exithookcCsdatjdS)zEOverride SocketIO method - terminate wait on callback and exit threadTN)r;rr)rrrrEOFhookJszMyHandler.EOFhookcCsdatjdS)zinterrupt awakened threadTN)r;rr)rrrrdecode_interrupthookPszMyHandler.decode_interrupthookN)rrrrrrrrrrrrM,srMc@sseZdZddZddZddZddZd	d
ZddZd
dZ	dddZ
dS)rcCs7||_tj|_tj|_tj|_dS)N)r~__main____dict__localsrcalltiprautocomplete)rr~rrr__init__Ys	zExecutive.__init__cCsy1d|_dazt||jWddaXWngtk
rEYn]tj|_trdtt	|j
jjd}|r|j
j
jYnXtdS)NTFz<<toggle-jit-stack-viewer>>)usr_exc_info
interruptableryrr<rr=r;r7r>r~rZgetvarrZopen_remote_stack_viewerrs)rcodeZjitrrrruncode_s"	
zExecutive.runcodecCstrtjdS)N)rrr)rrrrinterrupt_the_serverxszExecutive.interrupt_the_servercCstj|j|S)N)rZstart_debuggerr~)rZgui_adap_oidrrrstart_the_debugger|szExecutive.start_the_debuggercCs|jj|dS)zDUnregister the Idb Adapter.  Link objects and Idb then subject to GCN)r~Z
unregister)rZidb_adap_oidrrrstop_the_debuggerszExecutive.stop_the_debuggercCs|jj|S)N)rZ	fetch_tip)rr)rrrget_the_calltipszExecutive.get_the_calltipcCs|jj||S)N)rZfetch_completions)rZwhatmoderrrget_the_completion_listsz!Executive.get_the_completion_listNcCs|jr|j\}}}ndSd}|dk	rF|jj|}x)|rq|jjddkrq|j}qIW|t_|t_t	j
||}tj|S)Nrrrun)rr)
rr~rtb_frame	f_globalstb_nextrrtrurZ
StackTreeItemrZremote_object_tree_item)rZ	flist_oidrhrxrFZflistitemrrrstackviewers	
		zExecutive.stackviewer)rrrrrrrrrrrrrrrrWsr)r
rrr
rrr).rrqrJr?_threadrr2r:rUZidlelibrrrrrrrr	rmoddelattrmodulesr4rrrr!ZTclr$r%r6r;rrGr3rOr>rersr7Z	RPCServerrLrrMobjectrrrrr<module>sV




I$+A
Back to Directory File Manager