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.5/__pycache__/asynchat.cpython-35.pyc


FüƒaÃ.ã@sqdZddlZddlmZGdd„dejƒZGdd„dƒZGdd	„d	ƒZd
d„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@seZdZdZdZdZdZdZdddd„Zdd	„Z	d
d„Z
dd
„Zdd„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-1NcCs8d|_g|_tƒ|_tjj|||ƒdS)Nó)Úac_in_bufferÚincomingrÚ
producer_fifoÚasyncoreÚ
dispatcherÚ__init__)ÚselfZsockÚmap©r
ú/usr/lib/python3.5/asynchat.pyr
Cs		zasync_chat.__init__cCstdƒ‚dS)Nzmust be implemented in subclass)ÚNotImplementedError)rÚdatar
r
rÚcollect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|ƒdS)N)rÚappend)rrr
r
rÚ_collect_incoming_dataTsz!async_chat._collect_incoming_datacCs&dj|jƒ}|jdd…=|S)Nr)Újoinr)rÚdr
r
rÚ	_get_dataWszasync_chat._get_datacCstdƒ‚dS)Nzmust be implemented in subclass)r)rr
r
rÚfound_terminator\szasync_chat.found_terminatorcCsat|tƒr-|jr-t||jƒ}n't|tƒrT|dkrTtdƒ‚||_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)rZtermr
r
rÚset_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r)rr
r
rÚget_terminatorjszasync_chat.get_terminatorcCsiy|j|jƒ}WnHtk
r.dSYn3tk
r`}z|jƒdSWYdd}~XnXt|tƒr‹|jr‹tt|j	ƒ}|j
||_
xÇ|j
rdt|j
ƒ}|jƒ}|sä|j
|j
ƒd|_
qžt|tƒrw|}||kr1|j
|j
ƒd|_
|j||_qa|j
|j
d|…ƒ|j
|d…|_
d|_|jƒqžt|ƒ}|j
j|ƒ}|dkrî|dkrÇ|j
|j
d|…ƒ|j
||d…|_
|jƒqžt|j
|ƒ}|rH||krD|j
|j
d|…ƒ|j
|d…|_
Pqž|j
|j
ƒd|_
qžWdS)Nrrééÿÿÿÿ)ZrecvÚac_in_buffer_sizeÚBlockingIOErrorÚOSErrorÚhandle_errorrrrrrrÚlenr!rrrrÚfindÚfind_prefix_at_end)rrZwhyZlbrÚnZterminator_lenÚindexr
r
rÚhandle_readrsR

		
	
zasync_chat.handle_readcCs|jƒdS)N)Ú
initiate_send)rr
r
rÚhandle_writeºszasync_chat.handle_writecCs|jƒdS)N)Úclose)rr
r
rÚhandle_close½szasync_chat.handle_closecCsªt|tttfƒs-tdt|ƒƒ‚|j}t|ƒ|krŒxQtdt|ƒ|ƒD]$}|j	j
||||…ƒqaWn|j	j
|ƒ|jƒdS)Nz#data argument must be byte-ish (%r)r)rrÚ	bytearrayÚ
memoryviewÚ	TypeErrorÚtypeÚac_out_buffer_sizer(Úrangerrr.)rrZsabsÚir
r
rÚpushÀs	%zasync_chat.pushcCs|jj|ƒ|jƒdS)N)rrr.)rZproducerr
r
rÚpush_with_producerÌszasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()r"r
)rr
r
rÚreadableÐszasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())rÚ	connected)rr
r
rÚwritableØszasync_chat.writablecCs|jjdƒdS)zAautomatically close this channel once the outgoing queue is emptyN)rr)rr
r
rÚclose_when_doneÜszasync_chat.close_when_donecCsgx`|jrb|jrb|jd}|sL|jd=|dkrL|jƒdS|j}y|d|…}WnDtk
r¯|jƒ}|rž|jj|ƒn
|jd=wYnXt|tƒrÚ|j	rÚt
||jƒ}y|j|ƒ}Wn t
k
r|jƒdSYnX|r^|t|ƒks:|t|ƒkrT||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)rr
r
rÚdiscard_bufferss	zasync_chat.discard_buffers)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$r6rrr
rrrrr r!r-r/r1r9r:r;r=r>r.rDr
r
r
rr4s,H(rc@s+eZdZddd„Zdd„ZdS)Úsimple_producericCs||_||_dS)N)rÚbuffer_size)rrrJr
r
rr
s	zsimple_producer.__init__cCset|jƒ|jkrK|jd|j…}|j|jd…|_|S|j}d|_|SdS)Nr)r(rrJ)rÚresultr
r
rr?s		zsimple_producer.moreN)rErFrGr
r?r
r
r
rrIsrIc@s[eZdZddd„Zdd„Zdd„Zdd	„Zd
d„Zdd
„ZdS)ÚfifoNcCsJddl}|jdtddƒ|s7tƒ|_nt|ƒ|_dS)Nrz(fifo class will be removed in Python 3.6Ú
stacklevelé)ÚwarningsÚwarnÚDeprecationWarningrÚlist)rrRrOr
r
rr
!s	
z
fifo.__init__cCs
t|jƒS)N)r(rR)rr
r
rÚ__len__*szfifo.__len__cCs|jS)N)rR)rr
r
rÚis_empty-sz
fifo.is_emptycCs|jdS)Nr)rR)rr
r
rrB0sz
fifo.firstcCs|jj|ƒdS)N)rRr)rrr
r
rr93sz	fifo.pushcCs$|jrd|jjƒfSdSdS)Nr"r)rN)rRÚpopleft)rr
r
rÚpop6s	zfifo.pop)	rErFrGr
rSrTrBr9rVr
r
r
rrL s	rLcCsEt|ƒd}x.|r@|j|d|…ƒr@|d8}qW|S)Nr")r(Úendswith)ZhaystackZneedleÚlr
r
rr*Ls#r*)	rHrÚcollectionsrr	rrIrLr*r
r
r
rÚ<module>/sÛ,