b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 / idlelib /
Filename/usr/lib64/python2.6/idlelib/rpc.pyo
Size21.32 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 09:41
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@sÖdZddkZddkZddkZddkZddkZddkZddkZddk Z ddk
Z
ddk Z ddk Z ddk
Z
ddkZd�Zd�Ze ie
iee�ddZdZdeifd ��YZhZe
i
d
�Ze
i
d
�Zd efd ��YZd
efd��YZd�Zdefd��YZdeiefd��YZdefd��YZ defd��YZ!d�Z"d�Z#defd��YZ$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.

iÿÿÿÿNcCsti|�}|S(N(tmarshaltloads(tmstco((s#/usr/lib64/python2.6/idlelib/rpc.pyt
unpickle_code-scCsti|�}t|ffS(N(RtdumpsR(RR((s#/usr/lib64/python2.6/idlelib/rpc.pyt pickle_code2siis 127.0.0.1t RPCServercBs8eZdd�Zd�Zd�Zd�Zd�ZRS(cCs1|djo
t}ntii|||�dS(N(tNonet
RPCHandlert SocketServert TCPServert__init__(tselftaddrt handlerclass((s#/usr/lib64/python2.6/idlelib/rpc.pyR Gs

cCsdS(s@Override TCPServer method, no bind() phase for connecting entityN((R
((s#/usr/lib64/python2.6/idlelib/rpc.pyt server_bindLscCs|ii|i�dS(sÎOverride 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(tsockettconnecttserver_address(R
((s#/usr/lib64/python2.6/idlelib/rpc.pytserver_activatePscCs|i|ifS(s:Override TCPServer method, return already connected socket(RR(R
((s#/usr/lib64/python2.6/idlelib/rpc.pyt get_requestYscCsÄy�Wn¶tj
o
�n¢ti}|dddIJ|dIJ|dti�i�IJ|dI|IJ|dIt|�IJtid|�|d IJ|ddIJt i
d
�nXd S( sÜOverride 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__t threadingt
currentThreadtgetNametreprt tracebackt print_exctost_exit(R
trequesttclient_addressterf((s#/usr/lib64/python2.6/idlelib/rpc.pyt handle_error]s 

N(t__name__t
__module__RR RRRR&(((s#/usr/lib64/python2.6/idlelib/rpc.pyREs
   itSocketIOcBseZdZddd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Z d �Z d
�Z
d �Zd �Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS(icCshti�|_|dj o
||_n||_|djo
t}n||_h|_h|_ dS(N(
RRt
sockthreadRt debuggingtsockt objecttabletobjtablet responsestcvars(R
R,R.R+((s#/usr/lib64/python2.6/idlelib/rpc.pyR �s

 

  cCs1|i}d|_|dj o|i�ndS(N(R,Rtclose(R
R,((s#/usr/lib64/python2.6/idlelib/rpc.pyR1�s  
cCsti�dS(s!override for specific exit actionN(R!R"(R
((s#/usr/lib64/python2.6/idlelib/rpc.pytexithook�scGsh|ipdS|idtti�i��}x"|D]}|dt|�}q9Wti|IJdS(Nt (R+tlocationtstrRRRRR(R
targststa((s#/usr/lib64/python2.6/idlelib/rpc.pytdebug�s
#cCs||i|<dS(N(R.(R
toidtobject((s#/usr/lib64/python2.6/idlelib/rpc.pytregister�scCs(y|i|=Wntj
onXdS(N(R.tKeyError(R
R:((s#/usr/lib64/python2.6/idlelib/rpc.pyt
unregister sc Csò|id|�y|\}\}}}}Wntj
odSX|ii|�pdd|ffS|i|}|djoh} t|| �d| fS|djoh}
t||
�d|
fSt||�pdd|ffSt||�} y�|d jo:| ||�} t| t �ot
| �} nd| fS|d
jo!t i || ||ff�dSdd |fSWnhtj
o
�nTtij
o
�n<d
}
ti|
|| |fIJtidti�dSXdS(Ns
localcall:tERRORsBad request formatsUnknown object id: %rt __methods__tOKt__attributes__sUnsupported method name: %rtCALLtQUEUEtQUEUEDsUnsupported message type: %ssU*** Internal Error: rpc.py:SocketIO.localcall()

Object: %s
Method: %s
Args: %s
Rt EXCEPTION(R?sBad request format(REN(RFN(R9t TypeErrorR.thas_keyt _getmethodst_getattributesthasattrtgetattrt
isinstancet RemoteObjectt remotereft
request_queuetputRRRterrorRRRR (R
tseqR#thowR:t
methodnameR6tkwargstobjtmethodst
attributestmethodtrettmsg((s#/usr/lib64/python2.6/idlelib/rpc.pyt localcall¦sL


 

 
 
cCs8|id||�|i||||�}|i|�S(Nsremotecall:asynccall: (R9t asynccallt asyncreturn(R
R:RUR6RVRS((s#/usr/lib64/python2.6/idlelib/rpc.pyt
remotecallÐscCs8|id||�|i||||�}|i|�S(Nsremotequeue:asyncqueue: (R9t
asyncqueueR_(R
R:RUR6RVRS((s#/usr/lib64/python2.6/idlelib/rpc.pyt remotequeueÕscCs�d||||ff}|i�}ti�|ijoti�}||i|<n|id|||||�|i||f�|S(NRCs
asynccall:%d:(tnewseqRRR*t ConditionR0R9t
putmessage(R
R:RUR6RVR#RStcvar((s#/usr/lib64/python2.6/idlelib/rpc.pyR^Ús  cCs�d||||ff}|i�}ti�|ijoti�}||i|<n|id|||||�|i||f�|S(NRDsasyncqueue:%d:(RcRRR*RdR0R9Re(R
R:RUR6RVR#RSRf((s#/usr/lib64/python2.6/idlelib/rpc.pyRaäs  cCsG|id|�|i|dd�}|id||�|i|�S(Ns#asyncreturn:%d:call getresponse(): twaitg������©?sasyncreturn:%d:response: (R9t getresponsetdecoderesponse(R
RStresponse((s#/usr/lib64/python2.6/idlelib/rpc.pyR_îscCsµ|\}}|djo|S|djodS|djo|id�dS|djo|id�|i�dS|djo|id|�t|�nt||f�dS( NRARERFsdecoderesponse: EXCEPTIONtEOFsdecoderesponse: EOFR?sdecoderesponse: Internal ERROR:(RR9tdecode_interrupthookt RuntimeErrort SystemError(R
RjRTtwhat((s#/usr/lib64/python2.6/idlelib/rpc.pyRiôs  








cCs
t�dS(tN(tEOFError(R
((s#/usr/lib64/python2.6/idlelib/rpc.pyRlscCsBy|idddd�Wn!tj
o|id�dSXdS(s¥Listen on socket until I/O not ready or EOF

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

tmyseqRgg������©?smainloop:returnN(RhRRqR9(R
((s#/usr/lib64/python2.6/idlelib/rpc.pytmainloop
s

cCsY|i||�}|dj o6|\}}|djo||i|�f}qUn|S(NRA(t _getresponseRt_proxify(R
RrRgRjRTRo((s#/usr/lib64/python2.6/idlelib/rpc.pyRhs 
 
cCsIt|t�ot||i�St|ti�ot|i|�S|S(N(RMt RemoteProxytRPCProxyR:ttypestListTypetmapRu(R
RW((s#/usr/lib64/python2.6/idlelib/rpc.pyRus
cCsÚ|id|�ti�|ijo.x­|i||�}|dj o|Sq)n�|i|}|i�x"|ii |�p|i
�qnW|i|}|id||f�|i|=|i|=|i �|SdS(Ns_getresponse:myseq:s-_getresponse:%s: thread woke up: response: %s( R9RRR*t pollresponseRR0tacquireR/RHRgtrelease(R
RrRgRjRf((s#/usr/lib64/python2.6/idlelib/rpc.pyRt's$
 


 


cCs|id|_}|S(Ni(tnextseq(R
RS((s#/usr/lib64/python2.6/idlelib/rpc.pyRc=sc
Cs|id|d�yti|�}Wn2tij
o#tidIt|�IJ�nXtidt |��|}x�t |�djo�y>t
i
g|i gg�\}}}|i i |t
�}Wn:ttfj
otd�q|tij
o
�q|X||}q|WdS(Nsputmessage:%d:isCannot pickle:s<issocket no longer exists(R9tpickleRt
PicklingErrorRRRtstructtpacktlentselectR,tsendtBUFSIZEtAttributeErrorRGtIOErrorRRR(R
tmessageR7trtwtxtn((s#/usr/lib64/python2.6/idlelib/rpc.pyReAs"$
RpicCsá|i�t|i�|ijo´ti|ii�ggg|�\}}}t|�djodSy|iit �}Wnt
i j
o
t �nXt|�djo
t �n|i|7_|i�n|i
�S(Ni(t_stage0R�tbuffertbufneedR�R,tfilenoRtrecvR�RRRRqt_stage1(R
RgR�R�R�R7((s#/usr/lib64/python2.6/idlelib/rpc.pyt
pollpacketXs
- 
cCsm|idjoYt|i�djoC|id }|id|_tid|�d|_d|_ndS(Niis<ii(tbufstateR�R�R�tunpackR�(R
R7((s#/usr/lib64/python2.6/idlelib/rpc.pyR�hs
&
cCsg|idjoSt|i�|ijo:|i|i }|i|i|_d|_d|_|SdS(Niii(R�R�R�R�(R
tpacket((s#/usr/lib64/python2.6/idlelib/rpc.pyR�os )  cCs�|i|�}|djodSyti|�}Wn_tij
oPtidIJtidIt|�IJti dti�tidIJ�nX|S(Ns-----------------------scannot unpickle packet:R(
R�RRRtUnpicklingErrorRRRRt print_stack(R
RgR�R�((s#/usr/lib64/python2.6/idlelib/rpc.pyt pollmessagews


c

CsÐxÉytid�}Wntij
on-X|\}}|d|ff}|i|�y%|i|�}|djodSWn1tj
o|i�dSt j
odSX|\}}|d}|i
d||f�|d jov|i
d|�|i ||�}|i
d||f�|djo|i||f�q|djoqqq||jo|S|i i|d�} | dj o/| i
�||i|<| i�| i�qqqdS(
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.

iRAspollresponse:%d:myseq:%sRCRDspollresponse:%d:localcall:call:s%pollresponse:%d:localcall:response:%sN(sCALLsQUEUE(tresponse_queuetgettQueuetEmptyReR�RRqt
handle_EOFR�R9R]R0R|R/tnotifyR}(
R
RrRgtqmsgRSRjR�tresqRTtcv((s#/usr/lib64/python2.6/idlelib/rpc.pyR{�sN 

 
 

 






cCsq|i�|id�xI|iD]>}|i|}|i�d|i|<|i�|i�q!W|i�dS(s+action taken upon link being closed by peerR�RkN(sEOFN( tEOFhookR9R0R|RR/R R}R2(R
tkeyR£((s#/usr/lib64/python2.6/idlelib/rpc.pyR�Îs






cCsdS(sBClasses using rpc client/server can override to augment EOF actionN((R
((s#/usr/lib64/python2.6/idlelib/rpc.pyR¤ÛsN("R'R(R~RR R1R2R9R<R>R]R`RbR^RaR_RiRlRsRhRuRtRcReR�R�R�R�R�R�R�R{R�R¤(((s#/usr/lib64/python2.6/idlelib/rpc.pyR)|s>      *  

  
         I
RNcBseZRS((R'R((((s#/usr/lib64/python2.6/idlelib/rpc.pyRNáscCs t|�}|t|<t|�S(N(tidR-Rv(RWR:((s#/usr/lib64/python2.6/idlelib/rpc.pyROås 
RvcBseZd�ZRS(cCs
||_dS(N(R:(R
R:((s#/usr/lib64/python2.6/idlelib/rpc.pyR ìs(R'R(R (((s#/usr/lib64/python2.6/idlelib/rpc.pyRvêsR cBs/eZeZdZd�Zd�Zd�ZRS(s#ScCs6||_ti||�tii||||�dS(N(tcurrent_handlerR)R R
tBaseRequestHandler(R
R,Rtsvr((s#/usr/lib64/python2.6/idlelib/rpc.pyR ôs cCs|i�dS(s(handle() method required by SocketServerN(Rs(R
((s#/usr/lib64/python2.6/idlelib/rpc.pythandleùscCs
t||�S(N(Rw(R
R:((s#/usr/lib64/python2.6/idlelib/rpc.pytget_remote_proxyýs(R'R(tFalseR+R4R RªR«(((s#/usr/lib64/python2.6/idlelib/rpc.pyR ïs
  t RPCClientcBsAeZeZdZdZeieid�Z d�Z
d�Z RS(s#CicCs9ti||�|_|ii|�|iid�dS(Ni(Rtlistening_socktbindtlisten(R
taddresstfamilyttype((s#/usr/lib64/python2.6/idlelib/rpc.pyR scCs{|ii�\}}|iotidI|IJn|dtjoti||�ntidI|IJti �dS(Ns****** Connection request from is** Invalid host: (
R®tacceptR+RRt LOCALHOSTR)R RRR(R
t working_sockR±((s#/usr/lib64/python2.6/idlelib/rpc.pyR´ s
cCs
t||�S(N(Rw(R
R:((s#/usr/lib64/python2.6/idlelib/rpc.pyR«s( R'R(R¬R+R4R~RtAF_INETt SOCK_STREAMR R´R«(((s#/usr/lib64/python2.6/idlelib/rpc.pyR­s 
RwcBs8eZdZdZd�Zd�Zd�Zd�ZRS(cCs||_||_dS(N(tsockioR:(R
R¹R:((s#/usr/lib64/python2.6/idlelib/rpc.pyR s cCs¬|idjo|i�n|ii|�ot|i|i|�S|idjo|i�n|ii |�o&|ii
|id|fh�}|St |�dS(Nt__getattribute__( t_RPCProxy__methodsRt_RPCProxy__getmethodsR�t MethodProxyR¹R:t_RPCProxy__attributest_RPCProxy__getattributesRHR`R�(R
tnametvalue((s#/usr/lib64/python2.6/idlelib/rpc.pyt __getattr__"scCs%|ii|iddh�|_dS(NRB((R¹R`R:R¾(R
((s#/usr/lib64/python2.6/idlelib/rpc.pyt__getattributes0scCs%|ii|iddh�|_dS(NR@((R¹R`R:R»(R
((s#/usr/lib64/python2.6/idlelib/rpc.pyt __getmethods4sN( R'R(RR»R¾R RÂR¿R¼(((s#/usr/lib64/python2.6/idlelib/rpc.pyRws    cCsªx>t|�D]0}t||�}t|�od||<q
q
Wt|�tijot|i|�nt|�tijo%x"|i D]}t||�q�WndS(Ni(
tdirRLtcallableR³Rxt InstanceTypeRIt __class__t ClassTypet __bases__(RWRXRÀtattrtsuper((s#/usr/lib64/python2.6/idlelib/rpc.pyRI8s


cCsEx>t|�D]0}t||�}t|�pd||<q
q
WdS(Ni(RÅRLRÆ(RWRYRÀRË((s#/usr/lib64/python2.6/idlelib/rpc.pyRJEs


R½cBseZd�Zd�ZRS(cCs||_||_||_dS(N(R¹R:RÀ(R
R¹R:RÀ((s#/usr/lib64/python2.6/idlelib/rpc.pyR Ms  cOs%|ii|i|i||�}|S(N(R¹R`R:RÀ(R
R6RVRÁ((s#/usr/lib64/python2.6/idlelib/rpc.pyt__call__Rs!(R'R(R RÍ(((s#/usr/lib64/python2.6/idlelib/rpc.pyR½Ks (%t__doc__RR!RR�R
R�tcPickleRRR�Rtcopy_regRxRRRtCodeTypeR�RµR RR-RPR�R;R)RNRORvR¨R R­RwRIRJR½(((s#/usr/lib64/python2.6/idlelib/rpc.pyt<module>sB              

2ÿf