config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/idlelib/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/idlelib/rpc.pyc

hRc@sdZddkZddkZddkZddkZddkZddkZddkZddk	Z	ddk
Z
ddkZddkZddk
Z
ddkZdZdZeie
ieeddZdZdeifd	YZhZe
i
d
Ze
i
d
ZdefdYZd
efdYZdZdefdYZdeiefdYZdefdYZ defdYZ!dZ"dZ#defdYZ$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.

iNcCs-ti|}t|tipt|S(N(tmarshaltloadst
isinstancettypestCodeTypetAssertionError(tmstco((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
unpickle_code-scCs6t|tiptti|}t|ffS(N(RRRRRtdumpsR(RR((s'/usr/local/lib/python2.5/idlelib/rpc.pytpickle_code2siis	127.0.0.1t	RPCServercBs8eZddZdZdZdZdZRS(cCs1|djo
t}ntii|||dS(N(tNonet
RPCHandlertSocketServert	TCPServert__init__(tselftaddrthandlerclass((s'/usr/local/lib/python2.5/idlelib/rpc.pyRGs

cCsdS(s@Override TCPServer method, no bind() phase for connecting entityN((R((s'/usr/local/lib/python2.5/idlelib/rpc.pytserver_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(tsockettconnecttserver_address(R((s'/usr/local/lib/python2.5/idlelib/rpc.pytserver_activatePscCs|i|ifS(s:Override TCPServer method, return already connected socket(RR(R((s'/usr/local/lib/python2.5/idlelib/rpc.pytget_requestYscCsyWntj
o
nti}|dddIJ|dIJ|dtiiIJ|dI|IJ|dIt|IJtid||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__t	threadingt
currentThreadtgetNametreprt	tracebackt	print_exctost_exit(Rtrequesttclient_addressterf((s'/usr/local/lib/python2.5/idlelib/rpc.pythandle_error]s	

N(t__name__t
__module__RRRRRR*(((s'/usr/local/lib/python2.5/idlelib/rpc.pyREs
				itSocketIOcBseZdZdddZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!RS(icCshti|_|dj	o
||_n||_|djo
t}n||_h|_h|_	dS(N(
RR t
sockthreadRt	debuggingtsocktobjecttabletobjtablet	responsestcvars(RR0R2R/((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs

	

		cCs1|i}d|_|dj	o|indS(N(R0Rtclose(RR0((s'/usr/local/lib/python2.5/idlelib/rpc.pyR5s		
cCstidS(s!override for specific exit actionN(R%R&(R((s'/usr/local/lib/python2.5/idlelib/rpc.pytexithookscGsk|ipdSn|idttii}x"|D]}|dt|}q<Wti|IJdS(Nt (R/tlocationtstrRR R!RR(Rtargststa((s'/usr/local/lib/python2.5/idlelib/rpc.pytdebugs
#cCs||i|<dS(N(R2(Rtoidtobject((s'/usr/local/lib/python2.5/idlelib/rpc.pytregisterscCs(y|i|=Wntj
onXdS(N(R2tKeyError(RR>((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
unregisterscCs
|id|y|\}\}}}}Wntj
odSnX|ii|pdd|ffSn|i|}|djo!h}	t||	d|	fSn|djo!h}
t||
d|
fSnt||pdd|ffSnt||}y|d	jo=|||}t|t	ot
|}nd|fSn@|d
jo$ti||||ffdSndd|fSWnktj
o
nWtij
o
n?d
}
ti|
|||fIJtidtidSnXdS(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(sERRORsBad request format(RIN(RJN(R=t	TypeErrorR2thas_keyt_getmethodst_getattributesthasattrtgetattrRtRemoteObjectt	remotereft
request_queuetputRRRterrorRRR#R$(RtseqR'thowR>t
methodnameR:tkwargstobjtmethodst
attributestmethodtrettmsg((s'/usr/local/lib/python2.5/idlelib/rpc.pyt	localcallsL	






cCs8|id|||i||||}|i|S(Nsremotecall:asynccall: (R=t	asynccalltasyncreturn(RR>RXR:RYRV((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
remotecallscCs8|id|||i||||}|i|S(Nsremotequeue:asyncqueue: (R=t
asyncqueueRb(RR>RXR:RYRV((s'/usr/local/lib/python2.5/idlelib/rpc.pytremotequeuescCsd||||ff}|i}ti|ijoti}||i|<n|id||||||i||f|S(NRGs
asynccall:%d:(tnewseqRR R.t	ConditionR4R=t
putmessage(RR>RXR:RYR'RVtcvar((s'/usr/local/lib/python2.5/idlelib/rpc.pyRascCsd||||ff}|i}ti|ijoti}||i|<n|id||||||i||f|S(NRHsasyncqueue:%d:(RfRR R.RgR4R=Rh(RR>RXR:RYR'RVRi((s'/usr/local/lib/python2.5/idlelib/rpc.pyRdscCsG|id||i|dd}|id|||i|S(Ns#asyncreturn:%d:call getresponse(): twaitg?sasyncreturn:%d:response: (R=tgetresponsetdecoderesponse(RRVtresponse((s'/usr/local/lib/python2.5/idlelib/rpc.pyRbscCs|\}}|djo|Sn|djodSn|djo|iddSn|djo|id|idSn|djo|id|t|nt||fdS(	NRERIRJsdecoderesponse: EXCEPTIONtEOFsdecoderesponse: EOFRCsdecoderesponse: Internal ERROR:(RR=tdecode_interrupthooktRuntimeErrortSystemError(RRmRWtwhat((s'/usr/local/lib/python2.5/idlelib/rpc.pyRls 








cCs
tdS(tN(tEOFError(R((s'/usr/local/lib/python2.5/idlelib/rpc.pyRoscCsEy|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.

        tmyseqRjg?smainloop:returnN(RkRRtR=(R((s'/usr/local/lib/python2.5/idlelib/rpc.pytmainloop
s

cCsY|i||}|dj	o6|\}}|djo||i|f}qUn|S(NRE(t_getresponseRt_proxify(RRuRjRmRWRr((s'/usr/local/lib/python2.5/idlelib/rpc.pyRks

cCsOt|tot||iSnt|tiot|i|Sn|S(N(RtRemoteProxytRPCProxyR>RtListTypetmapRx(RRZ((s'/usr/local/lib/python2.5/idlelib/rpc.pyRxs
cCs|id|ti|ijo1x|i||}|dj	o|Sq)q)n|i|}|ix"|ii	|p|i
qqW|i|}|id||f|i|=|i|=|i|SdS(Ns_getresponse:myseq:s-_getresponse:%s: thread woke up: response: %s(R=RR R.tpollresponseRR4tacquireR3RLRjtrelease(RRuRjRmRi((s'/usr/local/lib/python2.5/idlelib/rpc.pyRw's$



	


cCs|id|_}|S(Ni(tnextseq(RRV((s'/usr/local/lib/python2.5/idlelib/rpc.pyRf=sc
Cs|id|dyti|}Wn2tij
o#tidIt|IJnXtidt	||}xt	|djoy>t
i
g|igg\}}}|ii|t
 }Wn:ttfj
otdq|tij
o
q|X||}q|WdS(Nsputmessage:%d:isCannot pickle:s<issocket no longer exists(R=tpickleR	t
PicklingErrorRRR"tstructtpacktlentselectR0tsendtBUFSIZEtAttributeErrorRKtIOErrorRRU(RtmessageR;trtwtxtn((s'/usr/local/lib/python2.5/idlelib/rpc.pyRhAs"$
RsicCs|it|i|ijoti|iiggg|\}}}t|djodSny|iit	}Wnt
ij
o
tnXt|djo
tn|i|7_|in|i
S(Ni(t_stage0RtbuffertbufneedRR0tfilenoRtrecvRRRURtt_stage1(RRjRRRR;((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
pollpacketXs
-
cCsm|idjoYt|idjoC|id }|id|_tid|d|_d|_ndS(Niis<ii(tbufstateRRRtunpackR(RR;((s'/usr/local/lib/python2.5/idlelib/rpc.pyRhs
&
cCsj|idjoVt|i|ijo=|i|i }|i|i|_d|_d|_|SndS(Niii(RRRR(Rtpacket((s'/usr/local/lib/python2.5/idlelib/rpc.pyRos)		cCs|i|}|djodSnyti|}Wn_tij
oPtidIJtidIt|IJti	dtitidIJnX|S(Ns-----------------------scannot unpickle packet:R(
RRRRtUnpicklingErrorRRR"R#tprint_stack(RRjRR((s'/usr/local/lib/python2.5/idlelib/rpc.pytpollmessagews


c

Csxytid}Wntij
on-X|\}}|d|ff}|i|y(|i|}|djodSnWn7tj
o|idSnt	j
odSnX|\}}|d}|i
d||f|d	jov|i
d||i||}|i
d||f|djo|i||fq|djoqqq||jo|Sq|ii|d}	|	dj	o/|	i
||i|<|	i|	iqqqdS(
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.

        iREspollresponse:%d:myseq:%sRGRHspollresponse:%d:localcall:call:s%pollresponse:%d:localcall:response:%sN(sCALLsQUEUE(tresponse_queuetgettQueuetEmptyRhRRRtt
handle_EOFRR=R`R4R~R3tnotifyR(
RRuRjtqmsgRVRmRtresqRWtcv((s'/usr/local/lib/python2.5/idlelib/rpc.pyR}sN


	

	






cCsq|i|idxI|iD]>}|i|}|id|i|<|i|iq!W|idS(s+action taken upon link being closed by peerRRnN(sEOFN(	tEOFhookR=R4R~RR3RRR6(RtkeyR((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs






cCsdS(sBClasses using rpc client/server can override to augment EOF actionN((R((s'/usr/local/lib/python2.5/idlelib/rpc.pyRsN("R+R,RRRR5R6R=R@RBR`RcReRaRdRbRlRoRvRkRxRwRfRhRRRRRRRR}RR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyR-|s>						*			
	
				
										I	
RQcBseZRS((R+R,(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRQscCs t|}|t|<t|S(N(tidR1Ry(RZR>((s'/usr/local/lib/python2.5/idlelib/rpc.pyRRs
RycBseZdZRS(cCs
||_dS(N(R>(RR>((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs(R+R,R(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRysR
cBs/eZeZdZdZdZdZRS(s#ScCs6||_ti||tii||||dS(N(tcurrent_handlerR-RRtBaseRequestHandler(RR0Rtsvr((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs	cCs|idS(s(handle() method required by SocketServerN(Rv(R((s'/usr/local/lib/python2.5/idlelib/rpc.pythandlescCs
t||S(N(Rz(RR>((s'/usr/local/lib/python2.5/idlelib/rpc.pytget_remote_proxys(R+R,tFalseR/R8RRR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyR
s
		t	RPCClientcBsAeZeZdZdZeieidZ	dZ
dZRS(s#CicCsUti|||_|iititid|ii||iiddS(Ni(Rtlistening_sockt
setsockoptt
SOL_SOCKETtSO_REUSEADDRtbindtlisten(Rtaddresstfamilyttype((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs

cCs{|ii\}}|iotidI|IJn|dtjoti||ntidI|IJti	dS(Ns****** Connection request from is** Invalid host: (
RtacceptR/RRt	LOCALHOSTR-RRRU(Rtworking_sockR((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs
cCs
t||S(N(Rz(RR>((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs(R+R,RR/R8RRtAF_INETtSOCK_STREAMRRR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs	
RzcBs8eZdZdZdZdZdZdZRS(cCs||_||_dS(N(tsockioR>(RRR>((s'/usr/local/lib/python2.5/idlelib/rpc.pyR s	cCs|idjo|in|ii|ot|i|i|Sn|idjo|in|ii	|o)|ii
|id|fh}|Sn
t|dS(Nt__getattribute__(t_RPCProxy__methodsRt_RPCProxy__getmethodsRtMethodProxyRR>t_RPCProxy__attributest_RPCProxy__getattributesRLRcR(Rtnametvalue((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getattr__$scCs%|ii|iddh|_dS(NRF((RRcR>R(R((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getattributes2scCs%|ii|iddh|_dS(NRD((RRcR>R(R((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getmethods6sN(	R+R,RRRRRRR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRzs			cCsx>t|D]0}t||}t|od||<q
q
Wt|tijot|i|nt|tijo%x"|i	D]}t||qWndS(Ni(
tdirRPtcallableRRtInstanceTypeRMt	__class__t	ClassTypet	__bases__(RZR[Rtattrtsuper((s'/usr/local/lib/python2.5/idlelib/rpc.pyRM:s


cCsEx>t|D]0}t||}t|pd||<q
q
WdS(Ni(RRPR(RZR\RR((s'/usr/local/lib/python2.5/idlelib/rpc.pyRNGs


RcBseZdZdZRS(cCs||_||_||_dS(N(RR>R(RRR>R((s'/usr/local/lib/python2.5/idlelib/rpc.pyROs		cOs%|ii|i|i||}|S(N(RRcR>R(RR:RYR((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__call__Ts!(R+R,RR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRMs	(%t__doc__RR%RRRRtcPickleRRRR#tcopy_regRRRR
RRRRRR1RSRR?R-RQRRRyRR
RRzRMRNR(((s'/usr/local/lib/python2.5/idlelib/rpc.pys<module>sB		

2f		
	

Man Man