Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.116.163.144
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : asynchat.cpython-32.pyo
l
��bc@s�dZddlZddlZddlmZddd�ZGd�dej�ZGd�d�Z	Gd	�d
�Z
d�ZdS(u�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.
iN(udequecCsNt|�|dkrd}n|dkr:t|�}n|||�}|S(Ni(u
memoryviewuNoneulen(uobjustartustopux((u//usr/local/python-3.2/lib/python3.2/asynchat.pyubuffer4s
	cBs�|EeZdZdZdZdZdZddd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS(u�This is an abstract class.  You must derive from this class, and add
    the two methods collect_incoming_data() and found_terminator()iiulatin1cCs8d|_g|_t�|_tjj|||�dS(Ns(uac_in_bufferuincomingudequeu
producer_fifouasyncoreu
dispatcheru__init__(uselfusockumap((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu__init__Ps		cCstd��dS(Numust be implemented in subclass(uNotImplementedError(uselfudata((u//usr/local/python-3.2/lib/python3.2/asynchat.pyucollect_incoming_dataascCs|jj|�dS(N(uincominguappend(uselfudata((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu_collect_incoming_datadscCs&dj|j�}|jdd�=|S(Ns(ujoinuincoming(uselfud((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu	_get_datagscCstd��dS(Numust be implemented in subclass(uNotImplementedError(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyufound_terminatorlscCs:t|t�r-|jr-t||j�}n||_dS(uRSet the input delimiter.  Can be a fixed string of any length, an integer, or NoneN(u
isinstanceustruuse_encodingubytesuencodingu
terminator(uselfuterm((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuset_terminatoroscCs|jS(N(u
terminator(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuget_terminatoruscCs`y|j|j�}Wn6tjk
rN}z|j�dSWYdd}~XnXt|t�r||jr|tt|j	�}n|j
||_
x�|j
r[t|j
�}|j�}|s�|j
|j
�d|_
q�t|t�rh|}||kr"|j
|j
�d|_
|j||_qX|j
|j
d|��|j
|d�|_
d|_|j�q�t|�}|j
j|�}|dkr�|dkr�|j
|j
d|��n|j
||d�|_
|j�q�t|j
|�}|r?||kr;|j
|j
d|��|j
|d�|_
nPq�|j
|j
�d|_
q�WdS(Nsiii����(urecvuac_in_buffer_sizeusocketuerroruhandle_erroru
isinstanceustruuse_encodingubytesuencodinguac_in_bufferulenuget_terminatorucollect_incoming_datauintu
terminatorufound_terminatorufindufind_prefix_at_end(uselfudatauwhyulbu
terminatorunuterminator_lenuindex((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuhandle_read}sN
		
	
cCs|j�dS(N(u
initiate_send(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuhandle_write�scCs|j�dS(N(uclose(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuhandle_close�scCs}|j}t|�|kr_xQtdt|�|�D]$}|jj||||��q4Wn|jj|�|j�dS(Ni(uac_out_buffer_sizeulenurangeu
producer_fifouappendu
initiate_send(uselfudatausabsui((u//usr/local/python-3.2/lib/python3.2/asynchat.pyupush�s	%cCs|jj|�|j�dS(N(u
producer_fifouappendu
initiate_send(uselfuproducer((u//usr/local/python-3.2/lib/python3.2/asynchat.pyupush_with_producer�scCsdS(u4predicate for inclusion in the readable for select()i((uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyureadable�scCs|jp|jS(u4predicate for inclusion in the writable for select()(u
producer_fifou	connected(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuwritable�scCs|jjd�dS(uAautomatically close this channel once the outgoing queue is emptyN(u
producer_fifouappenduNone(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuclose_when_done�scCsuxn|jrp|jrp|jd}|sO|jd=|dkrO|j�dSn|j}yt|d|�}WnDtk
r�|j�}|r�|jj|�n
|jd=wYnXt	|t
�r�|jr�t||j
�}ny|j|�}Wn#tjk
r|j�dSYnX|rl|t|�ksE|t|�kr_||d�|jd<ql|jd=ndSWdS(Ni(u
producer_fifou	connecteduNoneuhandle_closeuac_out_buffer_sizeubufferu	TypeErrorumoreu
appendleftu
isinstanceustruuse_encodingubytesuencodingusendusocketuerroruhandle_errorulen(uselfufirstuobsudataunum_sent((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu
initiate_send�s8


	


	$
cCs*d|_|jdd�=|jj�dS(Ns(uac_in_bufferuincomingu
producer_fifouclear(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyudiscard_bufferss	N(u__name__u
__module__u__doc__uac_in_buffer_sizeuac_out_buffer_sizeuuse_encodinguencodinguNoneu__init__ucollect_incoming_datau_collect_incoming_datau	_get_dataufound_terminatoruset_terminatoruget_terminatoruhandle_readuhandle_writeuhandle_closeupushupush_with_producerureadableuwritableuclose_when_doneu
initiate_sendudiscard_buffers(u
__locals__((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu
async_chatAs,
							D									*u
async_chatcBs#|EeZdd�Zd�ZdS(icCs||_||_dS(N(udataubuffer_size(uselfudataubuffer_size((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu__init__s	cCset|j�|jkrK|jd|j�}|j|jd�|_|S|j}d|_|SdS(Ns(ulenudataubuffer_size(uselfuresult((u//usr/local/python-3.2/lib/python3.2/asynchat.pyumores		N(u__name__u
__module__u__init__umore(u
__locals__((u//usr/local/python-3.2/lib/python3.2/asynchat.pyusimple_producers
usimple_producercBsG|EeZdd�Zd�Zd�Zd�Zd�Zd�ZdS(cCs(|st�|_nt|�|_dS(N(udequeulist(uselfulist((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu__init__%scCs
t|j�S(N(ulenulist(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu__len__+scCs|jS(N(ulist(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyuis_empty.scCs|jdS(Ni(ulist(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyufirst1scCs|jj|�dS(N(ulistuappend(uselfudata((u//usr/local/python-3.2/lib/python3.2/asynchat.pyupush4scCs$|jrd|jj�fSdSdS(Nii(iN(ulistupopleftuNone(uself((u//usr/local/python-3.2/lib/python3.2/asynchat.pyupop7s	N(	u__name__u
__module__uNoneu__init__u__len__uis_emptyufirstupushupop(u
__locals__((u//usr/local/python-3.2/lib/python3.2/asynchat.pyufifo$s
				ufifocCsEt|�d}x.|r@|j|d|��r@|d8}qW|S(Ni(ulenuendswith(uhaystackuneedleul((u//usr/local/python-3.2/lib/python3.2/asynchat.pyufind_prefix_at_endLs#(u__doc__usocketuasyncoreucollectionsudequeuNoneubufferu
dispatcheru
async_chatusimple_producerufifoufind_prefix_at_end(((u//usr/local/python-3.2/lib/python3.2/asynchat.pyu<module>/s
�(
© 2025 GrazzMean