AlkantarClanX12

Your IP : 3.145.47.193


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/asynchat.cpython-38.opt-2.pyc

U

i�f@,�@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/python38/lib64/python3.8/asynchat.pyrCszasync_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)Nrz-the number of received bytes must be positive)�
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_terminatorc
Cs�z|�|j�}WnDtk
r&YdStk
rT}z|��WY�dSd}~XYnXt|t�rr|jrrtt|j	�}|j
||_
|j
�r�t|j
�}|��}|s�|�
|j
�d|_
q~t|t��r|}||kr�|�
|j
�d|_
|j||_n2|�
|j
d|��|j
|d�|_
d|_|��q~t|�}|j
�|�}|dk�rv|dk�rX|�
|j
d|��|j
||d�|_
|��q~t|j
|�}|�r�||k�r�|�
|j
d|��|j
|d�|_
�q�q~|�
|j
�d|_
q~dS)Nrr���)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrr r!r"r�lenr'rr#r%r�find�find_prefix_at_end)rrZwhyZlbr%�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-�rangerrr3)rrZsabs�irrr�push�s�zasync_chat.pushcCs|j�|�|��dSr)rrr3)rZproducerrrr�push_with_producer�szasync_chat.push_with_producercCsdS�N�rrrrr�readable�szasync_chat.readablecCs|jp|jSr)r�	connectedrrrr�writable�szasync_chat.writablecCs|j�d�dSr)rrrrrr�close_when_done�szasync_chat.close_when_donecCs|j�r|j�r|jd}|s:|jd=|dkr:|��dS|j}z|d|�}Wn:tk
r�|��}|rz|j�|�n|jd=YqYnXt|t�r�|j	r�t
||j�}z|�|�}Wnt
k
r�|��YdSX|�r|t|�ks�|t|�k�r
||d�|jd<n|jd=dSdS)Nr)rrCr6r;r9�more�
appendleftrrr r!r"�sendr+r,r-)r�firstZobsrZnum_sentrrrr3�s8

zasync_chat.initiate_sendcCs d|_|jdd�=|j��dSr)rrr�clearrrrr�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__r)r;r r"rrrrrr&r'r2r4r6r>r?rBrDrEr3rKrrrrr4s*
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dSr)r�buffer_size)rrrQrrrrszsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdSr)r-rrQ)r�resultrrrrFszsimple_producer.moreN)rP)rLrMrNrrFrrrrrOs
rOcCs0t|�d}|r,|�|d|��s,|d8}q|Sr@)r-�endswith)ZhaystackZneedle�lrrrr//s
r/)r	�collectionsrr
rrOr/rrrr�<module>0s
\