HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.7/__pycache__/asynchat.cpython-37.pyc
B

{a@,@sDdZddlZddlmZGdddejZGdddZdd	ZdS)
aA 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@seZdZdZdZdZdZdZd(ddZdd	Z	d
dZ
dd
ZddZddZ
ddZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'ZdS))
async_chatzThis 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_bufferincomingr
producer_fifoasyncore
dispatcher__init__)selfZsockmapr
/usr/lib/python3.7/asynchat.pyr
Cszasync_chat.__init__cCstddS)Nzmust be implemented in subclass)NotImplementedError)rdatar
r
rcollect_incoming_dataQsz async_chat.collect_incoming_datacCs|j|dS)N)rappend)rrr
r
r_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsd|j}|jdd=|S)Nr)joinr)rdr
r
r	_get_dataWszasync_chat._get_datacCstddS)Nzmust be implemented in subclass)r)rr
r
rfound_terminator\szasync_chat.found_terminatorcCsBt|tr|jrt||j}nt|tr8|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)
isinstancestruse_encodingbytesencodingint
ValueError
terminator)rZtermr
r
rset_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r)rr
r
rget_terminatorjszasync_chat.get_terminatorc
Csy||j}Wn<tk
r$dStk
rL}z|dSd}~XYnXt|trj|jrjtt|j	}|j
||_
xV|j
rt|j
}|}|s|
|j
d|_
qzt|tr|}||kr|
|j
d|_
|j||_n2|
|j
d||j
|d|_
d|_|qzt|}|j
|}|dkrr|dkrT|
|j
d||j
||d|_
|qzt|j
|}|r||kr|
|j
d||j
|d|_
Pqz|
|j
d|_
qzWdS)Nrr)Zrecvac_in_buffer_sizeBlockingIOErrorOSErrorhandle_errorrrrrrrlenr!rrrrfindfind_prefix_at_end)rrZwhyZlbrnZterminator_lenindexr
r
rhandle_readrsR

	



zasync_chat.handle_readcCs|dS)N)
initiate_send)rr
r
rhandle_writeszasync_chat.handle_writecCs|dS)N)close)rr
r
rhandle_closeszasync_chat.handle_closecCs|t|tttfstdt||j}t||krdx>tdt||D]}|j	
||||qBWn|j	
||dS)Nz#data argument must be byte-ish (%r)r)rr	bytearray
memoryview	TypeErrortypeac_out_buffer_sizer'rangerrr-)rrZsabsir
r
rpushs
zasync_chat.pushcCs|j||dS)N)rrr-)rZproducerr
r
rpush_with_producerszasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()r
)rr
r
rreadableszasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())r	connected)rr
r
rwritableszasync_chat.writablecCs|jddS)zAautomatically close this channel once the outgoing queue is emptyN)rr)rr
r
rclose_when_doneszasync_chat.close_when_donecCsx|jr|jr|jd}|s>|jd=|dkr>|dS|j}y|d|}Wn8tk
r|}|r~|j|n|jd=wYnXt|tr|j	rt
||j}y||}Wnt
k
r|dSX|r|t|ks|t|kr
||d|jd<n|jd=dSWdS)Nr)rr<r0r5r3more
appendleftrrrrrsendr%r&r')rfirstZobsrZnum_sentr
r
rr-s8
zasync_chat.initiate_sendcCs d|_|jdd=|jdS)Nr)rrrclear)rr
r
rdiscard_buffersszasync_chat.discard_buffers)NN)__name__
__module____qualname____doc__r#r5rrr
rrrrr r!r,r.r0r8r9r;r=r>r-rDr
r
r
rr4s,
H(rc@seZdZdddZddZdS)simple_producercCs||_||_dS)N)rbuffer_size)rrrKr
r
rr
szsimple_producer.__init__cCsJt|j|jkr6|jd|j}|j|jd|_|S|j}d|_|SdS)Nr)r'rrK)rresultr
r
rr?szsimple_producer.moreN)rJ)rErFrGr
r?r
r
r
rrIs
rIcCs4t|d}x"|r.||d|s.|d8}qW|S)Nr:)r'endswith)ZhaystackZneedlelr
r
rr)/sr))rHrcollectionsrr	rrIr)r
r
r
r<module>/s\