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 :  /proc/21571/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21571/root/usr/lib64/python2.4/asynchat.pyo
mò
‚=5Dc@sqdZdkZdkZdklZdeifd„ƒYZdfd„ƒYZdfd„ƒYZd	„Z	dS(
s¥A class supporting chat-style (command/response) protocols.

This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).

The handle_read() method looks at the input stream for the current
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
for multi-line output), calling self.found_terminator() on its
receipt.

for example:
Say you build an async nntp client using this class.  At the start
of the connection, you'll have self.terminator set to '\r\n', in
order to process the single-line greeting.  Just before issuing a
'LIST' command you'll set it to '\r\n.\r\n'.  The output of the LIST
command will be accumulated (using your own 'collect_incoming_data'
method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
N(sdequet
async_chatcBs­tZdZdZdZed„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„Zd„Zd
„Zd„Zd„Zd„Zd„ZRS(s‡This is an abstract class.  You must derive from this class, and add
    the two methods collect_incoming_data() and found_terminator()icCs5d|_d|_tƒ|_tii||ƒdS(Nt(	tselftac_in_buffert
ac_out_buffertfifot
producer_fifotasyncoret
dispatchert__init__tconn(RR
((t /usr/lib64/python2.4/asynchat.pyR	>s		cCs
td‚dS(Nsmust be implemented in subclass(tNotImplementedError(Rtdata((Rtcollect_incoming_dataDscCs
td‚dS(Nsmust be implemented in subclass(R(R((Rtfound_terminatorGscCs
||_dS(sRSet the input delimiter.  Can be a fixed string of any length, an integer, or NoneN(ttermRt
terminator(RR((Rtset_terminatorJscCs|iS(N(RR(R((Rtget_terminatorNscCs"y|i|iƒ}Wn&tij
o}|iƒdSnX|i||_xÌ|ioÁt	|iƒ}|iƒ}|djp
|djo|i|iƒd|_qRt|tƒo{|}||jo-|i|iƒd|_|i||_q|i|i| ƒ|i||_d|_|iƒqRt	|ƒ}|ii|ƒ}|djoG|djo|i|i| ƒn|i|||_|iƒqRt|i|ƒ}|o<||jo*|i|i| ƒ|i||_nPqR|i|iƒd|_qRWdS(NRiiÿÿÿÿ(Rtrecvtac_in_buffer_sizeR
tsocketterrortwhythandle_errorRtlentlbRRtNoneRt
isinstancetinttnRtterminator_lentfindtindextfind_prefix_at_end(RR"RRR RR
R((Rthandle_readVsL
	


			


cCs|iƒdS(N(Rt
initiate_send(R((Rthandle_write˜scCs|iƒdS(N(Rtclose(R((Rthandle_close›scCs$|iit|ƒƒ|iƒdS(N(RRtpushtsimple_producerR
R%(RR
((RR)žscCs|ii|ƒ|iƒdS(N(RRR)tproducerR%(RR+((Rtpush_with_producer¢scCst|iƒ|ijS(s4predicate for inclusion in the readable for select()N(RRRR(R((Rtreadable¦scCs(|idjo|iiƒo|iS(s4predicate for inclusion in the writable for select()RN(RRRtis_emptyt	connected(R((RtwritableªscCs|iidƒdS(sAautomatically close this channel once the outgoing queue is emptyN(RRR)R(R((Rtclose_when_done´scCsÚxÓt|iƒoº|iiƒ}|djo-|ip|iiƒ|iƒndSn6t	|t
ƒo%|iiƒ|i||_dSn|iƒ}|o|i||_dSqÑ|iiƒqdSqWdS(Ni(
RRRtfirsttpRRtpopR'RtstrtmoreR
(RR3R
((Rt
refill_bufferºs&



cCs§|i}t|iƒ|jo|iƒn|iol|ioby5|i|i| ƒ}|o|i||_nWq£t	i
j
o}|iƒdSq£XndS(N(
Rtac_out_buffer_sizetobsRRR7R/tsendtnum_sentRRRR(RR9RR;((RR%Òs	
cCs5d|_d|_x|io|iiƒqWdS(NR(RRRRR4(R((Rtdiscard_buffersãs
		
(t__name__t
__module__t__doc__RR8RR	RRRRR$R&R(R)R,R-R0R1R7R%R<(((RR5s&					B						
			R*cBstZdd„Zd„ZRS(NicCs||_||_dS(N(R
Rtbuffer_size(RR
R@((RR	ís	cCs^t|iƒ|ijo+|i|i }|i|i|_|Sn|i}d|_|SdS(NR(RRR
R@tresult(RRA((RR6ñs		(R=R>R	R6(((RR*ësRcBsAtZdd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCs*|ptƒ|_nt|ƒ|_dS(N(tlisttdequeR(RRB((RR	üscCs
t|iƒS(N(RRRB(R((Rt__len__scCs|iS(N(RRB(R((RR.scCs|idS(Ni(RRB(R((RR2scCs|ii|ƒdS(N(RRBtappendR
(RR
((RR)scCs)|iod|iiƒfSndSdS(Nii(iN(RRBtpopleftR(R((RR4s
(	R=R>RR	RDR.R2R)R4(((RRûs				cCsBt|ƒd}x+|o#|i|| ƒo|d8}qW|S(Ni(Rtneedletlthaystacktendswith(RIRGRH((RR##s
(
R?RRtcollectionsRCRRR*RR#(RCRRR#R*RR((Rt?/s		
¶(

Anon7 - 2021