
    h	/                       S r SSKJr  SSKrSSKrSSKrSSKrSSKJr   SSK	r	 SSKr " S S5      r " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S5      r " S S5      r " S S5      r\\\\\S.r\	c  \R3                  S5        \c  \R3                  S5        gg! \
 a     SSKr	 N! \
 a    Sr	  Nf = ff = f! \
 a    Sr Nf = f)zq
Handlers for Content-Encoding.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
    )annotationsN   )DecodingErrorc                  (    \ rS rSrSS jrSS jrSrg)ContentDecoder$   c                    [        5       eNNotImplementedErrorselfdatas     A/var/www/html/env/lib/python3.13/site-packages/httpx/_decoders.pydecodeContentDecoder.decode%       !##    c                    [        5       er
   r   r   s    r   flushContentDecoder.flush(   r   r    Nr   bytesreturnr   r   r   )__name__
__module____qualname____firstlineno__r   r   __static_attributes__r   r   r   r   r   $   s    $$r   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	IdentityDecoder,   z
Handle unencoded data.
c                    U$ r
   r   r   s     r   r   IdentityDecoder.decode1   s    r   c                    gNr   r   r   s    r   r   IdentityDecoder.flush4   s    r   r   Nr   r   )r   r   r    r!   __doc__r   r   r"   r   r   r   r$   r$   ,   s    r   r$   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)DeflateDecoder8   zN
Handle 'deflate' decoding.

See: https://stackoverflow.com/questions/1838699
c                F    SU l         [        R                  " 5       U l        g NT)first_attemptzlibdecompressobjdecompressorr   s    r   __init__DeflateDecoder.__init__?   s    ! ..0r   c                P   U R                   nSU l          U R                  R                  U5      $ ! [        R                   aa  nU(       a@  [        R
                  " [        R                  * 5      U l        U R                  U5      s S nA$ [        [        U5      5      UeS nAff = fNF)
r1   r4   
decompressr2   errorr3   	MAX_WBITSr   r   str)r   r   was_first_attemptexcs       r   r   DeflateDecoder.decodeC   s     .."	3$$//55zz 	3 $($6$6$G!{{4((C)s2		3s"   0 B%AB B%B  B%c                     U R                   R                  5       $ ! [        R                   a  n[	        [        U5      5      UeS nAff = fr
   r4   r   r2   r:   r   r<   r   r>   s     r   r   DeflateDecoder.flushN   A    	3$$**,,zz 	3C)s2	3    A
AA
)r4   r1   Nr   Noner   r   	r   r   r    r!   r+   r5   r   r   r"   r   r   r   r-   r-   8   s    1	33r   r-   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)GZipDecoderU   zK
Handle 'gzip' decoding.

See: https://stackoverflow.com/questions/1838699
c                \    [         R                  " [         R                  S-  5      U l        g )N   )r2   r3   r;   r4   r   s    r   r5   GZipDecoder.__init__\   s     ..t~~/BCr   c                     U R                   R                  U5      $ ! [        R                   a  n[	        [        U5      5      UeS nAff = fr
   )r4   r9   r2   r:   r   r<   r   r   r>   s      r   r   GZipDecoder.decode_   sC    	3$$//55zz 	3C)s2	3s    AAAc                     U R                   R                  5       $ ! [        R                   a  n[	        [        U5      5      UeS nAff = fr
   rA   rB   s     r   r   GZipDecoder.flushe   rD   rE   )r4   NrF   r   r   rH   r   r   r   rJ   rJ   U   s    D33r   rJ   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)BrotliDecoderl   a<  
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'
c                   [         c  [        S5      S e[         R                  " 5       U l        SU l        U   [        U R                  S5      (       a  U R                  R                  U l        g U R                  R                  U l        g )NzUsing 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' packages have been installed. Make sure to install httpx using `pip install httpx[brotli]`.Fr9   )	brotliImportErrorDecompressorr4   	seen_datahasattrr9   _decompressprocessr   s    r   r5   BrotliDecoder.__init__v   sy    >P 	 #//14$$l33#00;;D  $0088Dr   c                    U(       d  gSU l          U R                  U5      $ ! [        R                   a  n[	        [        U5      5      UeS nAff = fNr   T)r[   r]   rX   r:   r   r<   rP   s      r   r   BrotliDecoder.decode   sJ    	3##D))|| 	3C)s2	3s   " AAAc                    U R                   (       d  g [        U R                  S5      (       a  U R                  R                  5         g! [        R
                   a  n[        [        U5      5      UeS nAff = f)Nr   finish)r[   r\   r4   rd   rX   r:   r   r<   rB   s     r   r   BrotliDecoder.flush   s`    ~~
	3t(((33 !!((*|| 	3C)s2	3s   5A
 
A8A33A8)r]   r4   r[   NrF   r   r   rH   r   r   r   rU   rU   l   s    9$33r   rU   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)ZStandardDecoder   z
Handle 'zstd' RFC 8878 decoding.

Requires `pip install zstandard`.
Can be installed as a dependency of httpx using `pip install httpx[zstd]`.
c                    [         c  [        S5      S e[         R                  " 5       R                  5       U l        SU l        g )NzXUsing 'ZStandardDecoder', ...Make sure to install httpx using `pip install httpx[zstd]`.F)	zstandardrY   ZstdDecompressorr3   r4   r[   r   s    r   r5   ZStandardDecoder.__init__   sC    N 
 &668FFHr   c                   [         c   eSU l        [        R                  " 5       n UR	                  U R
                  R                  U5      5        U R
                  R                  (       a  U R
                  R                  (       a  U R
                  R                  n[         R                  " 5       R                  5       U l        UR	                  U R
                  R                  U5      5        U R
                  R                  (       a  U R
                  R                  (       a  M  UR                  5       $ ! [         R                   a  n[        [        U5      5      UeS nAff = fr0   )rj   r[   ioBytesIOwriter4   r9   eofunused_datark   r3   	ZstdErrorr   r<   getvalue)r   r   outputrr   r>   s        r   r   ZStandardDecoder.decode   s   $$$	3LL**55d;<##''D,=,=,I,I"//;;$-$>$>$@$N$N$P!T..99+FG ##''D,=,=,I,I,I    "" 	3C)s2	3s   C>D7 7E%E  E%c                    U R                   (       d  gU R                  R                  5       nU R                  R                  (       d  [	        S5      e[        U5      $ )Nr   zZstandard data is incomplete)r[   r4   r   rq   r   r   )r   rets     r   r   ZStandardDecoder.flush   sE    ~~%%'  $$ >??Szr   )r4   r[   NrF   r   r   rH   r   r   r   rg   rg      s    !r   rg   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)MultiDecoder   z=
Handle the case where multiple encodings have been applied.
c                6    [        [        U5      5      U l        g)zU
'children' should be a sequence of decoders in the order in which
each was applied.
N)listreversedchildren)r   r   s     r   r5   MultiDecoder.__init__   s     Xh/0r   c                N    U R                    H  nUR                  U5      nM     U$ r
   )r   r   r   r   childs      r   r   MultiDecoder.decode   s#    ]]E<<%D #r   c                t    SnU R                    H%  nUR                  U5      UR                  5       -   nM'     U$ r)   )r   r   r   r   s      r   r   MultiDecoder.flush   s3    ]]E<<%5D #r   )r   N)r   ztyping.Sequence[ContentDecoder]r   rG   r   r   rH   r   r   r   r{   r{      s    1
r   r{   c                  :    \ rS rSrSrSS	S jjrS
S jrSS jrSrg)ByteChunker   z6
Handles returning byte content in fixed-size chunks.
Nc                D    [         R                  " 5       U l        Xl        g r
   )rn   ro   _buffer_chunk_sizer   
chunk_sizes     r   r5   ByteChunker.__init__   s    zz|%r   c                   U R                   c  U(       a  U/$ / $ U R                  R                  U5        U R                  R                  5       U R                   :  Ga  U R                  R	                  5       n[        S[        U5      U R                   5       Vs/ s H  nX#X0R                   -    PM     nn[        US   5      U R                   :X  a7  U R                  R                  S5        U R                  R                  5         U$ U R                  R                  S5        U R                  R                  US   5        U R                  R                  5         US S $ / $ s  snf Nr   	r   r   rp   tellrt   rangelenseektruncater   contentvalueichunkss        r   r   ByteChunker.decode   ,   # 'G9/R/7#<<$"2"22LL))+E q#e*d.>.>??A !.../?   6":$"2"22!!!$%%'!!!$""6":.%%'cr{"I   E#c                    U R                   R                  5       nU R                   R                  S5        U R                   R                  5         U(       a  U/$ / $ Nr   r   rt   r   r   r   r   s     r   r   ByteChunker.flush  E    %%'!w'R'r   r   r   r
   r   z
int | Noner   rG   )r   r   r   list[bytes])r   r   rH   r   r   r   r   r          &.(r   r   c                  :    \ rS rSrSrSS	S jjrS
S jrSS jrSrg)TextChunkeri  z6
Handles returning text content in fixed-size chunks.
Nc                D    [         R                  " 5       U l        Xl        g r
   )rn   StringIOr   r   r   s     r   r5   TextChunker.__init__  s    {{}%r   c                   U R                   c  U(       a  U/$ / $ U R                  R                  U5        U R                  R                  5       U R                   :  Ga  U R                  R	                  5       n[        S[        U5      U R                   5       Vs/ s H  nX#X0R                   -    PM     nn[        US   5      U R                   :X  a7  U R                  R                  S5        U R                  R                  5         U$ U R                  R                  S5        U R                  R                  US   5        U R                  R                  5         US S $ / $ s  snf r   r   r   s        r   r   TextChunker.decode  r   r   c                    U R                   R                  5       nU R                   R                  S5        U R                   R                  5         U(       a  U/$ / $ r   r   r   s     r   r   TextChunker.flush+  r   r   r   r
   r   )r   r<   r   	list[str]r   r   rH   r   r   r   r   r     r   r   r   c                  :    \ rS rSrSrSS	S jjrS
S jrSS jrSrg)TextDecoderi2  z0
Handles incrementally decoding bytes into text
c                B    [         R                  " U5      " SS9U l        g )Nreplace)errors)codecsgetincrementaldecoderdecoder)r   encodings     r   r5   TextDecoder.__init__7  s    33H=YOr   c                8    U R                   R                  U5      $ r
   r   r   r   s     r   r   TextDecoder.decode:  s    ||""4((r   c                :    U R                   R                  SS5      $ ra   r   r   s    r   r   TextDecoder.flush=  s    ||""3--r   )r   N)zutf-8)r   r<   r   rG   )r   r   r   r<   )r   r<   rH   r   r   r   r   r   2  s    P).r   r   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)LineDecoderiA  z
Handles incrementally reading lines from text.

Has the same behaviour as the stdllib splitlines,
but handling the input iteratively.
c                     / U l         SU l        g r8   buffertrailing_crr   s    r   r5   LineDecoder.__init__I  s    !#!&r   c                   SnU R                   (       a  SU-   nSU l         UR                  S5      (       a  SU l         US S nU(       d  / $ US   U;   nUR                  5       n[        U5      S:X  a'  U(       d   U R                  R                  US   5        / $ U R                  (       a/  SR                  U R                  5      US   -   /USS  -   n/ U l        U(       d  UR                  5       /U l        U$ )	Nu   
  FTr   r   r    )r   endswith
splitlinesr   r   appendjoinpop)r   textNEWLINE_CHARStrailing_newlineliness        r   r   LineDecoder.decodeM  s    B $;D$D==#D9D I8}4!u:?#3KKuQx(I;; WWT[[)E!H45ab	AEDK !99;-DKr   c                    U R                   (       d  U R                  (       d  / $ SR                  U R                   5      /n/ U l         SU l        U$ )Nr   F)r   r   r   )r   r   s     r   r   LineDecoder.flushs  s?    {{4#3#3I%& r   r   NrF   )r   r<   r   r   r   rH   r   r   r   r   r   A  s    '$Lr   r   )identitygzipdeflatebrzstdr   r   )r+   
__future__r   r   rn   typingr2   _exceptionsr   rX   rY   
brotlicffirj   r   r$   r-   rJ   rU   rg   r{   r   r   r   r   SUPPORTED_DECODERSr   r   r   r   <module>r      s9   #  	   &	
$ $	n 	3^ 3:3. 3.23N 23j'~ 'T> 2$( $(N$( $(N. .9 9z  
  
>4 6" i   	$   Is:   C C/ C,CC($C,'C((C,/C:9C: