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/httpx/__pycache__/_decoders.cpython-310.pyc
o

���g	/�@s�dZddlmZddlZddlZddlZddlZddlmZzddl	Z	Wne
y?zddlZ	Wne
y<dZ	YnwYnwzddlZWne
yQdZYnwGdd�d�Z
Gdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zeeeeed�Ze	dur�e�d�edur�e�d�dSdS)zq
Handlers for Content-Encoding.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
�)�annotationsN�)�
DecodingErrorc@s eZdZd	dd�Zd
dd�ZdS)�ContentDecoder�data�bytes�returncC�t���N��NotImplementedError��selfr�r�:/usr/local/lib/python3.10/dist-packages/httpx/_decoders.py�decode%�zContentDecoder.decodecCr	r
r�rrrr�flush(rzContentDecoder.flushN�rrrr�rr)�__name__�
__module__�__qualname__rrrrrrr$s
rc@s$eZdZdZd
dd�Zddd�Zd	S)�IdentityDecoderz 
    Handle unencoded data.
    rrrcCs|Sr
rr
rrrr1�zIdentityDecoder.decodecCsdS�N�rrrrrr4rzIdentityDecoder.flushNrr)rrr�__doc__rrrrrrr,s
rc@�.eZdZdZd
dd�Zddd	�Zdd
d�ZdS)�DeflateDecoderzZ
    Handle 'deflate' decoding.

    See: https://stackoverflow.com/questions/1838699
    r�NonecCsd|_t��|_dS�NT)�
first_attempt�zlib�
decompressobj�decompressorrrrr�__init__?szDeflateDecoder.__init__rrc
Csn|j}d|_z|j�|�WStjy6}z|r+t�tj�|_|�|�WYd}~Stt	|��|�d}~ww�NF)
r#r&�
decompressr$�errorr%�	MAX_WBITSrr�str)rr�was_first_attempt�excrrrrCs��zDeflateDecoder.decodec
C�6z|j��WStjy}ztt|��|�d}~wwr
�r&rr$r*rr,�rr.rrrrN���zDeflateDecoder.flushN�rr!rr�rrrrr'rrrrrrr 8s


r c@r)�GZipDecoderzW
    Handle 'gzip' decoding.

    See: https://stackoverflow.com/questions/1838699
    rr!cCst�tjdB�|_dS)N�)r$r%r+r&rrrrr'\�zGZipDecoder.__init__rrc
Cs8z|j�|�WStjy}ztt|��|�d}~wwr
)r&r)r$r*rr,�rrr.rrrr_s��zGZipDecoder.decodec
Cr/r
r0r1rrrrer2zGZipDecoder.flushNr3rrr4rrrrr5Us


r5c@r)�
BrotliDecoderaT
    Handle 'brotli' decoding.

    Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/
        or   `pip install brotli`. See https://github.com/google/brotli
    Supports both 'brotlipy' and 'Brotli' packages since they share an import
    name. The top branches are for 'brotlipy' and bottom branches for 'Brotli'
    rr!cCsNtdur	td�d�t��|_d|_|t|jd�r |jj|_dS|jj|_dS)Nz�Using 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' packages have been installed. Make sure to install httpx using `pip install httpx[brotli]`.Fr))	�brotli�ImportError�Decompressorr&�	seen_data�hasattrr)�_decompress�processrrrrr'vs��
zBrotliDecoder.__init__rrc
CsD|sdSd|_z|�|�WStjy!}ztt|��|�d}~ww�NrT)r=r?r:r*rr,r8rrrr�s��zBrotliDecoder.decodec
CsP|jsdSzt|jd�r|j��WdStjy'}ztt|��|�d}~ww)Nr�finish)r=r>r&rBr:r*rr,r1rrrr�s
��zBrotliDecoder.flushNr3rrr4rrrrr9ls

	
	r9c@r)�ZStandardDecoderz�
    Handle 'zstd' RFC 8878 decoding.

    Requires `pip install zstandard`.
    Can be installed as a dependency of httpx using `pip install httpx[zstd]`.
    rr!cCs*tdur	td�d�t����|_d|_dS)NzXUsing 'ZStandardDecoder', ...Make sure to install httpx using `pip install httpx[zstd]`.F)�	zstandardr;�ZstdDecompressorr%r&r=rrrrr'�s��
zZStandardDecoder.__init__rrc
Cs�tdusJ�d|_t��}zA|�|j�|��|jjr@|jjrJ|jj}t�	��
�|_|�|j�|��|jjrE|jjsW|��SW|��SW|��SW|��Stjyb}ztt
|��|�d}~wwr")rDr=�io�BytesIO�writer&r)�eof�unused_datarEr%�	ZstdErrorrr,�getvalue)rr�outputrJr.rrrr�s*�������zZStandardDecoder.decodecCs,|jsdS|j��}|jjstd��t|�S)NrzZstandard data is incomplete)r=r&rrIrr)r�retrrrr�s
zZStandardDecoder.flushNr3rrr4rrrrrC�s



rCc@s.eZdZdZddd�Zdd
d�Zddd
�ZdS)�MultiDecoderzE
    Handle the case where multiple encodings have been applied.
    �children�typing.Sequence[ContentDecoder]rr!cCstt|��|_dS)zm
        'children' should be a sequence of decoders in the order in which
        each was applied.
        N)�list�reversedrP)rrPrrrr'�szMultiDecoder.__init__rrcCs|jD]}|�|�}q|Sr
)rPr�rr�childrrrr�s
zMultiDecoder.decodecCs&d}|jD]}|�|�|��}q|Sr)rPrrrTrrrr�s
zMultiDecoder.flushN)rPrQrr!rrr4rrrrrO�s


rOc@�0eZdZdZdddd�Zddd
�Zddd�ZdS)�ByteChunkerz>
    Handles returning byte content in fixed-size chunks.
    N�
chunk_size�
int | Nonerr!cC�t��|_||_dSr
)rFrG�_buffer�_chunk_size�rrXrrrr'��

zByteChunker.__init__�contentr�list[bytes]c���jdur|r
|gSgS�j�|��j���jkr_�j�����fdd�tdt���j�D�}t|d��jkrF�j�d��j��|S�j�d��j�|d��j��|dd�SgS)Nc�g|]}�||�j��qSr�r\��.0�i�r�valuerr�
<listcomp>����z&ByteChunker.decode.<locals>.<listcomp>r����	r\r[rH�tellrL�range�len�seek�truncate�rr_�chunksrrgrr��"

�

zByteChunker.decodecC�.|j��}|j�d�|j��|r|gSgS�Nr�r[rLrprqrgrrrr�

zByteChunker.flushr
�rXrYrr!)r_rrr`)rr`r4rrrrrW��

rWc@rV)�TextChunkerz>
    Handles returning text content in fixed-size chunks.
    NrXrYrr!cCrZr
)rF�StringIOr[r\r]rrrr'r^zTextChunker.__init__r_r,�	list[str]cra)Ncrbrrcrdrgrrrirjz&TextChunker.decode.<locals>.<listcomp>rrkrlrrrrgrrrtzTextChunker.decodecCrurvrwrgrrrr+rxzTextChunker.flushr
ry)r_r,rr}�rr}r4rrrrr{rzr{c@s0eZdZdZdddd�Zddd�Zdd
d�ZdS)�TextDecoderz8
    Handles incrementally decoding bytes into text
    �utf-8�encodingr,rr!cCst�|�dd�|_dS)N�replace)�errors)�codecs�getincrementaldecoder�decoder)rr�rrrr'7r7zTextDecoder.__init__rrcCs|j�|�Sr
�r�rr
rrrr:szTextDecoder.decodecCs|j�dd�SrAr�rrrrr=szTextDecoder.flushN)r�)r�r,rr!)rrrr,)rr,r4rrrrr2s

rc@s.eZdZdZddd�Zdd	d
�Zddd�Zd
S)�LineDecoderz�
    Handles incrementally reading lines from text.

    Has the same behaviour as the stdllib splitlines,
    but handling the input iteratively.
    rr!cCsg|_d|_dSr()�buffer�trailing_crrrrrr'Is
zLineDecoder.__init__�textr,r}cCs�d}|jrd|}d|_|�d�rd|_|dd�}|sgS|d|v}|��}t|�dkr:|s:|j�|d�gS|jrQd�|j�|dg|dd�}g|_|sY|��g|_|S)	Nu

…

�
FTrkrr�)r��endswith�
splitlinesror��append�join�pop)rr��
NEWLINE_CHARS�trailing_newline�linesrrrrMs(
"zLineDecoder.decodecCs.|js|jsgSd�|j�g}g|_d|_|S)Nr�F)r�r�r�)rr�rrrrsszLineDecoder.flushNr3)r�r,rr}r~r4rrrrr�As


&r�)�identity�gzip�deflate�br�zstdr�r�)r�
__future__rr�rF�typingr$�_exceptionsrr:r;�
brotlicffirDrrr r5r9rCrOrWr{rr��SUPPORTED_DECODERSr�rrrr�<module>sX���
�5*''=�	
�