选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´i9,ã@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ƒ|_tj |||¡dS©Nó)Ú ac_in_bufferÚincomingrÚ producer_fifoÚasyncoreÚ dispatcherÚ__init__)ÚselfÚsockÚmap©rú /usr/lib64/python3.9/asynchat.pyr Cszasync_chat.__init__cCs tdƒ‚dS©Nzmust be implemented in subclass©ÚNotImplementedError©r ÚdatarrrÚcollect_incoming_dataQsz async_chat.collect_incoming_datacCs|j |¡dS©N)rÚappendrrrrÚ_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsd |j¡}|jdd…=|Sr)Újoinr)r ÚdrrrÚ _get_dataWs  zasync_chat._get_datacCs tdƒ‚dSrr©r rrrÚ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 ZtermrrrÚset_terminator_s zasync_chat.set_terminatorcCs|jSr)r&rrrrÚget_terminatorjszasync_chat.get_terminatorcCsÂz| |j¡}Wn.ty$YdSty>| ¡YdS0t|tƒr\|jr\tt|j ƒ}|j ||_ |j �r¾t |j ƒ}|  ¡}|sš|  |j ¡d|_ qht|tƒ�r|}||krÒ|  |j ¡d|_ |j||_n2|  |j d|…¡|j |d…|_ d|_| ¡qht |ƒ}|j  |¡}|dk�r`|dk�rB|  |j d|…¡|j ||d…|_ | ¡qht|j |ƒ}|�rª||k�r¾|  |j d| …¡|j | d…|_ �q¾qh|  |j ¡d|_ qhdS)Nrréÿÿÿÿ)ÚrecvÚac_in_buffer_sizeÚBlockingIOErrorÚOSErrorÚ handle_errorrr r!r"r#rÚlenr(rr$r&rÚfindÚfind_prefix_at_end)r rZlbr&ÚnZterminator_lenÚindexrrrÚ handle_readrsR                zasync_chat.handle_readcCs | ¡dSr)Ú initiate_sendrrrrÚ handle_writeºszasync_chat.handle_writecCs | ¡dSr)ÚcloserrrrÚ handle_close½szasync_chat.handle_closecCsxt|tttfƒstdt|ƒƒ‚|j}t|ƒ|kr`tdt|ƒ|ƒD]}|j   ||||…¡q@n |j   |¡|  ¡dS)Nz#data argument must be byte-ish (%r)r) rr"Ú bytearrayÚ memoryviewÚ TypeErrorÚtypeÚac_out_buffer_sizer/Úrangerrr5)r rZsabsÚirrrÚpushÀsÿ  zasync_chat.pushcCs|j |¡| ¡dSr)rrr5)r ZproducerrrrÚpush_with_producerÌs zasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()érrrrrÚreadableÐszasync_chat.readablecCs|jp |j S)z4predicate for inclusion in the writable for select())rÚ connectedrrrrÚwritableØszasync_chat.writablecCs|j d¡dS)zAautomatically close this channel once the outgoing queue is emptyN)rrrrrrÚclose_when_doneÜszasync_chat.close_when_donecCs|j�r|j�r|jd}|s:|jd=|dur:| ¡dS|j}z|d|…}Wn8tyˆ| ¡}|rx|j |¡n|jd=YqYn0t|tƒr¦|j r¦t ||j ƒ}z|  |¡}Wnt yÐ| ¡YdS0|�r|t|ƒksò|t|ƒk�r||d…|jd<n|jd=dSdS)Nr)rrDr8r=r;ÚmoreÚ appendleftrr r!r"r#Úsendr-r.r/)r ÚfirstZobsrZnum_sentrrrr5às8     zasync_chat.initiate_sendcCs d|_|jdd…=|j ¡dSr)rrrÚclearrrrrÚdiscard_bufferss zasync_chat.discard_buffers)NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r+r=r!r#r rrrrr'r(r4r6r8r@rArCrErFr5rLrrrrr4s,  H (rc@seZdZddd„Zdd„ZdS)Úsimple_producerécCs||_||_dSr)rÚ buffer_size)r rrSrrrr szsimple_producer.__init__cCsJt|jƒ|jkr6|jd|j…}|j|jd…|_|S|j}d|_|SdSr)r/rrS)r ÚresultrrrrGszsimple_producer.moreN)rR)rMrNrOr rGrrrrrQs rQcCs0t|ƒd}|r,| |d|…¡s,|d8}q |S)NrB)r/Úendswith)ZhaystackZneedleÚlrrrr1/s  r1)rPr Ú collectionsrr rrQr1rrrrÚs  \