AlkantarClanX12

Your IP : 3.133.109.251


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/asynchat.cpython-37.opt-2.pyc

B

YI~d@,�@s@ddlZddlmZGdd�dej�ZGdd�d�Zdd�ZdS)	�N)�dequec@s�eZdZdZdZdZdZd'dd�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-1NcCs(d|_g|_t�|_tj�|||�dS)N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�selfZsock�map�r
�-/opt/alt/python37/lib64/python3.7/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|j�|�dS)N)r�append)rrr
r
r�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsd�|j�}|jdd�=|S)Nr)�joinr)r�dr
r
r�	_get_dataWszasync_chat._get_datacCstd��dS)Nzmust be implemented in subclass)r)rr
r
r�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_dS)Nrz-the number of received bytes must be positive)�
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_terminatorc
Cs�y|�|j�}Wn<tk
r$dStk
rL}z|��dSd}~XYnXt|t�rj|jrjtt|j	�}|j
||_
�xV|j
�r�t|j
�}|��}|s�|�
|j
�d|_
qzt|t��r|}||kr�|�
|j
�d|_
|j||_n2|�
|j
d|��|j
|d�|_
d|_|��qzt|�}|j
�|�}|dk�rr|dk�rT|�
|j
d|��|j
||d�|_
|��qzt|j
|�}|�r�||k�r�|�
|j
d|��|j
|d�|_
Pqz|�
|j
�d|_
qzWdS)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|��dS)N)�
initiate_send)rr
r
r�handle_write�szasync_chat.handle_writecCs|��dS)N)�close)rr
r
r�handle_close�szasync_chat.handle_closecCs|t|tttf�stdt|���|j}t|�|krdx>tdt|�|�D]}|j	�
||||��qBWn|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|j�|�|��dS)N)rrr-)rZproducerr
r
r�push_with_producer�szasync_chat.push_with_producercCsdS)N�r
)rr
r
r�readable�szasync_chat.readablecCs|jp|jS)N)r�	connected)rr
r
r�writable�szasync_chat.writablecCs|j�d�dS)N)rr)rr
r
r�close_when_done�szasync_chat.close_when_donecCs�x|j�r|j�r|jd}|s>|jd=|dkr>|��dS|j}y|d|�}Wn8tk
r�|��}|r~|j�|�n|jd=wYnXt|t�r�|j	r�t
||j�}y|�|�}Wnt
k
r�|��dSX|�r|t|�ks�|t|�k�r
||d�|jd<n|jd=dSWdS)Nr)rr<r0r5r3�more�
appendleftrrrrr�sendr%r&r')r�firstZobsrZnum_sentr
r
rr-�s8
zasync_chat.initiate_sendcCs d|_|jdd�=|j��dS)Nr)rrr�clear)rr
r
r�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__r#r5rrr
rrrrr r!r,r.r0r8r9r;r=r>r-rDr
r
r
rr4s*
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dS)N)r�buffer_size)rrrJr
r
rr
szsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdS)Nr)r'rrJ)r�resultr
r
rr?szsimple_producer.moreN)rI)rErFrGr
r?r
r
r
rrHs
rHcCs4t|�d}x"|r.|�|d|��s.|d8}qW|S)Nr:)r'�endswith)ZhaystackZneedle�lr
r
rr)/sr))r�collectionsrr	rrHr)r
r
r
r�<module>0s
\