uawdijnntqw1x1x1
IP : 18.221.221.171
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
.
/
..
/
lib64
/
nss
/
..
/
lua
/
..
/
bpf
/
..
/
python3.8
/
__pycache__
/
asynchat.cpython-38.pyc
/
/
U e5d@,�@sDdZddlZddlmZGdd�dej�ZGdd�d�Zdd �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@s�eZdZdZdZdZdZdZd(dd�Zdd �Z d d�Z dd �Zdd�Zdd�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-1NcCs(d|_g|_t�|_tj�|||�dS�N�)�ac_in_buffer�incomingr� producer_fifo�asyncore� dispatcher�__init__)�selfZsock�map�r� /usr/lib64/python3.8/asynchat.pyrCszasync_chat.__init__cCstd��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_dataWszasync_chat._get_datacCstd��dSrr�rrrr�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_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)rZtermrrr�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)rrZwhyZlbr%�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)rrZsabs�irrr�push�s�zasync_chat.pushcCs|j�|�|��dSr)rrr3)rZproducerrrr�push_with_producer�szasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()�rrrrr�readable�szasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())r� connectedrrrr�writable�szasync_chat.writablecCs|j�d�dS)zAautomatically close this channel once the outgoing queue is emptyN)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)rrBr6r;r9�more� appendleftrrr r!r"�sendr+r,r-)r�firstZobsrZnum_sentrrrr3�s8 zasync_chat.initiate_sendcCs d|_|jdd�=|j��dSr)rrr�clearrrrr�discard_buffersszasync_chat.discard_buffers)NN)�__name__� __module__�__qualname__�__doc__r)r;r r"rrrrrr&r'r2r4r6r>r?rArCrDr3rJrrrrr4s, H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dSr)r�buffer_size)rrrQrrrrszsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdSr)r-rrQ)r�resultrrrrEszsimple_producer.moreN)rP)rKrLrMrrErrrrrOs rOcCs0t|�d}|r,|�|d|��s,|d8}q|S)Nr@)r-�endswith)ZhaystackZneedle�lrrrr//s r/)rNr �collectionsrr rrOr/rrrr�<module>s\
/home/./../lib64/nss/../lua/../bpf/../python3.8/__pycache__/asynchat.cpython-38.pyc