AlkantarClanX12

Your IP : 3.15.228.162


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/asynchat.cpython-35.opt-2.pyc



���]�.�@skddlZddlmZGdd�dej�ZGdd�d�ZGdd�d�Zd	d
�ZdS)�N)�dequec@s�eZdZdZdZdZdZdddd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdS)'�
async_chatirzlatin-1NcCs8d|_g|_t�|_tjj|||�dS)N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�self�sock�map�r�-/opt/alt/python35/lib64/python3.5/asynchat.pyr
Cs		zasync_chat.__init__cCstd��dS)Nzmust be implemented in subclass)�NotImplementedError)r�datarrr�collect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|�dS)N)r�append)rrrrr�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCs&dj|j�}|jdd�=|S)Nr)�joinr)r�drrr�	_get_dataWszasync_chat._get_datacCstd��dS)Nzmust be implemented in subclass)r)rrrr�found_terminator\szasync_chat.found_terminatorcCsat|t�r-|jr-t||j�}n't|t�rT|dkrTtd��||_dS)Nrz-the number of received bytes must be positive)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermrrr�set_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r )rrrr�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����)�recv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrrrrr�lenr"rrr r�find�find_prefix_at_end)rr�whyZlbr �nZterminator_len�indexrrr�handle_readrsR

		
	
zasync_chat.handle_readcCs|j�dS)N)�
initiate_send)rrrr�handle_write�szasync_chat.handle_writecCs|j�dS)N)�close)rrrr�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*�rangerrr1)rrZsabs�irrr�push�s	%zasync_chat.pushcCs|jj|�|j�dS)N)rrr1)rZproducerrrr�push_with_producer�szasync_chat.push_with_producercCsdS)Nr#r)rrrr�readable�szasync_chat.readablecCs|jp|jS)N)r�	connected)rrrr�writable�szasync_chat.writablecCs|jjd�dS)N)rr)rrrr�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?r4r9r7�more�
appendleftrrrrr�sendr(r)r*)r�firstZobsrZnum_sentrrrr1�s8


	



	$
zasync_chat.initiate_sendcCs*d|_|jdd�=|jj�dS)Nr)rrr�clear)rrrr�discard_bufferss	zasync_chat.discard_buffers)�__name__�
__module__�__qualname__r&r9rrr
rrrrr!r"r0r2r4r<r=r>r@rAr1rGrrrrr4s*H(rc@s+eZdZddd�Zdd�ZdS)�simple_producericCs||_||_dS)N)r�buffer_size)rrrLrrrr
s	zsimple_producer.__init__cCset|j�|jkrK|jd|j�}|j|jd�|_|S|j}d|_|SdS)Nr)r*rrL)r�resultrrrrBs		zsimple_producer.moreN)rHrIrJr
rBrrrrrKsrKc@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)rrTrQrrrr
!s	
z
fifo.__init__cCs
t|j�S)N)r*rT)rrrr�__len__*szfifo.__len__cCs|jS)N)rT)rrrr�is_empty-sz
fifo.is_emptycCs|jdS)Nr)rT)rrrrrE0sz
fifo.firstcCs|jj|�dS)N)rTr)rrrrrr<3sz	fifo.pushcCs$|jrd|jj�fSdSdS)Nr#r)rN)rT�popleft)rrrr�pop6s	zfifo.pop)	rHrIrJr
rUrVrEr<rXrrrrrN s	rNcCsEt|�d}x.|r@|j|d|��r@|d8}qW|S)Nr#)r*�endswith)ZhaystackZneedle�lrrrr,Ls#r,)r�collectionsrr	rrKrNr,rrrr�<module>0s
�,