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.pyo

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.

iNcCsti|}|S(N(tmarshaltloads(tmstco((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
unpickle_code-scCsti|}t|ffS(N(RtdumpsR(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.pyRGs

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(R
trequesttclient_addressterf((s'/usr/local/lib/python2.5/idlelib/rpc.pythandle_error]s	

N(t__name__t
__module__RRRRRR&(((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(
RRt
sockthreadRt	debuggingtsocktobjecttabletobjtablet	responsestcvars(R
R,R.R+((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs

	

		cCs1|i}d|_|dj	o|indS(N(R,Rtclose(R
R,((s'/usr/local/lib/python2.5/idlelib/rpc.pyR1s		
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+tlocationtstrRRRRR(R
targststa((s'/usr/local/lib/python2.5/idlelib/rpc.pytdebugs
#cCs||i|<dS(N(R.(R
toidtobject((s'/usr/local/lib/python2.5/idlelib/rpc.pytregisterscCs(y|i|=Wntj
onXdS(N(R.tKeyError(R
R:((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(REN(RFN(R9t	TypeErrorR.thas_keyt_getmethodst_getattributesthasattrtgetattrt
isinstancetRemoteObjectt	remotereft
request_queuetputRRRterrorRRRR (R
tseqR#thowR:t
methodnameR6tkwargstobjtmethodst
attributestmethodtrettmsg((s'/usr/local/lib/python2.5/idlelib/rpc.pyt	localcallsL	






cCs8|id|||i||||}|i|S(Nsremotecall:asynccall: (R9t	asynccalltasyncreturn(R
R:RUR6RVRS((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
remotecallscCs8|id|||i||||}|i|S(Nsremotequeue:asyncqueue: (R9t
asyncqueueR_(R
R:RUR6RVRS((s'/usr/local/lib/python2.5/idlelib/rpc.pytremotequeuescCsd||||ff}|i}ti|ijoti}||i|<n|id||||||i||f|S(NRCs
asynccall:%d:(tnewseqRRR*t	ConditionR0R9t
putmessage(R
R:RUR6RVR#RStcvar((s'/usr/local/lib/python2.5/idlelib/rpc.pyR^scCsd||||ff}|i}ti|ijoti}||i|<n|id||||||i||f|S(NRDsasyncqueue:%d:(RcRRR*RdR0R9Re(R
R:RUR6RVR#RSRf((s'/usr/local/lib/python2.5/idlelib/rpc.pyRascCsG|id||i|dd}|id|||i|S(Ns#asyncreturn:%d:call getresponse(): twaitg?sasyncreturn:%d:response: (R9tgetresponsetdecoderesponse(R
RStresponse((s'/usr/local/lib/python2.5/idlelib/rpc.pyR_scCs|\}}|djo|Sn|djodSn|djo|iddSn|djo|id|idSn|djo|id|t|nt||fdS(	NRARERFsdecoderesponse: EXCEPTIONtEOFsdecoderesponse: EOFR?sdecoderesponse: Internal ERROR:(RR9tdecode_interrupthooktRuntimeErrortSystemError(R
RjRTtwhat((s'/usr/local/lib/python2.5/idlelib/rpc.pyRis 








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

        tmyseqRgg?smainloop:returnN(RhRRqR9(R
((s'/usr/local/lib/python2.5/idlelib/rpc.pytmainloop
s

cCsY|i||}|dj	o6|\}}|djo||i|f}qUn|S(NRA(t_getresponseRt_proxify(R
RrRgRjRTRo((s'/usr/local/lib/python2.5/idlelib/rpc.pyRhs

cCsOt|tot||iSnt|tiot|i|Sn|S(N(RMtRemoteProxytRPCProxyR:ttypestListTypetmapRu(R
RW((s'/usr/local/lib/python2.5/idlelib/rpc.pyRus
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(R9RRR*tpollresponseRR0tacquireR/RHRgtrelease(R
RrRgRjRf((s'/usr/local/lib/python2.5/idlelib/rpc.pyRt's$



	


cCs|id|_}|S(Ni(tnextseq(R
RS((s'/usr/local/lib/python2.5/idlelib/rpc.pyRc=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(R9tpickleRt
PicklingErrorRRRtstructtpacktlentselectR,tsendtBUFSIZEtAttributeErrorRGtIOErrorRRR(R
tmessageR7trtwtxtn((s'/usr/local/lib/python2.5/idlelib/rpc.pyReAs"$
RpicCs|it|i|ijoti|iiggg|\}}}t|djodSny|iit	}Wnt
ij
o
tnXt|djo
tn|i|7_|in|i
S(Ni(t_stage0RtbuffertbufneedRR,tfilenoRtrecvRRRRRqt_stage1(R
RgRRRR7((s'/usr/local/lib/python2.5/idlelib/rpc.pyt
pollpacketXs
-
cCsm|idjoYt|idjoC|id }|id|_tid|d|_d|_ndS(Niis<ii(tbufstateRRRtunpackR(R
R7((s'/usr/local/lib/python2.5/idlelib/rpc.pyRhs
&
cCsj|idjoVt|i|ijo=|i|i }|i|i|_d|_d|_|SndS(Niii(RRRR(R
tpacket((s'/usr/local/lib/python2.5/idlelib/rpc.pyRos)		cCs|i|}|djodSnyti|}Wn_tij
oPtidIJtidIt|IJti	dtitidIJnX|S(Ns-----------------------scannot unpickle packet:R(
RRRRtUnpicklingErrorRRRRtprint_stack(R
RgRR((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.

        iRAspollresponse:%d:myseq:%sRCRDspollresponse:%d:localcall:call:s%pollresponse:%d:localcall:response:%sN(sCALLsQUEUE(tresponse_queuetgettQueuetEmptyReRRRqt
handle_EOFRR9R]R0R|R/tnotifyR}(
R
RrRgtqmsgRSRjRtresqRTtcv((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 peerRRkN(sEOFN(	tEOFhookR9R0R|RR/RR}R2(R
tkeyR((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(R~RRR1R2R9R<R>R]R`RbR^RaR_RiRlRsRhRuRtRcReRRRRRRRR{RR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyR)|s>						*			
	
				
										I	
RNcBseZRS((R'R((((s'/usr/local/lib/python2.5/idlelib/rpc.pyRNscCs t|}|t|<t|S(N(tidR-Rv(RWR:((s'/usr/local/lib/python2.5/idlelib/rpc.pyROs
RvcBseZdZRS(cCs
||_dS(N(R:(R
R:((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs(R'R(R(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRvsR	cBs/eZeZdZdZdZdZRS(s#ScCs6||_ti||tii||||dS(N(tcurrent_handlerR)RR
tBaseRequestHandler(R
R,Rtsvr((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs	cCs|idS(s(handle() method required by SocketServerN(Rs(R
((s'/usr/local/lib/python2.5/idlelib/rpc.pythandlescCs
t||S(N(Rw(R
R:((s'/usr/local/lib/python2.5/idlelib/rpc.pytget_remote_proxys(R'R(tFalseR+R4RRR(((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(R
taddresstfamilyttype((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs

cCs{|ii\}}|iotidI|IJn|dtjoti||ntidI|IJti	dS(Ns****** Connection request from is** Invalid host: (
RtacceptR+RRt	LOCALHOSTR)RRRR(R
tworking_sockR((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs
cCs
t||S(N(Rw(R
R:((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs(R'R(RR+R4R~RtAF_INETtSOCK_STREAMRRR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRs	
RwcBs8eZdZdZdZdZdZdZRS(cCs||_||_dS(N(tsockioR:(R
RR:((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__methodsRt_RPCProxy__getmethodsRtMethodProxyRR:t_RPCProxy__attributest_RPCProxy__getattributesRHR`R(R
tnametvalue((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getattr__$scCs%|ii|iddh|_dS(NRB((RR`R:R(R
((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getattributes2scCs%|ii|iddh|_dS(NR@((RR`R:R(R
((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__getmethods6sN(	R'R(RRRRRRR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRws			cCsx>t|D]0}t||}t|od||<q
q
Wt|tijot|i|nt|tijo%x"|i	D]}t||qWndS(Ni(
tdirRLtcallableRRxtInstanceTypeRIt	__class__t	ClassTypet	__bases__(RWRXRtattrtsuper((s'/usr/local/lib/python2.5/idlelib/rpc.pyRI:s


cCsEx>t|D]0}t||}t|pd||<q
q
WdS(Ni(RRLR(RWRYRR((s'/usr/local/lib/python2.5/idlelib/rpc.pyRJGs


RcBseZdZdZRS(cCs||_||_||_dS(N(RR:R(R
RR:R((s'/usr/local/lib/python2.5/idlelib/rpc.pyROs		cOs%|ii|i|i||}|S(N(RR`R:R(R
R6RVR((s'/usr/local/lib/python2.5/idlelib/rpc.pyt__call__Ts!(R'R(RR(((s'/usr/local/lib/python2.5/idlelib/rpc.pyRMs	(%t__doc__RR!RRR
RtcPickleRRRRtcopy_regRxRRRtCodeTypeRRRRR-RPRR;R)RNRORvRR	RRwRIRJR(((s'/usr/local/lib/python2.5/idlelib/rpc.pys<module>sB		

2f		
	

Man Man