PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  4h^c@sndZddlZddlmZdejfdYZdd dYZdd d YZd Z dS( sA 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. iN(t asyncore_25t async_chatcBseZdZdZdZddZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZRS(sThis is an abstract class. You must derive from this class, and add the two methods collect_incoming_data() and found_terminator()icCs5d|_d|_t|_tjj||dS(Nt(t ac_in_buffert ac_out_buffertfifot producer_fifotasyncoret dispatchert__init__(tselftconn((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR =s   cCstddS(Nsmust be implemented in subclass(tNotImplementedError(R tdata((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytcollect_incoming_dataCscCstddS(Nsmust be implemented in subclass(R (R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytfound_terminatorFscCs ||_dS(sRSet the input delimiter. Can be a fixed string of any length, an integer, or NoneN(t terminator(R tterm((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytset_terminatorIscCs|jS(N(R(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytget_terminatorMscCsy|j|j}Wntjk r7|jdSX|j||_x|jrt|j}|j}|s|j|jd|_qKt |t st |t r'|}||kr|j|jd|_|j ||_ q|j|j| |j||_d|_ |j qKt|}|jj|}|dkr|dkrt|j|j| n|j|||_|j qKt|j|}|r||kr|j|j| |j| |_nPqK|j|jd|_qKWdS(NRii(trecvtac_in_buffer_sizetsocketterrort handle_errorRtlenRRt isinstancetinttlongRRtfindtfind_prefix_at_end(R R tlbRtntterminator_lentindex((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt handle_readUsJ            cCs|jdS(N(t initiate_send(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt handle_writescCs|jdS(N(tclose(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt handle_closescCs$|jjt||jdS(N(Rtpushtsimple_producerR$(R R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR(scCs|jj||jdS(N(RR(R$(R tproducer((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytpush_with_producerscCst|j|jkS(s4predicate for inclusion in the readable for select()(RRR(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytreadablescCs&|jdko$|jjo$|j S(s4predicate for inclusion in the writable for select()R(RRtis_emptyt connected(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytwritablescCs|jjddS(sAautomatically close this channel once the outgoing queue is emptyN(RR(tNone(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytclose_when_donescCsxt|jr|jj}|dkrT|jsP|jj|jndSt|tr|jj|j||_dS|j }|r|j||_dS|jjqdSqdS(N( RRtfirstR0RtpopR&Rtstrtmore(R tpR ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt refill_buffers$      cCs|j}t|j|kr+|jn|jr|jry3|j|j| }|ro|j||_nWqtjk r|jdSXndS(N( tac_out_buffer_sizeRRR7R.tsendRRR(R tobstnum_sent((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR$s   cCs3d|_d|_x|jr.|jjqWdS(NR(RRRR3(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pytdiscard_bufferss   N(t__name__t __module__t__doc__RR8R0R RRRRR#R%R'R(R+R,R/R1R7R$R<(((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR4s&      B        R)cBseZddZdZRS(icCs||_||_dS(N(R t buffer_size(R R R@((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR s cCsYt|j|jkr?|j|j }|j|j|_|S|j}d|_|SdS(NR(RR R@(R tresult((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR5s  (R=R>R R5(((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR)s RcBsAeZddZdZdZdZdZdZRS(cCs|sg|_n ||_dS(N(tlist(R RB((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR s cCs t|jS(N(RRB(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt__len__scCs |jgkS(N(RB(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR-scCs |jdS(Ni(RB(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR2scCs|jj|dS(N(RBtappend(R R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR( scCs'|jrd|jjdfSdSdS(Nii(iN(RBR3R0(R ((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR3 s N( R=R>R0R RCR-R2R(R3(((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyRs      cCs?t|d}x(|r:|j||  r:|d8}qW|S(Ni(Rtendswith(thaystacktneedletl((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyR"s((( R?Rtsupervisor.medusaRRRRR)RR(((sA/usr/lib/python2.7/site-packages/supervisor/medusa/asynchat_25.pyt/s  (