HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/supervisor/medusa/__pycache__/producers.cpython-36.pyc
3

�k�`#�@s�dZddlmZddlmZGdd�d�ZGdd�d�ZGdd	�d	�ZGd
d�d�ZGdd
�d
�Z	Gdd�d�Z
Gdd�d�ZGdd�d�ZGdd�d�Z
Gdd�d�ZyddlZWnek
r�dZYnXGdd�d�ZGdd�d�ZdS)z;$Id: producers.py,v 1.9 2004/04/21 13:56:28 akuchling Exp $�)�find_prefix_at_end)�as_bytesc@s"eZdZdZddd�Zdd�ZdS)	�simple_producerzproducer for a string�cCs||_||_dS)N)�data�buffer_size)�selfrr�r	�/usr/lib/python3.6/producers.py�__init__szsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdS)N�)�lenrr)r�resultr	r	r
�moreszsimple_producer.moreN)r)�__name__�
__module__�__qualname__�__doc__rrr	r	r	r
rs
rc@s"eZdZdZddd�Zdd�ZdS)	�scanning_producerz:like simple_producer, but more efficient for large strings�cCs||_||_d|_dS)Nr)rr�pos)rrrr	r	r
r#szscanning_producer.__init__cCsZ|jt|j�krR|j}tt|j�|j|j�}|j||�}|jt|�7_|SdSdS)Nr)rr
r�minr)rZlpZrprr	r	r
r(szscanning_producer.moreN)r)rrrrrrr	r	r	r
r!s
rc@s eZdZdZdd�Zdd�ZdS)�lines_producerzproducer for a list of linescCs
||_dS)N)�lines)rrr	r	r
r8szlines_producer.__init__cCs:|jr2|jdd�}|jdd�|_dj|�dSdSdS)N�2z
�)r�join)r�chunkr	r	r
r;s
zlines_producer.moreN)rrrrrrr	r	r	r
r5src@s eZdZdZdd�Zdd�ZdS)�buffer_list_producerzproducer for a list of stringscCsd|_||_dS)Nr)�index�buffers)rr r	r	r
rHszbuffer_list_producer.__init__cCs6|jt|j�krdS|j|j}|jd7_|SdS)Nr�)rr
r )rrr	r	r
rLs
zbuffer_list_producer.moreN)rrrrrrr	r	r	r
rCsrc@s$eZdZdZd	Zdd�Zdd�ZdS)
�
file_producerz(producer wrapper for file[-like] objectsr!�cCsd|_||_dS)Nr)�done�file)rr%r	r	r
rZszfile_producer.__init__cCs<|jr
dS|jj|j�}|s4|jj�|`d|_dS|SdS)Nrr!)r$r%�read�out_buffer_size�close)rrr	r	r
r^s
zfile_producer.moreNi)rrrrr'rrr	r	r	r
r"Tsr"c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�output_producerz;Acts like an output file; suitable for capturing sys.stdoutcCs
d|_dS)Nr)r)rr	r	r
rtszoutput_producer.__init__cCs&|jd�}dj|�}|j|7_dS)N�
z
)�splitrr)rrrr	r	r
�writews

zoutput_producer.writecCs|j|d|_dS)Nz
)r)r�liner	r	r
�	writeline|szoutput_producer.writelinecCs|jdj|�d|_dS)Nz
)rr)rrr	r	r
�
writelinesszoutput_producer.writelinescCsdS)Nr	)rr	r	r
�flush�szoutput_producer.flushcGsdS)Nr	)r�argsr	r	r
�	softspace�szoutput_producer.softspacecCs0|jr(|jdd�}|jdd�|_|SdSdS)Nir)r)rrr	r	r
r�s
zoutput_producer.moreN)rrrrrr,r.r/r0r2rr	r	r	r
r)rsr)c@s eZdZdZdd�Zdd�ZdS)�composite_producerz$combine a fifo of producers into onecCs
||_dS)N)�	producers)rr4r	r	r
r�szcomposite_producer.__init__cCs>x8t|j�r4|jd}|j�}|r&|S|jjd�qWdSdS)Nrr)r
r4r�pop)r�p�dr	r	r
r�s
zcomposite_producer.moreN)rrrrrrr	r	r	r
r3�sr3c@s"eZdZdZd
dd�Zdd�ZdS)�globbing_producerz�
    'glob' the output from a producer into a particular buffer size.
    helps reduce the number of calls to send().  [this appears to
    gain about 30% performance on requests to a single channel]
    r!r#cCs||_d|_||_dS)Nr)�producer�bufferr)rr9rr	r	r
r�szglobbing_producer.__init__cCsDx2t|j�|jkr2|jj�}|r.|j||_qPqW|j}d|_|S)Nr)r
r:rr9r)rr�rr	r	r
r�s
zglobbing_producer.moreN�)r<)rrrrrrr	r	r	r
r8�s
r8c@s eZdZdZdd�Zdd�ZdS)�hooked_producerz�
    A producer that will call <function> when it empties,.
    with an argument of the number of bytes produced.  Useful
    for logging/instrumentation purposes.
    cCs||_||_d|_dS)Nr)r9�function�bytes)rr9r>r	r	r
r�szhooked_producer.__init__cCsF|jr>|jj�}|s(d|_|j|j�n|jt|�7_|SdSdS)Nr)r9rr>r?r
)rrr	r	r
r�s
zhooked_producer.moreN)rrrrrrr	r	r	r
r=�sr=c@s"eZdZdZddd�Zdd�ZdS)�chunked_producera'A producer that implements the 'chunked' transfer coding for HTTP/1.1.
    Here is a sample usage:
            request['Transfer-Encoding'] = 'chunked'
            request.push (
                    producers.chunked_producer (your_producer)
                    )
            request.done()
    NcCs||_||_dS)N)r9�footers)rr9rAr	r	r
r�szchunked_producer.__init__cCsd|jr\|jj�}|r4dt|�}t|�d|dSd|_|jrVdjdg|j�dSdSndSdS)Nz%xs
�0s

s0

r)r9rr
rrAr)rr�sr	r	r
r�s
zchunked_producer.more)N)rrrrrrr	r	r	r
r@�s
r@Nc@s"eZdZdZddd�Zdd�ZdS)	�compressed_producerz:
    Compress another producer on-the-fly, using ZLIB
    �cCs||_tj|�|_dS)N)r9�zlibZcompressobj�
compressor)rr9�levelr	r	r
rszcompressed_producer.__init__cCsJ|jrBd}x2|s<|jj�}|s.d|_|jj�S|jj|�}qW|SdSdS)Nr)r9rrGr0�compress)rZcdatarr	r	r
rs

zcompressed_producer.moreN)rE)rrrrrrr	r	r	r
rD�s

rDc@s"eZdZdZd	dd�Zdd�ZdS)
�escaping_producerz0A producer that escapes a sequence of characters�
.�
..cCs"||_||_||_d|_t|_dS)Nr)r9�esc_from�esc_tor:r)rr9rMrNr	r	r
r s
zescaping_producer.__init__cCsn|j}|j}|j|jj�}|rf|j||�}|j||�}|rZ||d�|_|d|�Sd|_|Sn|SdS)Nr)rMrNr:r9r�replacer)rrMrNr:�ir	r	r
r'szescaping_producer.moreN)rKrL)rrrrrrr	r	r	r
rJs
rJ)ZRCS_IDZasynchatrZsupervisor.compatrrrrrr"r)r3r8r=r@rF�ImportErrorrDrJr	r	r	r
�<module>s$