HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/aiohttp/__pycache__/compression_utils.cpython-310.pyc
o

���g1�@s�ddlZddlZddlmZddlmZmZzzddlZWn
e	y*ddlZYnwdZ
Wne	y9dZ
YnwdZ		ddeede
d	efd
d�ZGdd
�d
�ZGdd�de�ZGdd�de�ZGdd�d�ZdS)�N)�Executor)�Optional�castTFi�encoding�suppress_deflate_header�returncCs$|dkr	dtjS|rtjStjS)N�gzip�)�zlib�	MAX_WBITS)rr�r�D/usr/local/lib/python3.10/dist-packages/aiohttp/compression_utils.py�encoding_to_modes
rc@s0eZdZdefdedeedeefdd�ZdS)�ZlibBaseHandlerN�mode�executor�max_sync_chunk_sizecCs||_||_||_dS�N)�_mode�	_executor�_max_sync_chunk_size)�selfrrrrrr
�__init__s
zZlibBaseHandler.__init__)�__name__�
__module__�__qualname__�MAX_SYNC_CHUNK_SIZE�intrrrrrrr
rs����rcs�eZdZddddejdefdeededee	dee	de	dee
d	ee	f�fd
d�
Zded
efdd�Z
ded
efdd�Zejfde	d
efdd�Z�ZS)�ZLibCompressorNFrr�level�wbits�strategyrrcsbt�j|durt||�n|||d�|dur tj|j|d�|_n
tj|j||d�|_t��|_	dS)N�rrr)r r!)r r!r)
�superrrr
�compressobjr�_compressor�asyncio�Lock�_compress_lock)rrrrr r!rr��	__class__rr
r*s

��	�zZLibCompressor.__init__�datarcC�|j�|�Sr)r%�compress�rr+rrr
�
compress_syncE�zZLibCompressor.compress_syncc	�s��|j4IdH�5|jdur.t|�|jkr.t���|j|jj|�IdHWd�IdHS|�	|�Wd�IdHS1IdHsCwYdS)aCCompress the data and returned the compressed bytes.

        Note that flush() must be called after the last call to compress()

        If the data size is large than the max_sync_chunk_size, the compression
        will be done in the executor. Otherwise, the compression will be done
        in the event loop.
        N)
r(r�lenr&�get_running_loop�run_in_executorrr%r-r/r.rrr
r-Hs�	
��0�zZLibCompressor.compressrcCr,r)r%�flush)rrrrr
r4_r0zZLibCompressor.flush)rrrr
�Z_DEFAULT_STRATEGYrr�str�boolrrr�bytesr/r-�Z_FINISHr4�
__classcell__rrr)r
r)s4�������� rc
s�eZdZdddefdeededeedeef�fdd�
Z	dd
e
dede
fd
d�Zdd
e
dede
fdd�Zddede
fdd�Z
edefdd��Zede
fdd��Zede
fdd��Z�ZS)�ZLibDecompressorNFrrrrcs,t�jt||�||d�tj|jd�|_dS)Nr")r )r#rrr
�
decompressobjr�
_decompressor)rrrrrr)rr
rds�zZLibDecompressor.__init__rr+�
max_lengthrcCs|j�||�Sr)r=�
decompress�rr+r>rrr
�decompress_syncrsz ZLibDecompressor.decompress_syncc�sF�|jdurt|�|jkrt���|j|jj||�IdHS|�||�S)z�Decompress the data and return the decompressed bytes.

        If the data size is large than the max_sync_chunk_size, the decompression
        will be done in the executor. Otherwise, the decompression will be done
        in the event loop.
        N)	rr1r&r2r3rr=r?rAr@rrr
r?us�

�zZLibDecompressor.decompress�lengthcCs|dkr
|j�|�S|j��S)Nr)r=r4)rrBrrr
r4�s

���zZLibDecompressor.flushcC�|jjSr)r=�eof�rrrr
rD��zZLibDecompressor.eofcCrCr)r=�unconsumed_tailrErrr
rG�rFz ZLibDecompressor.unconsumed_tailcCrCr)r=�unused_datarErrr
rH�rFzZLibDecompressor.unused_data)r)rrrrrr6r7rrrr8rAr?r4�propertyrDrGrHr:rrr)r
r;cs.�����r;c@s6eZdZd
dd�Zdedefdd�Zdefdd	�ZdS)�BrotliDecompressorrNcCststd��t��|_dS)NzIThe brotli decompression is not available. Please install `Brotli` module)�
HAS_BROTLI�RuntimeError�brotli�Decompressor�_objrErrr
r�s
�zBrotliDecompressor.__init__r+cCs0t|jd�rtt|j�|��Stt|j�|��S)Nr?)�hasattrrOrr8r?�processr.rrr
rA�sz"BrotliDecompressor.decompress_synccCs t|jd�rtt|j���SdS)Nr4�)rPrOrr8r4rErrr
r4�szBrotliDecompressor.flush)rN)rrrrr8rAr4rrrr
rJ�s
rJ)NF)r&r
�concurrent.futuresr�typingrr�
brotlicffirM�ImportErrorrKrr6r7rrrrr;rJrrrr
�<module>s8�����
�
:6