KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/python2.4/idlelib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/idlelib/rpc.pyo
m
=5Dc@sdZdkZdkZdkZdkZdkZdkZdkZdk	Z	dk
Z
dkZdkZdk
Z
dkZdZdZeie
ieeddZdZdeifdYZhZe
i
d	Ze
i
d	Zd
fdYZdfd
YZdZdfdYZdeiefdYZdefdYZdfdYZ dZ!dZ"dfdYZ#dS(sRPC Implemention, originally written for the Python Idle IDE

For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection.  Since Idle has
has only one client per server, this was not a limitation.

   +---------------------------------+ +-------------+
   | SocketServer.BaseRequestHandler | | SocketIO    |
   +---------------------------------+ +-------------+
                   ^                   | register()  |
                   |                   | unregister()|
                   |                   +-------------+
                   |                      ^  ^
                   |                      |  |
                   | + -------------------+  |
                   | |                       |
   +-------------------------+        +-----------------+
   | RPCHandler              |        | RPCClient       |
   | [attribute of RPCServer]|        |                 |
   +-------------------------+        +-----------------+

The RPCServer handler class is expected to provide register/unregister methods.
RPCHandler inherits the mix-in class SocketIO, which provides these methods.

See the Idle run.main() docstring for further information on how this was
accomplished in Idle.

NcCsti|}|S(N(tmarshaltloadstmstco(RR((t#/usr/lib64/python2.4/idlelib/rpc.pyt
unpickle_code-scCsti|}t|ffS(N(RtdumpsRRR(RR((Rtpickle_code2siis	127.0.0.1t	RPCServercBs8tZddZdZdZdZdZRS(NcCs1|djo
t}ntii|||dS(N(thandlerclasstNonet
RPCHandlertSocketServert	TCPServert__init__tselftaddr(RRR	((RRGs

cCsdS(s@Override TCPServer method, no bind() phase for connecting entityN((R((Rtserver_bindLscCs|ii|idS(sOverride TCPServer method, connect() instead of listen()

        Due to the reversed connection, self.server_address is actually the
        address of the Idle Client to which we are connecting.

        N(Rtsockettconnecttserver_address(R((Rtserver_activatePscCs|i|ifS(s:Override TCPServer method, return already connected socketN(RRR(R((Rtget_requestYscCsyWntj
o
nti}|dddIJ|dIJ|dtiiIJ|dI|IJ|dIt|IJt
id||d	IJ|ddIJti
d
nXdS(sOverride TCPServer method

        Error message goes to __stderr__.  No error message if exiting
        normally or socket raised EOF.  Other exceptions not handled in
        server code will cause os._exit.

        s
t-i(sUnhandled server exception!s
Thread: %ssClient Address: s	Request: tfiles#
*** Unrecoverable, server exiting!iN(t
SystemExittsyst
__stderr__terft	threadingt
currentThreadtgetNametclient_addresstreprtrequestt	tracebackt	print_exctost_exit(RR"R R((Rthandle_error]s 	

(t__name__t
__module__R
RRRRR'(((RREs
				itSocketIOcBstZdZdddZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!RS(NicCshti|_|dj	o
||_n||_|djo
t}n||_h|_	h|_
dS(N(RRRt
sockthreadt	debuggingR
tsocktobjtabletobjecttablet	responsestcvars(RR-R.R,((RRs

	

		cCs1|i}d|_|dj	o|indS(N(RR-R
tclose(RR-((RR2s		
cCstidS(s!override for specific exit actionN(R%R&(R((RtexithookscGsk|ipdSn|idttii}x"|D]}|dt|}q<Wt
i|IJdS(Nt (RR,tlocationtstrRRRtstargstaRR(RR8R9R7((Rtdebugs
#cCs||i|<dS(N(tobjectRR.toid(RR<R;((RtregisterscCs(y|i|=Wntj
onXdS(N(RR.R<tKeyError(RR<((Rt
unregistersc
Cs|id|y|\}\}}
}	}Wntj
odSnX|i	i
|pdd|ffSn|i	|}|
djo!h}t
||d|fSn|
djo!h}t||d|fSnt||
pdd|
ffSnt||
}y|d	jo=||	|}t|tot|}nd|fSn@|d
jo$ti|||	|ffdSndd|fSWnXtj
o
nDtij
o
n,|id
tidt i!dSnXdS(Ns
localcall:tERRORsBad request formatsUnknown object id: %rt__methods__tOKt__attributes__sUnsupported method name: %rtCALLtQUEUEtQUEUEDsUnsupported message type: %sslocalcall:EXCEPTIONRt	EXCEPTION(R@sBad request format(RFN(RGN("RR:R"thowR<t
methodnameR8tkwargst	TypeErrorR.thas_keytobjtmethodst_getmethodst
attributest_getattributesthasattrtgetattrtmethodtrett
isinstancetRemoteObjectt	remotereft
request_queuetputtseqR
RRterrorR#R$RR(
RR[R"RNRURHRJRTR<R8RIRMRP((Rt	localcallsJ	







cCs8|id|||i||||}|i|S(Nsremotecall:asynccall: (	RR:R<RIt	asynccallR8RJR[tasyncreturn(RR<RIR8RJR[((Rt
remotecallscCs8|id|||i||||}|i|S(Nsremotequeue:asyncqueue: (	RR:R<RIt
asyncqueueR8RJR[R_(RR<RIR8RJR[((RtremotequeuescCsd||||ff}|i}ti	|i
joti}||i
|<n|id||||||i||f|S(NRDs
asynccall:%d:(R<RIR8RJR"RtnewseqR[RRR+t	ConditiontcvarR1R:t
putmessage(RR<RIR8RJReR[R"((RR^scCsd||||ff}|i}ti	|i
joti}||i
|<n|id||||||i||f|S(NREsasyncqueue:%d:(R<RIR8RJR"RRcR[RRR+RdReR1R:Rf(RR<RIR8RJReR[R"((RRascCsG|id||i|dd}|id|||i|S(Ns#asyncreturn:%d:call getresponse(): twaitf0.050000000000000003sasyncreturn:%d:response: (RR:R[tgetresponsetresponsetdecoderesponse(RR[Ri((RR_scCs|\}}|djo|Sn|djodSn|djo|iddSn|djo|id|idSn|djo|id|t|nt||fdS(	NRBRFRGsdecoderesponse: EXCEPTIONtEOFsdecoderesponse: EOFR@sdecoderesponse: Internal ERROR:(	RiRHtwhatR
RR:tdecode_interrupthooktRuntimeErrortSystemError(RRiRlRH((RRjs 








cCs
tdS(tN(tEOFError(R((RRmscCsEy|iddddWn$tj
o|iddSnXdS(sListen on socket until I/O not ready or EOF

        pollresponse() will loop looking for seq number None, which
        never comes, and exit on EOFError.

        tmyseqRgf0.050000000000000003smainloop:returnN(RRhR
RqR:(R((Rtmainloops
cCsY|i||}|dj	o6|\}}|djo||i|f}qUn|S(NRB(	Rt_getresponseRrRgRiR
RHRlt_proxify(RRrRgRlRHRi((RRhs

cCsOt|tot||iSnt|tiot|i	|Sn|S(N(
RVRMtRemoteProxytRPCProxyRR<ttypestListTypetmapRu(RRM((RRus
cCs|id|ti|ijo3x|i||}|dj	o|Sq)q)Wn|i
|}|ix"|i
i|p|iqsW|i
|}|id||f|i
|=|i
|=|i|SdS(Ns_getresponse:myseq:is-_getresponse:%s: thread woke up: response: %s(RR:RrRRR+tpollresponseRgRiR
R1RetacquireR0RLtrelease(RRrRgReRi((RRt%s$






cCs|id|_}|S(Ni(RtnextseqR[(RR[((RRc;scCs|id|dyti|}Wn2tij
o#tidIt	|IJnXt
idt||}xt|djoqy>t
i
g|igg\}}}|ii|t }Wn"ttifj
o
tq|X||}q|WdS(Nsputmessage:%d:isCannot pickle:s<i(RR:tmessagetpickleRR7t
PicklingErrorRRR!tstructtpacktlentselectR-trtwtxtsendtBUFSIZEtntAttributeErrorRR\tIOError(RRRR7RRR((RRf?s$RpicCs|it|i|ijoti|iiggg|\}}}t|djodSny|ii
t}Wntij
o
tnXt|djo
tn|i|7_|in|iS(Ni(Rt_stage0RtbuffertbufneedRR-tfilenoRgRRRR
trecvRR7RR\Rqt_stage1(RRgR7RRR((Rt
pollpacketUs
-
cCsm|idjoYt|idjoC|id }|id|_tid|d|_d|_ndS(Niis<ii(RtbufstateRRR7RtunpackR(RR7((RRes
&
cCsj|idjoVt|i|ijo=|i|i }|i|i|_d|_d|_|SndS(Niii(RRRRRtpacket(RR((RRls)		cCs|i|}|djodSnyti|}Wn_tij
oPt	i
dIJt	i
dIt|IJti
dt	i
t	i
dIJnX|S(Ns-----------------------scannot unpickle packet:R(RRRgRR
RRRtUnpicklingErrorRRR!R#tprint_stack(RRgRR((Rtpollmessagets


c
Csxytid}Wntij
on-X|\}}	|d|	ff}|i	|y(|i
|}|d	jod	SnWn7t
j
o|id	Sntj
od	SnX|\}}|d}|id||f|d
jov|id||i||}	|id||	f|djo|i	||	fq|djoqqq||jo|Sq|ii|d	}|d	j	o/|i||i|<|i|iqqqWd	S(sRHandle messages received on the socket.

        Some messages received may be asynchronous 'call' or 'queue' requests,
        and some may be responses for other threads.

        'call' requests are passed to self.localcall() with the expectation of
        immediate execution, during which time the socket is not serviced.

        'queue' requests are used for tasks (which may block or hang) to be
        processed in a different thread.  These requests are fed into
        request_queue by self.localcall().  Responses to queued requests are
        taken from response_queue and sent across the link with the associated
        sequence numbers.  Messages in the queues are (sequence_number,
        request/response) tuples and code using this module removing messages
        from the request_queue is responsible for returning the correct
        sequence number in the response_queue.

        pollresponse() will loop until a response message with the myseq
        sequence number is received, and will save other responses in
        self.responses and notify the owning thread.

        iiRBspollresponse:%d:myseq:%sRDREspollresponse:%d:localcall:call:s%pollresponse:%d:localcall:response:%sN(sCALLsQUEUE(tresponse_queuetgettqmsgtQueuetEmptyR[RiRRRfRRgR
Rqt
handle_EOFRtresqRHR:RrR]R1tcvR|R0tnotifyR}(
RRrRgR[RRRHRRRi((RR{sP


	








cCsq|i|idxI|iD]>}|i|}|id|i|<|i	|i
q!W|idS(s+action taken upon link being closed by peerRRkN(sEOFN(RtEOFhookR:R1tkeyRR|R
R0RR}R3(RRR((RRs






cCsdS(sBClasses using rpc client/server can override to augment EOF actionN((R((RRs("R(R)R~R
RR2R3R:R=R?R]R`RbR^RaR_RjRmRsRhRuRtRcRfRRRRRRRR{RR(((RR*|s>						(			
	
				
										I	
RWcBstZRS(N(R(R)(((RRWscCs t|}|t|<t|S(N(tidRMR<R/Rv(RMR<((RRXs
RvcBstZdZRS(NcCs
||_dS(N(R<R(RR<((RRs(R(R)R(((RRvsRcBs/tZeZdZdZdZdZRS(Ns#ScCs6||_ti||tii||||dS(N(	Rtsvrtcurrent_handlerR*RR-RtBaseRequestHandlerR(RR-RR((RRs	cCs|idS(s(handle() method required by SocketServerN(RRs(R((RthandlescCs
t||S(N(RwRR<(RR<((Rtget_remote_proxys(R(R)tFalseR,R5RRR(((RRs
		t	RPCClientcBsAtZeZdZdZeieidZ	dZ
dZRS(Ns#CicCs9ti|||_|ii||iiddS(Ni(RtfamilyttypeRtlistening_socktbindtaddresstlisten(RRRR((RRscCs{|ii\}}|iotidI|IJn|dtjot	i
||ntidI|IJtidS(Ns****** Connection request from is** Invalid host: (
RRtaccepttworking_sockRR,RRt	LOCALHOSTR*RRR\(RRR((RR	s
cCs
t||S(N(RwRR<(RR<((RRs(R(R)RR,R5R~RtAF_INETtSOCK_STREAMRRR(((RRs	
RwcBs8tZdZdZdZdZdZdZRS(NcCs||_||_dS(N(tsockioRR<(RRR<((RRs	cCs|idjo|in|ii|ot|i|i|Sn|i	djo|i
n|i	i|p
t|ndS(N(
Rt_RPCProxy__methodsR
t_RPCProxy__getmethodsRtnametMethodProxyRR<t_RPCProxy__attributest_RPCProxy__getattributesRLR(RR((Rt__getattr__scCs%|ii|idfh|_dS(NRC(RRR`R<R(R((Rt__getattributes)scCs%|ii|idfh|_dS(NRA(RRR`R<R(R((Rt__getmethods-s(	R(R)R
RRRRRR(((RRws		
	cCsx>t|D]0}t||}t|od||<q
q
Wt|ti	jot
|i|nt|tijo%x"|i
D]}t
||qWndS(Ni(tdirRMRRStattrtcallableRNRRxtInstanceTypeROt	__class__t	ClassTypet	__bases__tsuper(RMRNRRR((RRO1s


cCsEx>t|D]0}t||}t|pd||<q
q
WdS(Ni(RRMRRSRRRP(RMRPRR((RRQ>s


RcBstZdZdZRS(NcCs||_||_||_dS(N(RRR<R(RRR<R((RRFs		cOs%|ii|i|i||}|S(N(RRR`R<RR8RJtvalue(RR8RJR((Rt__call__Ks!(R(R)RR(((RRDs	($t__doc__RR%RRRRtcPickleRRRR#tcopy_regRxRRRtCodeTypeRRR
RR/RYRR*RWRXRvRRRRwRORQR(RR%R*RWRwR/RRRRYRRRRRRRQRORRxRRRXRRR#RvRRRR((Rt?sB															

2c		
	

Anon7 - 2021