Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 \@,ã@sDdZddlZddlmZGdd„dejƒZGdd„dƒZdd „ZdS) a¥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)Údequec@sªeZdZdZdZdZdZdZd(dd„Zdd „Z d d „Z d d „Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„ZdS))Ú async_chatz‡This is an abstract class. You must derive from this class, and add the two methods collect_incoming_data() and found_terminator()irzlatin-1NcCs(d|_g|_tƒ|_tjj|||ƒdS)Nó)Ú ac_in_bufferÚincomingrÚ producer_fifoÚasyncoreÚ dispatcherÚ__init__)ÚselfZsockÚmap©r ú /usr/lib64/python3.6/asynchat.pyr Cszasync_chat.__init__cCs tdƒ‚dS)Nzmust be implemented in subclass)ÚNotImplementedError)r Údatar r rÚcollect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|ƒdS)N)rÚappend)r rr r rÚ_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsdj|jƒ}|jdd…=|S)Nr)Újoinr)r Údr r rÚ _get_dataWs  zasync_chat._get_datacCs tdƒ‚dS)Nzmust be implemented in subclass)r)r r r rÚfound_terminator\szasync_chat.found_terminatorcCsBt|tƒr|jrt||jƒ}nt|tƒr8|dkr8tdƒ‚||_dS)zdSet the input delimiter. Can be a fixed string of any length, an integer, or None. rz-the number of received bytes must be positiveN)Ú isinstanceÚstrÚ use_encodingÚbytesÚencodingÚintÚ ValueErrorÚ terminator)r Ztermr r rÚset_terminator_s zasync_chat.set_terminatorcCs|jS)N)r)r r r rÚget_terminatorjszasync_chat.get_terminatorcCsÒy|j|jƒ}Wn:tk r$dStk rJ}z |jƒdSd}~XnXt|tƒrh|jrhtt|j ƒ}|j ||_ �xV|j �rÌt |j ƒ}|j ƒ}|sª|j |j ƒd|_ qxt|tƒ�r|}||krâ|j |j ƒd|_ |j||_n2|j |j d|…ƒ|j |d…|_ d|_|jƒqxt |ƒ}|j j|ƒ}|dk�rp|dk�rR|j |j d|…ƒ|j ||d…|_ |jƒqxt|j |ƒ}|�r¸||k�r´|j |j d| …ƒ|j | d…|_ Pqx|j |j ƒd|_ qxWdS)Nrrééÿÿÿÿ)ZrecvÚac_in_buffer_sizeÚBlockingIOErrorÚOSErrorÚ handle_errorrrrrrrÚlenr!rrrrÚfindÚfind_prefix_at_end)r rZwhyZlbrÚnZterminator_lenÚindexr r rÚ handle_readrsR               zasync_chat.handle_readcCs |jƒdS)N)Ú initiate_send)r r r rÚ handle_writeºszasync_chat.handle_writecCs |jƒdS)N)Úclose)r r r rÚ handle_close½szasync_chat.handle_closecCs|t|tttfƒstdt|ƒƒ‚|j}t|ƒ|krdx>tdt|ƒ|ƒD]}|j j ||||…ƒqBWn |j j |ƒ|j ƒdS)Nz#data argument must be byte-ish (%r)r) rrÚ bytearrayÚ memoryviewÚ TypeErrorÚtypeÚac_out_buffer_sizer(Úrangerrr.)r rZsabsÚir r rÚpushÀs   zasync_chat.pushcCs|jj|ƒ|jƒdS)N)rrr.)r Zproducerr r rÚpush_with_producerÌs zasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()r"r )r r r rÚreadableÐszasync_chat.readablecCs|jp |j S)z4predicate for inclusion in the writable for select())rÚ connected)r r r rÚwritableØszasync_chat.writablecCs|jjdƒdS)zAautomatically close this channel once the outgoing queue is emptyN)rr)r r r rÚclose_when_doneÜszasync_chat.close_when_donecCs�x|jo|j�r|jd}|s<|jd=|dkr<|jƒdS|j}y|d|…}Wn8tk rŠ|jƒ}|r||jj|ƒn|jd=wYnXt|tƒr¨|j r¨t ||j ƒ}y|j |ƒ}Wnt k rÒ|jƒdSX|�r|t|ƒksô|t|ƒk�r||d…|jd<n|jd=dSWdS)Nr)rr<r1r6r4ÚmoreÚ appendleftrrrrrÚsendr&r'r()r ÚfirstZobsrZnum_sentr r rr.às8  zasync_chat.initiate_sendcCs d|_|jdd…=|jjƒdS)Nr)rrrÚclear)r r r rÚdiscard_bufferss zasync_chat.discard_buffers)NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r$r6rrr rrrrr r!r-r/r1r9r:r;r=r>r.rDr r r rr4s,  H (rc@seZdZddd„Zdd„ZdS)Úsimple_producerécCs||_||_dS)N)rÚ buffer_size)r rrKr r rr szsimple_producer.__init__cCsJt|jƒ|jkr6|jd|j…}|j|jd…|_|S|j}d|_|SdS)Nr)r(rrK)r Úresultr r rr?szsimple_producer.moreN)rJ)rErFrGr r?r r r rrIs rIcCs6t|ƒd}x$|r0|j|d|…ƒ r0|d8}qW|S)Nr")r(Úendswith)ZhaystackZneedleÚlr r rr*/s  r*)rHrÚ collectionsrr rrIr*r r r rÚ/s  \