← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/httpx/__pycache__/_decoders.cpython-312.pyc

80 lines

�

c�bj	/����dZddlmZddlZddlZddlZddlZddlmZ	ddl	Z		ddlZGd�d�Z
Gd�d	e
�ZGd
�de
�ZGd�d
e
�ZGd�de
�ZGd�de
�ZGd�de
�ZGd�d�ZGd�d�ZGd�d�ZGd�d�Zeeeeed�Ze	�ej3d�e�ej3d�yy#e
$r	ddlZ	n
#e
$rdZ	YnwxYwY��wxYw#e
$rdZY��wxYw)zq
Handlers for Content-Encoding.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
�)�annotationsN�)�
DecodingErrorc��eZdZdd�Zdd�Zy)�ContentDecoderc��t���N��NotImplementedError��self�datas  �f/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpx/_decoders.py�decodezContentDecoder.decode%���!�#�#�c��t��r	r
�r
s r�flushzContentDecoder.flush(rrN�r�bytes�returnr�rr)�__name__�
__module__�__qualname__rr�rrrr$s��$�$rrc� �eZdZdZdd�Zdd�Zy)�IdentityDecoderz 
    Handle unencoded data.
    c��|Sr	rrs  rrzIdentityDecoder.decode1s���rc��y�Nrrrs rrzIdentityDecoder.flush4s��rNrr)rrr�__doc__rrrrrrr,s����rrc�(�eZdZdZdd�Zdd�Zdd�Zy)	�DeflateDecoderzZ
    Handle 'deflate' decoding.

    See: https://stackoverflow.com/questions/1838699
    c�D�d|_tj�|_y�NT)�
first_attempt�zlib�
decompressobj�decompressorrs r�__init__zDeflateDecoder.__init__?s��!��� �.�.�0��rc�B�|j}d|_	|jj|�S#tj$r[}|r?tj
tj�|_|j|�cYd}~Stt|��|�d}~wwxYw�NF)
r(r+�
decompressr)�errorr*�	MAX_WBITSrr�str)r
r�was_first_attempt�excs    rrzDeflateDecoder.decodeCs��� �.�.��"���	3��$�$�/�/��5�5���z�z�	3� �$(�$6�$6�����$G��!��{�{�4�(�(���C��)�s�2��		3�s!�0�B�;B�>B�B�Bc��	|jj�S#tj$r}t	t|��|�d}~wwxYwr	�r+rr)r0rr2�r
r4s  rrzDeflateDecoder.flushN�A��	3��$�$�*�*�,�,���z�z�	3���C��)�s�2��	3����A	�A�A	N�r�Nonerr�rrrr#r,rrrrrr%r%8s���1�	3�3rr%c�(�eZdZdZdd�Zdd�Zdd�Zy)	�GZipDecoderzW
    Handle 'gzip' decoding.

    See: https://stackoverflow.com/questions/1838699
    c�Z�tjtjdz�|_y)N�)r)r*r1r+rs rr,zGZipDecoder.__init__\s�� �.�.�t�~�~��/B�C��rc��	|jj|�S#tj$r}t	t|��|�d}~wwxYwr	)r+r/r)r0rr2�r
rr4s   rrzGZipDecoder.decode_sC��	3��$�$�/�/��5�5���z�z�	3���C��)�s�2��	3�s��A
�A�A
c��	|jj�S#tj$r}t	t|��|�d}~wwxYwr	r6r7s  rrzGZipDecoder.flusher8r9Nr:rrr<rrrr>r>Us���D�3�3rr>c�(�eZdZdZdd�Zdd�Zdd�Zy)	�
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'
    c��t�td�d�tj�|_d|_|t|jd�r|jj|_y|jj|_y)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�processrs rr,zBrotliDecoder.__init__vsv���>��P���	
�#�/�/�1��������4�$�$�l�3�#�0�0�;�;�D�� $�0�0�8�8�D�rc��|syd|_	|j|�S#tj$r}t	t|��|�d}~wwxYw�NrT)rJrLrGr0rr2rBs   rrzBrotliDecoder.decode�sJ�������	3��#�#�D�)�)���|�|�	3���C��)�s�2��	3�s��A
�A�A
c���|jsy	t|jd�r|jj�y#tj
$r}t
t|��|�d}~wwxYw)Nr�finish)rJrKr+rQrGr0rr2r7s  rrzBrotliDecoder.flush�s]���~�~��
	3��t�(�(�(�3��!�!�(�(�*����|�|�	3���C��)�s�2��	3�s�0A�A-�A(�(A-Nr:rrr<rrrrErEls���9�$3�
3rrEc�(�eZdZdZdd�Zdd�Zdd�Zy)	�ZStandardDecoderz�
    Handle 'zstd' RFC 8878 decoding.

    Requires `pip install zstandard`.
    Can be installed as a dependency of httpx using `pip install httpx[zstd]`.
    c��t�td�d�tj�j�|_d|_y)NzXUsing 'ZStandardDecoder', ...Make sure to install httpx using `pip install httpx[zstd]`.F)�	zstandardrH�ZstdDecompressorr*r+rJrs rr,zZStandardDecoder.__init__�sC�����N���
�
&�6�6�8�F�F�H�����rc��t�J�d|_tj�}	|j	|j
j
|��|j
jr�|j
jr�|j
j}tj�j�|_|j	|j
j
|��|j
jr|j
jr��|j�S#tj$r}tt|��|�d}~wwxYwr')rUrJ�io�BytesIO�writer+r/�eof�unused_datarVr*�	ZstdErrorrr2�getvalue)r
r�outputr\r4s     rrzZStandardDecoder.decode�s����$�$�$���������	3��L�L��*�*�5�5�d�;�<��#�#�'�'�D�,=�,=�,I�,I�"�/�/�;�;��$-�$>�$>�$@�$N�$N�$P��!����T�.�.�9�9�+�F�G��#�#�'�'�D�,=�,=�,I�,I���� � ���"�"�	3���C��)�s�2��	3�s�C)D�E�2E�Ec��|jsy|jj�}|jjst	d��t|�S)NrzZstandard data is incomplete)rJr+rr[rr)r
�rets  rrzZStandardDecoder.flush�sE���~�~�����%�%�'��� � �$�$�� >�?�?��S�z�rNr:rrr<rrrrSrS�s����!�rrSc�(�eZdZdZdd�Zdd�Zdd�Zy)	�MultiDecoderzE
    Handle the case where multiple encodings have been applied.
    c�6�tt|��|_y)zm
        'children' should be a sequence of decoders in the order in which
        each was applied.
        N)�list�reversed�children)r
rgs  rr,zMultiDecoder.__init__�s���X�h�/�0��
rc�J�|jD]}|j|�}�|Sr	)rgr�r
r�childs   rrzMultiDecoder.decode�s#���]�]�E��<�<��%�D�#��rc�p�d}|jD]$}|j|�|j�z}�&|Sr")rgrrris   rrzMultiDecoder.flush�s3�����]�]�E��<�<��%����
�5�D�#��rN)rgztyping.Sequence[ContentDecoder]rr;rrr<rrrrcrc�s���1��
rrcc�*�eZdZdZddd�Zdd�Zd	d�Zy)
�ByteChunkerz>
    Handles returning byte content in fixed-size chunks.
    Nc�D�tj�|_||_yr	)rXrY�_buffer�_chunk_size�r
�
chunk_sizes  rr,zByteChunker.__init__�s���z�z�|���%��rc��|j�|r|gSgS|jj|�|jj�|jk\�r|jj	�}tdt
|�|j�D�cgc]}||||jz��}}t
|d�|jk(r7|jjd�|jj�|S|jjd�|jj|d�|jj�|ddSgScc}w�Nr������	rprorZ�tellr^�range�len�seek�truncate�r
�content�value�i�chunkss     rrzByteChunker.decode��0�����#� '�G�9�/�R�/������7�#��<�<����$�"2�"2�2��L�L�)�)�+�E��q�#�e�*�d�.>�.>�?��?�A��a�!�d�.�.�.�/�?�
���6�"�:��$�"2�"2�2����!�!�!�$����%�%�'��
����!�!�!�$����"�"�6�"�:�.����%�%�'��c�r�{�"��I����Ec��|jj�}|jjd�|jj�|r|gSgS�Nr�ror^rzr{�r
r~s  rrzByteChunker.flush�E�����%�%�'�������!����������w�'�R�'rr	�rrz
int | Nonerr;)r}rr�list[bytes])rr�r<rrrrmrm�����&��.(rrmc�*�eZdZdZddd�Zdd�Zd	d�Zy)
�TextChunkerz>
    Handles returning text content in fixed-size chunks.
    Nc�D�tj�|_||_yr	)rX�StringIOrorprqs  rr,zTextChunker.__init__s���{�{�}���%��rc��|j�|r|gSgS|jj|�|jj�|jk\�r|jj	�}tdt
|�|j�D�cgc]}||||jz��}}t
|d�|jk(r7|jjd�|jj�|S|jjd�|jj|d�|jj�|ddSgScc}wrtrvr|s     rrzTextChunker.decoder�r�c��|jj�}|jjd�|jj�|r|gSgSr�r�r�s  rrzTextChunker.flush+r�rr	r�)r}r2r�	list[str]�rr�r<rrrr�r�r�rr�c�*�eZdZdZddd�Zdd�Zd	d�Zy)
�TextDecoderz8
    Handles incrementally decoding bytes into text
    c�F�tj|�d��|_y)N�replace)�errors)�codecs�getincrementaldecoder�decoder)r
�encodings  rr,zTextDecoder.__init__7s��=�v�3�3�H�=�Y�O��rc�8�|jj|�Sr	�r�rrs  rrzTextDecoder.decode:s���|�|�"�"�4�(�(rc�:�|jjdd�SrOr�rs rrzTextDecoder.flush=s���|�|�"�"�3��-�-rN)zutf-8)r�r2rr;)rrrr2)rr2r<rrrr�r�2s���P�)�.rr�c�(�eZdZdZdd�Zdd�Zdd�Zy)	�LineDecoderz�
    Handles incrementally reading lines from text.

    Has the same behaviour as the stdllib splitlines,
    but handling the input iteratively.
    c� �g|_d|_yr.)�buffer�trailing_crrs rr,zLineDecoder.__init__Is��!#���!&��rc��d}|jrd|z}d|_|jd�rd|_|dd}|sgS|d|v}|j�}t|�dk(r"|s |jj|d�gS|jr/dj
|j�|dzg|ddz}g|_|s|j�g|_|S)	Nu

…

�
FTrurr�)r��endswith�
splitlinesryr��append�join�pop)r
�text�
NEWLINE_CHARS�trailing_newline�liness     rrzLineDecoder.decodeMs���B�
�����$�;�D�$�D���=�=���#�D�����9�D���I���8�}�4�����!���u�:��?�#3��K�K���u�Q�x�(��I��;�;��W�W�T�[�[�)�E�!�H�4�5��a�b�	�A�E��D�K��!�9�9�;�-�D�K��rc��|js|jsgSdj|j�g}g|_d|_|S)Nr�F)r�r�r�)r
r�s  rrzLineDecoder.flushss?���{�{�4�#3�#3��I�������%�&����� ����rNr:)r�r2rr�r�r<rrrr�r�As���'�$�Lrr�)�identity�gzip�deflate�br�zstdr�r�)r#�
__future__rr�rX�typingr)�_exceptionsrrGrH�
brotlicffirUrrr%r>rErSrcrmr�r�r��SUPPORTED_DECODERSr�rrr�<module>r�s9���#�
�	�
��&�	����
$�$�	�n�	�3�^�3�:3�.�3�.23�N�23�j'�~�'�T�>��2$(�$(�N$(�$(�N.�.�9�9�z ���
����
�>����4� ������6�"���i���	$�������������I��sF�C
�C+�
C(�C�C(�C"�C(�!C"�"C(�'C(�+C5�4C5