AlkantarClanX12

Your IP : 3.145.56.150


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/asynchat.cpython-310.opt-2.pyc

o

6��f-�@s\	ddlZddlmZddlmZededd�Gdd�dej�ZGd	d
�d
�Zdd�Z	dS)
�N)�deque)�warnzlThe asynchat module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio�)�
stacklevelc@s�eZdZ	dZdZdZdZd'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/python310/lib64/python3.10/asynchat.pyrKszasync_chat.__init__cC�td���Nzmust be implemented in subclass��NotImplementedError�r�datarrr�collect_incoming_dataY�z async_chat.collect_incoming_datacCs|j�|�dS�N)r
�appendrrrr�_collect_incoming_data\sz!async_chat._collect_incoming_datacCsd�|j�}|jdd�=|Sr)�joinr
)r�drrr�	_get_data_szasync_chat._get_datacCrrr�rrrr�found_terminatordrzasync_chat.found_terminatorcCsD	t|t�r|jrt||j�}n
t|t�r|dkrtd��||_dS)Nrz-the number of received bytes must be positive)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermrrr�set_terminatorgs
zasync_chat.set_terminatorcCs|jSr)r*r!rrr�get_terminatorrszasync_chat.get_terminatorcCs�z|�|j�}WntyYdSty|��YdSwt|t�r.|jr.tt|j	�}|j
||_
|j
r�t|j
�}|��}|sL|�
|j
�d|_
n�t|t�r�|}||krg|�
|j
�d|_
|j||_np|�
|j
d|��|j
|d�|_
d|_|��nVt|�}|j
�|�}|dkr�|dkr�|�
|j
d|��|j
||d�|_
|��n+t|j
|�}|r�||kr�|�
|j
d|��|j
|d�|_
dS|�
|j
�d|_
|j
s7dSdS)Nrr���)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorr#r$r%r&r'r	�lenr,rr(r*r"�find�find_prefix_at_end)rrZlbr*�nZterminator_len�indexrrr�handle_readzsV�


	
�zasync_chat.handle_readcC�|��dSr)�
initiate_sendr!rrr�handle_write��zasync_chat.handle_writecCr8r)�closer!rrr�handle_close�r;zasync_chat.handle_closecCsxt|tttf�stdt|���|j}t|�|kr0tdt|�|�D]}|j	�
||||��q n|j	�
|�|��dS)Nz#data argument must be byte-ish (%r)r)r#r&�	bytearray�
memoryview�	TypeError�type�ac_out_buffer_sizer2�rangerrr9)rrZsabs�irrr�push�s��zasync_chat.pushcCs|j�|�|��dSr)rrr9)rZproducerrrr�push_with_producer�szasync_chat.push_with_producercCs	dS�N�rr!rrr�readable�szasync_chat.readablecCs	|jp|jSr)r�	connectedr!rrr�writable�szasync_chat.writablecCs	|j�d�dSr)rrr!rrr�close_when_done�szasync_chat.close_when_donecCs|jr�|jr�|jd}|s|jd=|dur|��dS|j}z|d|�}Wnty@|��}|r:|j�|�n|jd=Yqwt|t�rO|j	rOt
||j�}z|�|�}Wnt
yd|��YdSw|r�|t|�kss|t|�kr~||d�|jd<dS|jd=dSdSdS)Nr)rrJr=rBr@�more�
appendleftr#r$r%r&r'�sendr0r1r2)r�firstZobsrZnum_sentrrrr9�s@
����zasync_chat.initiate_sendcCs d|_|jdd�=|j��dSr)r	r
r�clearr!rrr�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__r.rBr%r'rrrr r"r+r,r7r:r=rErFrIrKrLr9rRrrrrr<s.
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dSr)r�buffer_size)rrrXrrrrs
zsimple_producer.__init__cCsFt|j�|jkr|jd|j�}|j|jd�|_|S|j}d|_|Sr)r2rrX)r�resultrrrrMszsimple_producer.moreN)rW)rSrTrUrrMrrrrrVs
rVcCsDt|�d}|r |�|d|��s |d8}|r |�|d|��r|SrG)r2�endswith)ZhaystackZneedle�lrrrr47s
�r4)
r�collectionsr�warningsr�DeprecationWarningr
rrVr4rrrr�<module>s�\