ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/asynchat.pyc

Ñò
nÄMc@s dZddkZddkZddklZddklZddklZl	Z	dei
fd„ƒYZdd
d	„ƒYZd
dd„ƒYZ
d„ZdS(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.
iÿÿÿÿN(tdeque(tpy3kwarning(tfilterwarningstcatch_warningst
async_chatcBs¹eZdZdZdZddd„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„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()icCs8d|_g|_tƒ|_tii|||ƒdS(Nt(tac_in_buffertincomingRt
producer_fifotasyncoret
dispatchert__init__(tselftsocktmap((s/usr/lib/python2.6/asynchat.pyR@s		cCstdƒ‚dS(Nsmust be implemented in subclass(tNotImplementedError(Rtdata((s/usr/lib/python2.6/asynchat.pytcollect_incoming_dataQscCs|ii|ƒdS(N(Rtappend(RR((s/usr/lib/python2.6/asynchat.pyt_collect_incoming_dataTscCsdi|iƒ}|i2|S(NR(tjoinR(Rtd((s/usr/lib/python2.6/asynchat.pyt	_get_dataWscCstdƒ‚dS(Nsmust be implemented in subclass(R(R((s/usr/lib/python2.6/asynchat.pytfound_terminator\scCs
||_dS(sRSet the input delimiter.  Can be a fixed string of any length, an integer, or NoneN(t
terminator(Rtterm((s/usr/lib/python2.6/asynchat.pytset_terminator_scCs|iS(N(R(R((s/usr/lib/python2.6/asynchat.pytget_terminatorcscCsy|i|iƒ}Wn#tij
o}|iƒdSX|i||_xÉ|io¾t|iƒ}|iƒ}|p|i|iƒd|_qOt	|t
ƒpt	|tƒo{|}||jo-|i|iƒd|_|i||_q|i|i| ƒ|i||_d|_|i
ƒqOt|ƒ}|ii|ƒ}|djoG|djo|i|i| ƒn|i|||_|i
ƒqOt|i|ƒ}|o<||jo*|i|i| ƒ|i||_nPqO|i|iƒd|_qOWdS(NRiiÿÿÿÿ(trecvtac_in_buffer_sizetsocketterrorthandle_errorRtlenRRt
isinstancetinttlongRRtfindtfind_prefix_at_end(RRtwhytlbRtntterminator_lentindex((s/usr/lib/python2.6/asynchat.pythandle_readksL


 
			


cCs|iƒdS(N(t
initiate_send(R((s/usr/lib/python2.6/asynchat.pythandle_write­scCs|iƒdS(N(tclose(R((s/usr/lib/python2.6/asynchat.pythandle_close°scCs||i}t|ƒ|joBxOtdt|ƒ|ƒD]!}|ii||||!ƒq5Wn|ii|ƒ|iƒdS(Ni(tac_out_buffer_sizeR!txrangeRRR-(RRtsabsti((s/usr/lib/python2.6/asynchat.pytpush³s	#cCs|ii|ƒ|iƒdS(N(RRR-(Rtproducer((s/usr/lib/python2.6/asynchat.pytpush_with_producer¼scCsdS(s4predicate for inclusion in the readable for select()i((R((s/usr/lib/python2.6/asynchat.pytreadableÀscCs|ip|iS(s4predicate for inclusion in the writable for select()(Rt	connected(R((s/usr/lib/python2.6/asynchat.pytwritableÈscCs|iidƒdS(sAautomatically close this channel once the outgoing queue is emptyN(RRtNone(R((s/usr/lib/python2.6/asynchat.pytclose_when_doneÌsc
Cs…x~|ios|ioi|id}|p*|id=|djo|iƒdSn|i}yLtƒiiƒz1tot	ddt
ƒnt|d|ƒ}WdQXWnGtj
o;|i
ƒ}|o|ii|ƒq|id=qnXy|i|ƒ}Wn!tij
o|iƒdSX|oI|t|ƒjp|t|ƒjo|||id<q{|id=ndSWdS(Nitignores.*buffer(RR9R;R0R1Rt__exit__t	__enter__RRtDeprecationWarningtbuffert	TypeErrortmoret
appendlefttsendRRR R!(RtfirsttobsRtnum_sent((s/usr/lib/python2.6/asynchat.pyR-Ðs<



		

&cCs!d|_|i2|iiƒdS(NR(RRRtclear(R((s/usr/lib/python2.6/asynchat.pytdiscard_buffersøs	N(t__name__t
__module__t__doc__RR1R;RRRRRRRR,R.R0R5R7R8R:R<R-RJ(((s/usr/lib/python2.6/asynchat.pyR7s(							B									(tsimple_producercBseZdd„Zd„ZRS(icCs||_||_dS(N(Rtbuffer_size(RRRO((s/usr/lib/python2.6/asynchat.pyRs	cCs[t|iƒ|ijo(|i|i }|i|i|_|S|i}d|_|SdS(NR(R!RRO(Rtresult((s/usr/lib/python2.6/asynchat.pyRCs		(RKRLRRC(((s/usr/lib/python2.6/asynchat.pyRNþstfifocBsAeZdd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs*|ptƒ|_nt|ƒ|_dS(N(Rtlist(RRR((s/usr/lib/python2.6/asynchat.pyRscCs
t|iƒS(N(R!RR(R((s/usr/lib/python2.6/asynchat.pyt__len__scCs|iS(N(RR(R((s/usr/lib/python2.6/asynchat.pytis_emptyscCs|idS(Ni(RR(R((s/usr/lib/python2.6/asynchat.pyRFscCs|ii|ƒdS(N(RRR(RR((s/usr/lib/python2.6/asynchat.pyR5scCs&|iod|iiƒfSdSdS(Nii(iN(RRtpopleftR;(R((s/usr/lib/python2.6/asynchat.pytpop!s
N(	RKRLR;RRSRTRFR5RV(((s/usr/lib/python2.6/asynchat.pyRQs				cCsBt|ƒd}x+|o#|i|| ƒo|d8}qW|S(Ni(R!tendswith(thaystacktneedletl((s/usr/lib/python2.6/asynchat.pyR&6s
(((RMRR	tcollectionsRtsysRtwarningsRRR
RRNRQR&(((s/usr/lib/python2.6/asynchat.pyt<module>/sÇ(

ACC SHELL 2018