← back to Atmos Game

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

389 lines

�

c�bj�����ddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Zddlm
Z
ddlmZmZddlmZmZmZmZddlmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&dd	l'm(Z(dd
l)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8dd
l9m:Z:m;Z;gd�Z<ddhZ=dd�Z>d d!d�Z?d d"d�Z@d#d�ZAd$d�ZB				d%d�ZCGd�de	j�eEeEf�ZFGd�d�ZGGd�d�ZHGd�de	j�eEeEf�ZIy)&�)�annotationsN)�Mapping)�Cookie�	CookieJar�)�
ByteStream�UnattachedStream�encode_request�encode_response)�SUPPORTED_DECODERS�ByteChunker�ContentDecoder�IdentityDecoder�LineDecoder�MultiDecoder�TextChunker�TextDecoder)�CookieConflict�HTTPStatusError�RequestNotRead�ResponseNotRead�StreamClosed�StreamConsumed�request_context)�(get_multipart_boundary_from_content_type)�codes)�AsyncByteStream�CookieTypes�HeaderTypes�QueryParamTypes�RequestContent�RequestData�RequestExtensions�RequestFiles�ResponseContent�ResponseExtensions�SyncByteStream)�URL)�to_bytes_or_str�to_str)�Cookies�Headers�Request�Response�
authorizationzproxy-authorizationc�N�	tj|�y#t$rYywxYw)z7
    Return `True` if `encoding` is a known codec.
    FT)�codecs�lookup�LookupError��encodings �d/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpx/_models.py�_is_known_encodingr78s,����
�
�h��������s��	$�$c�P�t|t�r|S|j|xsd�S)zE
    Coerce str/bytes into a strictly byte-wise HTTP header key.
    �ascii)�
isinstance�bytes�encode)�keyr5s  r6�_normalize_header_keyr>Cs&���S�%�(�3�M�c�j�j��9L�W�.M�M�c��t|t�r|St|t�stdt	|�����|j|xsd�S)zG
    Coerce str/bytes into a strictly byte-wise HTTP header value.
    z'Header value must be str or bytes, not r9)r:r;�str�	TypeError�typer<)�valuer5s  r6�_normalize_header_valuerEJsH���%������e�S�!��A�$�u�+��O�P�P��<�<��+�G�,�,r?c�l�tjj�}||d<|jd��S)N�content-type)�failobj)�email�message�Message�get_content_charset)�content_type�msgs  r6�_parse_content_type_charsetrOUs4���-�-�
�
�
!�C�&�C����"�"�4�"�0�0r?c���g}d}|j|�}|s|Stjd|�D]�}	|jdd�\}}d|jd�i}|jd�D]:}	|jd�\}}|j|�||j|�<�<|j	|���|S#t$r|d}}Y��wxYw#t$rY�4wxYw)	a7
    Returns a list of parsed link headers, for more info see:
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
    The generic syntax of those is:
    Link: < uri-reference >; param1=value1; param2="value2"
    So for instance:
    Link; '<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;'
    would return
        [
            {"url": "http:/.../front.jpeg", "type": "image/jpeg"},
            {"url": "http://.../back.jpeg"},
        ]
    :param value: HTTP Link entity-header field
    :return: list of parsed link headers
    z '"z, *<�;r��urlz<> '"�=)�strip�re�split�
ValueError�append)	rD�links�
replace_chars�valrS�params�link�paramr=s	         r6�_parse_header_linksr`]s��� #%�E��M��K�K�
�&�E�����x�x���&��	"��)�)�C��+�K�C���s�y�y��*�+���\�\�#�&�E�
�"�[�[��-�
��U�.3�[�[��-G�D����=�)�*�'�	���T��'��L���	"��r��C�	"���
��
�s#�B?�1C�?
C�C�	C�Cc#�K�|D]7\}}t|j��tvr
td|��}||f���9y�w)Nz[secure])�
match_type_of)r*�lower�SENSITIVE_HEADERSr))�items�k�vs   r6�_obfuscate_sensitive_headersrh�s?�������1��!�'�'�)�� 1�1��
�!�<�A���d�
��s�>Ac���eZdZdZ		d					dd�Zedd��Zejdd��Zedd��Zdd�Z	dd�Z
dd	�Zdd
�Zd d!d�Z
d"d#d�Zd d$d
�Zd%d�Zd&d�Zd'd�Zd(d�Zd)d�Zd*d�Zd+d�Zd,d�Zdd�Zy)-r,z9
    HTTP headers, as a case-insensitive multi-dict.
    Nc��g|_t|t�r"t|j�|_||_
yt|t�rd|j�D]I\}}t
||�}t||�}|jj||j�|f��K||_
y|�N|D]I\}}t
||�}t||�}|jj||j�|f��K||_
y�N)�_listr:r,�listrrer>rErYrc�	_encoding)�self�headersr5rfrg�	bytes_key�bytes_values       r6�__init__zHeaders.__init__�s���
��
��g�w�'��g�m�m�,�D�J�"������
)��
�
����1�1�!�X�>�	�5�a��B���
�
�!�!�9�i�o�o�.?��"M�N�(�"���
�
 ����1�1�!�X�>�	�5�a��B���
�
�!�!�9�i�o�o�.?��"M�N� �
"��r?c��|j�XdD]L}|jD](\}}	|j|�|j|��*||_|jSd|_|jS#t$rY�nwxYw)zn
        Header encoding is mandated as ascii, but we allow fallbacks to utf-8
        or iso-8859-1.
        )r9�utf-8z
iso-8859-1)rn�raw�decode�UnicodeDecodeError)ror5r=rDs    r6r5zHeaders.encoding�s����>�>�!�.��"&�(�(�J�C����
�
�8�,����X�.�#+�&.�D�N��
�~�~��!/�".����~�~���.����s�"A1�1	A>�=A>c��||_yrk)rn�rorDs  r6r5zHeaders.encoding�s	����r?c�X�|jD���cgc]
\}}}||f��c}}}Scc}}}w)zH
        Returns a list of the raw header items, as byte pairs.
        )rl)ro�raw_key�_rDs    r6rvzHeaders.raw�s,��
;?�*�*�E�*�%6�W�a���%� �*�E�E��Es�%c��|jD���cic]"\}}}|j|j�d��$c}}}j�Scc}}}wrk)rlrwr5�keys�ror}r=rDs    r6rzHeaders.keys�s?��EI�Z�Z�P�Z�M�A�s�E��
�
�4�=�=�)�4�/�Z�P�U�U�W�W��Ps�'Ac���i}|jD]V\}}}|j|j�}|j|j�}||vr||xxd|��z
cc<�R|||<�X|j�S)N�, )rlrwr5�values�ro�values_dictr}r=rD�str_key�	str_values       r6r�zHeaders.values�sy��&(��!�Z�Z�M�A�s�E��j�j����/�G����T�]�]�3�I��+�%��G�$�"�Y�K�(8�8�$�'0��G�$�
(��!�!�#�#r?c���i}|jD]V\}}}|j|j�}|j|j�}||vr||xxd|��z
cc<�R|||<�X|j�S)z�
        Return `(key, value)` items of headers. Concatenate headers
        into a single comma separated value when a key occurs multiple times.
        r�)rlrwr5rer�s       r6rez
Headers.items�s{��
')��!�Z�Z�M�A�s�E��j�j����/�G����T�]�]�3�I��+�%��G�$�"�Y�K�(8�8�$�'0��G�$�
(�� � �"�"r?c	��|jD���cgc]<\}}}|j|j�|j|j�f��>c}}}Scc}}}w)z�
        Return a list of `(key, value)` pairs of headers. Allow multiple
        occurrences of the same key without concatenating into a single
        comma separated value.
        )rlrwr5r�s    r6�multi_itemszHeaders.multi_items�sR��"&���
�!+�
��3���Z�Z��
�
�
&����T�]�]�(C�D�!+�
�	
��
s�AAc�0�	||S#t$r|cYSwxYw)z�
        Return a header value. If multiple occurrences of the header occur
        then concatenate them together with commas.
        )�KeyError)ror=�defaults   r6�getzHeaders.get�s%��
	���9����	��N�	�s���c��|j�j|j�}|jD���cgc]4\}}}|j�|k(r|j	|j���6}}}}|s|Sg}|D]>}	|j|	j
d�D�
cgc]}
|
j���c}
��@|Scc}}}wcc}
w)z�
        Return a list of all header values for a given key.
        If `split_commas=True` is passed, then any comma separated header
        values are split into multiple return strings.
        �,)rcr<r5rlrw�extendrWrU)ror=�split_commas�get_header_keyr}�item_key�
item_valuer��split_valuesrD�items           r6�get_listzHeaders.get_list�s�������+�+�D�M�M�:��,0�:�:�
�+5�'��8�Z��~�~��>�1�
���d�m�m�,�+5�	�
���M����E����%�+�+�c�:J� K�:J�$�����:J� K�L�����
��!Ls�9C� C	
c��t|�}|j�D]}||vs�|j|��|jj	|j�yrk)r,r�poprlr�)rorpr=s   r6�updatezHeaders.updatesF���'�"���<�<�>�C��d�{�����
�"�	
�
�
���'�-�-�(r?c�0�t||j��S)Nr4)r,r5�ros r6�copyzHeaders.copys���t�d�m�m�4�4r?c��|j�j|j�}|jD���cgc]&\}}}||k(r|j	|j���(}}}}|rdj|�St
|��cc}}}w)z�
        Return a single header value.

        If there are multiple headers with the same key, then we concatenate
        them with commas. See: https://tools.ietf.org/html/rfc7230#section-3.2.2
        r�)rcr<r5rlrw�joinr�)ror=�normalized_keyr}�
header_key�header_valueres       r6�__getitem__zHeaders.__getitem__s�������+�+�D�M�M�:��04�z�z�
�/9�+��:�|��^�+�
����
�
�.�/9�	�
���9�9�U�#�#��s�m���
s�+Bc���|j|jxsd�}|j|jxsd�}|j�}t|j�D���cgc]\}\}}}||k(r|��}	}}}t|	dd�D]}|j|=�|	r|	d}|||f|j|<y|jj
|||f�ycc}}}w)zs
        Set the header `key` to `value`, removing any duplicate entries.
        Retains insertion order.
        rurNr)r<rnrc�	enumeraterl�reversedrY)
ror=rD�set_key�	set_value�
lookup_key�idxr}r��
found_indexess
          r6�__setitem__zHeaders.__setitem__0s���
�*�*�T�^�^�6�w�7���L�L����!:�7�;�	��]�]�_�
�*3�4�:�:�)>�
�)>�%��%�a��1��:�%�
�)>�	�
��M�!�"�-�.�C��
�
�3��/����"�C�&�
�I�>�D�J�J�s�O��J�J���w�
�I�>�?��
s�(Cc�8�|j�j|j�}t|j�D���cgc]\}\}}}|j�|k(r|�� }}}}|st|��t
|�D]}|j|=�ycc}}}w)z*
        Remove the header `key`.
        N)rcr<r5r�rlr�r�)ror=�del_keyr�r}r��pop_indexess       r6�__delitem__zHeaders.__delitem__Hs����)�)�+�$�$�T�]�]�3��*3�4�:�:�)>�
�)>�%��%�a��1��~�~��7�*�
�)>�	�
���3�-���K�(�C��
�
�3��)��
s�#Bc��|j�j|j�}||jD��cgc]\}}}|��
c}}vScc}}wrk)rcr<r5rl)ror=r�r}s    r6�__contains__zHeaders.__contains__ZsC���Y�Y�[�'�'��
�
�6�
��4�:�:�>�:�i�a��a�c�:�>�>�>��>s�
Ac�4�t|j��Srk)�iterrr�s r6�__iter__zHeaders.__iter__^s���D�I�I�K� � r?c�,�t|j�Srk)�lenrlr�s r6�__len__zHeaders.__len__as���4�:�:��r?c��	t|�}|jD���cgc]
\}}}||f��}}}}|jD���cgc]
\}}}||f��}}}}t|�t|�k(S#t$rYywxYwcc}}}wcc}}}w)NF)r,rXrl�sorted)ro�other�
other_headersr}r=rD�	self_list�
other_lists        r6�__eq__zHeaders.__eq__ds���	�#�E�N�M�8<�z�z�B�z�m�a��e�c�5�\�z�	�B�8E�8K�8K�L�8K�}�q�#�u�s�E�l�8K�
�L��i� �F�:�$6�6�6���	��	��C��Ls�A*�A9�B�*	A6�5A6c�"�|jj}d}|jdk7rd|j��}tt	|j���}t
|�}t|�t|�k(}|r
|�d|�|�d�S|�d|�|�d�S)NrRr9z, encoding=�(�))�	__class__�__name__r5rmrhr��dictr�)ro�
class_name�encoding_str�as_list�as_dict�no_duplicate_keyss      r6�__repr__zHeaders.__repr__ns����^�^�,�,�
����=�=�G�#�(����(9�:�L��3�D�4D�4D�4F�G�H���w�-����L�C��L�8��� �\��7�+�l�^�1�=�=���Q�w�k�,��q�9�9r?�NN)rp�HeaderTypes | Noner5�
str | None�return�None�r�rA�rDrAr�r�)r�zlist[tuple[bytes, bytes]])r�ztyping.KeysView[str])r�ztyping.ValuesView[str])r�ztyping.ItemsView[str, str])r�zlist[tuple[str, str]]rk)r=rAr��
typing.Anyr�r�)F)r=rAr��boolr�z	list[str])rpr�r�r�)r�r,)r=rAr�rA�r=rArDrAr�r�)r=rAr�r�)r=r�r�r�)r�ztyping.Iterator[typing.Any]�r��int)r�r�r�r�)r��
__module__�__qualname__�__doc__rs�propertyr5�setterrvrr�rer�r�r�r�r�r�r�r�r�r�r�r�r��r?r6r,r,�s����'+�#�"�#�"��"�
�	"�,����0�_�_�����F��F�X�	$�
#�	
���,)�5��(@�0 �$?�!��7�
:r?r,c
��eZdZdddddddddd�																								dd�Zdd�Zed
d��Zd
d�Zd
d�Zdd�Z	dd	�Z
dd
�Zy)r-N)	r]rp�cookies�content�data�files�json�stream�
extensionsc	�0�|j�|_|�t|�nt||��|_t	|�|_|�in
t
|�|_|rt|�j|�|
��|j
jd�}t||||	t|r%|j|j
j�nd����\}}
|j|�|
|_t#|
t$�r|j'�yy|
|_y)N)r]rG)rM)r�r�r�r��boundary)�upper�methodr(rSr,rpr�r�r+�set_cookie_headerr�r
rr<r5�_preparer�r:r�read)
ror�rSr]rpr�r�r�r�r�r�r�rMs
             r6rszRequest.__init__s����l�l�n���%�~�3�s�8�3�s�6�3J����w�'��� *� 2�"��Z�8H�����G��.�.�t�4��>�'+�|�|�'7�'7��'G�L�,�����A�#�".�!4�!4�T�\�\�5J�5J�!K���
�O�G�V�
�M�M�'�"� �D�K��&�*�-��	�	��.�"!�D�Kr?c��|j�D]C\}}|j�dk(rd|jvr�(|jj||��Eg}d|jv}d|jvxsd|jv}|s=|jj
r'|j
d|jjf�|s|jdvr|j
d�t||jjz�|_y)N�transfer-encodingzContent-Length�HostzTransfer-EncodingsHost)�POST�PUT�PATCH)sContent-Length�0)rercrp�
setdefaultrS�hostrY�netlocr�r,rv)ro�default_headersr=rD�auto_headers�has_host�has_content_lengths       r6r�zRequest._prepare�s���)�/�/�1�J�C���y�y�{�1�1�6F�$�,�,�6V���L�L�#�#�C��/�	2�35���T�\�\�)������,�S�0C�t�|�|�0S�	��D�H�H�M�M�����$�(�(�/�/� :�;�!�d�k�k�5M�&M���� 9�:��|�d�l�l�.>�.>�>�?��r?c�F�t|d�s
t��|jS�N�_content)�hasattrrr�r�s r6r�zRequest.content�s���t�Z�(� �"�"��}�}�r?c�&�t|d�szt|jtj�sJ�dj|j�|_t|jt�st|j�|_|jS)�6
        Read and return the request content.
        r�r?)r�r:r��typing�Iterabler�r�rr�s r6r�zRequest.read�sd���t�Z�(��d�k�k�6�?�?�;�;�;��H�H�T�[�[�1�D�M��d�k�k�:�6�)����7����}�}�r?c��jK�t|d�sMt|jtj�sJ�dj|j2�cgc3d{���}|��|jS7�6ncc}wc}�|_t|jt�r�<t|j�|_�W�w)rr�r?N)r�r:r�r�
AsyncIterabler�r�r�ro�parts  r6�areadz
Request.aread�s������t�Z�(��d�k�k�6�+?�+?�@�@�@��H�H�T�[�[�%I�%I�T�d��}�}��
&J��%I��%I�J�D�M��d�k�k�:�6�)����7���sB�AB3�A,�A*
�A(�A*
�A,�B3�(A*
�*A,�+,B3�B3c��|jj}t|j�}d|�d|j�d|�d�S)N�<r�r�z)>)r�r�rArSr�)ror�rSs   r6r�zRequest.__repr__�s=���^�^�,�,�
��$�(�(�m���:�,�a�����b���r�:�:r?c�r�|jj�D��cic]\}}|dvr||��c}}Scc}}w)N)r�r���__dict__re�ro�namerDs   r6�__getstate__zRequest.__getstate__�sG�� $�}�}�2�2�4�
�4���e��3�3�
�%�K�4�
�	
��
��3c�z�|j�D]\}}t|||��i|_t�|_yrk)re�setattrr�r	r��ro�staterrDs    r6�__setstate__zRequest.__setstate__�s3�� �;�;�=�K�D�%��D�$��&�)����&�(��r?)r�rArSz	URL | strr]zQueryParamTypes | Nonerpr�r��CookieTypes | Noner�zRequestContent | Noner�zRequestData | Noner�zRequestFiles | Noner�ztyping.Any | Noner��'SyncByteStream | AsyncByteStream | Noner�zRequestExtensions | Noner�r��r�zdict[str, str]r�r��r�r;r��r��dict[str, typing.Any]�rrr�r�)r�r�r�rsr�r�r�r�rr�rrr�r?r6r-r-~s���*.�&*�&*�)-�#'�%)�"&�:>�/3�8!��8!��8!�
'�8!�$�
8!�$�8!�'�8!�!�8!�#�8!� �8!�8�8!�-�8!�
�8!�t@�*����
��;�

�)r?r-c���eZdZddddddddddd�
																							d.d�Zd/d�Zed0d��Zejd1d��Zed2d��Zejd3d	��Zed4d
��Z	ed4d��Z
ed5d��Zed6d
��Zed4d��Z
ed7d��Zejd8d��Zed7d��Zd9d�Zed:d��Zed:d��Zed:d��Zed:d��Zed:d��Zed:d��Zed:d��Zd;d�Zd<d�Zed=d��Zed>d��Zed?d��Zd4d�Zd@d �ZdAd!�Zd6d"�Z dBdCd#�Z!dBdDd$�Z"dEd%�Z#dBdCd&�Z$dFd'�Z%d6d(�Z&	dB			dGd)�Z'	dB			dHd*�Z(dId+�Z)	dB			dGd,�Z*dFd-�Z+y)Jr.Nru)
rpr��text�htmlr�r��requestr��history�default_encodingc
��||_t|�|_||_d|_|	�in
t|	�|_|
�gn
t|
�|_d|_	d|_
||_|�Qt||||�\}}|j|�||_t|t �r|j#�d|_y||_d|_y)NFr)�status_coder,rp�_request�next_requestr�r�rmr"�	is_closed�is_stream_consumedr#rr�r�r:rr��_num_bytes_downloaded)ror%rpr�rr r�r�r!r�r"r#s            r6rszResponse.__init__s���'����w�'���(/��
�-1��� *� 2�"��Z�8H���$�_�r�$�w�-������"'��� 0����>�-�g�t�T�4�H�O�G�V��M�M�'�"� �D�K��&�*�-��	�	��&'��"�!�D�K�%&��"r?c��|j�D]C\}}|j�dk(rd|jvr�(|jj||��Ey)Nr�zcontent-length)rercrpr�)ror�r=rDs    r6r�zResponse._prepare;sK��)�/�/�1�J�C���y�y�{�1�1�6F�$�,�,�6V���L�L�#�#�C��/�	2r?c�H�t|d�std��|jS)ze
        Returns the time taken for the complete request/response
        cycle to complete.
        �_elapsedzK'.elapsed' may only be accessed after the response has been read or closed.)r��RuntimeErrorr-r�s r6�elapsedzResponse.elapsedBs,���t�Z�(��+��
��}�}�r?c��||_yrk)r-)ror/s  r6r/zResponse.elapsedOs	����
r?c�H�|j�td��|jS)zR
        Returns the request instance associated to the current response.
        z7The request instance has not been set on this response.)r&r.r�s r6r!zResponse.requestSs*��
�=�=� ��I��
��}�}�r?c��||_yrk)r&rzs  r6r!zResponse.request^s	����
r?c�f�	|jd}|jdd��S#t$rYywxYw)N�http_versionr9�ignore��errorszHTTP/1.1)r�rwr�)ror4s  r6r4zResponse.http_versionbsB��	A�"&�/�/�.�"A�L� �&�&�w�x�&�@�@���	��	�s�$�	0�0c��	|jd}|jdd��S#t$r"tj|j
�cYSwxYw)N�
reason_phraser9r5r6)r�rwr�r�get_reason_phraser%)ror9s  r6r9zResponse.reason_phraseksV��	B�#'�?�?�?�#C�M�!�'�'���'�A�A���	=��*�*�4�+;�+;�<�<�	=�s�$�(A�Ac�.�|jjS)zA
        Returns the URL for which the request was made.
        )r!rSr�s r6rSzResponse.urlts��
�|�|���r?c�F�t|d�s
t��|jSr�)r�rr�r�s r6r�zResponse.content{s���t�Z�(�!�#�#��}�}�r?c�&�t|d�sz|j}|sd|_|jSt|jxsd��}dj|j
|j�|j�g�|_|jS)N�_textrRrur4)r�r�r>rr5r�rw�flush)ror��decoders   r6rz
Response.text�sr���t�W�%��l�l�G����
��z�z��&�t�}�}�/G��H���W�W�g�n�n�T�\�\�&B�G�M�M�O�%T�U��
��z�z�r?c��t|d�sr|j}|�t|�sNt|jt
�r
|j}n't|d�r|j	|j�}|xsd|_|jS)a�
        Return an encoding to use for decoding the byte content into text.
        The priority for determining this is given by...

        * `.encoding = <>` has been set explicitly.
        * The encoding as specified by the charset parameter in the Content-Type header.
        * The encoding as determined by `default_encoding`, which may either be
          a string like "utf-8" indicating the encoding to use, or may be a callable
          which enables charset autodetection.
        rnr�ru)r��charset_encodingr7r:r#rAr�rn)ror5s  r6r5zResponse.encoding�sv���t�[�)��,�,�H���'9�(�'C��d�3�3�S�9�#�4�4�H��T�:�.�#�4�4�T�]�]�C�H�%�0��D�N��~�~�r?c�@�t|d�rtd��||_y)z�
        Set the encoding to use for decoding the byte content into text.

        If the `text` attribute has been accessed, attempting to set the
        encoding will throw a ValueError.
        r>z?Setting encoding after `text` has been accessed is not allowed.N)r�rXrnrzs  r6r5zResponse.encoding�s'���4��!��Q��
���r?c�T�|jjd�}|�yt|�S)zO
        Return the encoding, as specified by the Content-Type header.
        zContent-TypeN)rpr�rO)rorMs  r6rBzResponse.charset_encoding�s,��
�|�|�'�'��7�����*�<�8�8r?c���t|d�s�g}|jjdd��}|D]@}|j�j	�}	t
|}|j
|���Bt|�dk(r|d|_	|jSt|�dkDrt|��|_	|jSt�|_	|jS#t$rY��wxYw)z�
        Returns a decoder instance which can be used to decode the raw byte
        content, depending on the Content-Encoding used in the response.
        �_decoderzcontent-encodingT)r�rr)�children)r�rpr�rUrcrrYr�r�rFrr)ro�decodersr�rD�decoder_clss     r6�_get_content_decoderzResponse._get_content_decoder�s���
�t�Z�(�-/�H��\�\�*�*�+=�D�*�Q�F������
�+�+�-���"4�U�";�K��O�O�K�M�2�	 ��8�}��!� (����
��}�}���X���"� ,�h� ?��
��}�}��!0� 1��
��}�}��� ����s�C�	C'�&C'c�@�tj|j�S)zU
        A property which is `True` for 1xx status codes, `False` otherwise.
        )r�is_informationalr%r�s r6rLzResponse.is_informational�s��
�%�%�d�&6�&6�7�7r?c�@�tj|j�S)zU
        A property which is `True` for 2xx status codes, `False` otherwise.
        )r�
is_successr%r�s r6rNzResponse.is_success�s��
���� 0� 0�1�1r?c�@�tj|j�S)a
        A property which is `True` for 3xx status codes, `False` otherwise.

        Note that not all responses with a 3xx status code indicate a URL redirect.

        Use `response.has_redirect_location` to determine responses with a properly
        formed URL redirection.
        )r�is_redirectr%r�s r6rPzResponse.is_redirect�s��� � ��!1�!1�2�2r?c�@�tj|j�S)zU
        A property which is `True` for 4xx status codes, `False` otherwise.
        )r�is_client_errorr%r�s r6rRzResponse.is_client_error����
�$�$�T�%5�%5�6�6r?c�@�tj|j�S)zU
        A property which is `True` for 5xx status codes, `False` otherwise.
        )r�is_server_errorr%r�s r6rUzResponse.is_server_error�rSr?c�@�tj|j�S)z]
        A property which is `True` for 4xx and 5xx status codes, `False` otherwise.
        )r�is_errorr%r�s r6rWzResponse.is_error�s��
�~�~�d�.�.�/�/r?c���|jtjtjtjtj
tjfvxrd|jvS)zs
        Returns True for 3xx responses with a properly formed URL redirection,
        `False` otherwise.
        �Location)r%r�MOVED_PERMANENTLY�FOUND�	SEE_OTHER�TEMPORARY_REDIRECT�PERMANENT_REDIRECTrpr�s r6�has_redirect_locationzResponse.has_redirect_locationsZ��
����'�'��������(�(��(�(��
�

+��d�l�l�*�	
r?c��|j}|�td��|jr|S|jrd}nd}|jdz}ddddd	�}|j|d
�}|j
||��}t|||���)
z>
        Raise the `HTTPStatusError` if one occurred.
        zYCannot call `raise_for_status` as the request instance has not been set on this response.z�{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'
Redirect location: '{0.headers[location]}'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}z�{error_type} '{0.status_code} {0.reason_phrase}' for url '{0.url}'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/{0.status_code}�dzInformational responsezRedirect responsezClient errorzServer error)r���zInvalid status code)�
error_type)r!�response)r&r.rNr_r%r��formatr)ror!rJ�status_class�error_typesres      r6�raise_for_statuszResponse.raise_for_statuss����-�-���?��>��
�
�?�?��K��%�%�w�
�w�
�
�'�'�3�.��'�"���	
��!�_�_�\�3H�I�
��.�.��*�.�=���g�w��F�Fr?c�B�tj|jfi|��Srk)�jsonlib�loadsr�)ro�kwargss  r6r�z
Response.json?s���}�}�T�\�\�4�V�4�4r?c��t|d�s*t�|_|jj|�|jS)N�_cookies)r�r+rp�extract_cookiesr�s r6r�zResponse.cookiesBs1���t�Z�(�#�I�D�M��M�M�)�)�$�/��}�}�r?c���|jjd�}|�iSt|�D�cic]'}|jd�xs|jd�|��)c}Scc}w)zI
        Returns the parsed header links of the response, if any
        r^�relrS)rpr�r`)ro�headerr^s   r6rZzResponse.linksIsh��
���!�!�&�)���>��I�,�F�3�
�3���X�X�e�_�
/������$�
6�3�
�	
��
s�,Ac��|jSrk)r*r�s r6�num_bytes_downloadedzResponse.num_bytes_downloadedWs���)�)�)r?c�<�d|j�d|j�d�S)Nz<Response [� �]>)r%r9r�s r6r�zResponse.__repr__[s%���T�-�-�.�a��0B�0B�/C�2�F�Fr?c�r�|jj�D��cic]\}}|dvr||��c}}Scc}}w)N)r�r�r(rFrrs   r6rzResponse.__getstate__^sG�� $�}�}�2�2�4�
�4���e��L�L�
�%�K�4�
�	
��
rc��|j�D]\}}t|||��d|_i|_t	�|_y)NT)rerr(r�r	r�rs    r6rzResponse.__setstate__es:�� �;�;�=�K�D�%��D�$��&�)�������&�(��r?c�z�t|d�s$dj|j��|_|jS)�7
        Read and return the response content.
        r�r?)r�r��
iter_bytesr�r�s r6r�z
Response.readls/���t�Z�(��H�H�T�_�_�%6�7�D�M��}�}�r?c#�tK�t|d�r]|�t|j�n|}tdt|j�t	|d��D]}|j|||z���y|j�}t
|��}t|j��5|j�D]-}|j|�}|j|�D]}|����/|j�}|j|�D]}|���|j�D]}|���	ddd�y#1swYyxYw�w�z�
        A byte-iterator over the decoded response content.
        This allows us to handle gzip, deflate, brotli, and zstd encoded responses.
        r�Nrr��
chunk_size�r!)r�r�r��range�maxrJr
rr&�iter_rawrwr?�ror��ir@�chunker�	raw_bytes�decoded�chunks        r6r~zResponse.iter_bytests����
�4��$�/9�/A��T�]�]�+�z�J��1�c�$�-�-�0�#�j�!�2D�E���m�m�A��J��7�7�F��/�/�1�G�!�Z�8�G� ����7�!%����I�%�n�n�Y�7�G�!(����!8��#��"9�"1�"�-�-�/��$�^�^�G�4�E��K�5�$�]�]�_�E��K�-�8�7�7�s�BD8�BD,�#	D8�,D5�1D8c#�K�t|jxsd��}t|��}t|j��5|j�D]-}|j
|�}|j
|�D]}|����/|j�}|j
|�D]}|���|j�D]}|���	ddd�y#1swYyxYw�w�z�
        A str-iterator over the decoded response content
        that handles both gzip, deflate, etc but also detects the content's
        string encoding.
        rur4r�r�N)rr5rrr&r~rwr?�ror�r@r��byte_content�text_contentr�s       r6�	iter_textzResponse.iter_text�s������t�}�}�'?��@����4��
�T�]�]�
3� $��� 1��&�~�~�l�;��$�^�^�L�9�E��K�:�!2�#�=�=�?�L� ����5����6� �������)�4�
3�
3�s�=C�BC
�	C�
C�Cc#�K�t�}t|j��5|j�D]}|j	|�D]}|����|j�D]}|���	ddd�y#1swYyxYw�w�Nr�)rrr&r�rwr?�ror@r�lines    r6�
iter_lineszResponse.iter_lines�sd�����-��
�T�]�]�
3����(��#�N�N�4�0�D��J�1�)� �
�
����
�(�	4�
3�
3�s�!B�A	A6�-	B�6A?�;Bc#�K�|jr
t��|jr
t��t	|j
t�std��d|_d|_t|��}t|j��5|j
D]:}|xjt|�z
c_|j|�D]}|����<	ddd�|j�D]}|���|j�y#1swY�3xYw�w)�@
        A byte-iterator over the raw response content.
        z5Attempted to call a sync iterator on an async stream.Trr�r�N)r)rr(rr:r�r'r.r*r
rr&r�rwr?�close�ror�r��raw_stream_bytesr�s     r6r�zResponse.iter_raw�s������"�"� �"�"��>�>��.� ��$�+�+�~�6��V�W�W�"&���%&��"���4��
�T�]�]�
3�$(�K�K� ��*�*�c�2B�.C�C�*�$�^�^�,<�=�E��K�>�%0�4��]�]�_�E��K�%�	
�
�
��4�
3�s�BD
�A
D�2D
�D
�D
c��t|jt�std��|jsAd|_t|j��5|jj�ddd�yy#1swYyxYw)��
        Close the response and release the connection.
        Automatically called if the response body is read to completion.
        z3Attempted to call an sync close on an async stream.Tr�N)r:r�r'r.r(rr&r�r�s r6r�zResponse.close�s\��
�$�+�+�~�6��T�U�U��~�~�!�D�N� ����7����!�!�#�8�7��7�7�s�A4�4A=c��K�t|d�s+dj|j�2�cgc3d{���}|��|jS7�6ncc}wc}�|_�"�w)r}r�r?N)r�r��aiter_bytesr�rs  r6rzResponse.aread�sM�����t�Z�(��H�H�T�=M�=M�=O�%P�%P�T�d��}�}��&Q��%P��%P�Q�D�M�s5�*A�A
�A
�A�A
�A
�A�A
�A
�	Ac�K�t|d�r^|�t|j�n|}tdt|j�t	|d��D]}|j|||z����y|j�}t
|��}t|j��5|j�23d{���}|j|�}|j|�D]}|����	�67�16|j�}|j|�D]}|����	|j�D]}|����		ddd�y#1swYyxYw�wr�)r�r�r�r�r�rJr
rr&�	aiter_rawrwr?r�s        r6r�zResponse.aiter_bytes�s�����4��$�/9�/A��T�]�]�+�z�J��1�c�$�-�-�0�#�j�!�2D�E���m�m�A��J��7�7�F��/�/�1�G�!�Z�8�G� ����7�'+�~�~�'7�$�)�%�n�n�Y�7�G�!(����!8��#��"9�$��'7�"�-�-�/��$�^�^�G�4�E��K�5�$�]�]�_�E��K�-�8�7�7�sC�BE�D8�0C(�4C&�5C(�8.D8�&C(�(AD8�/	E�8E�=Ec��K�t|jxsd��}t|��}t|j��5|j�23d{���}|j
|�}|j
|�D]}|����	�67�16|j�}|j
|�D]}|����	|j�D]}|����		ddd�y#1swYyxYw�wr�)rr5rrr&r�rwr?r�s       r6�
aiter_textzResponse.aiter_text�s������t�}�}�'?��@����4��
�T�]�]�
3�&*�&6�&6�&8�
 �l�&�~�~�l�;��$�^�^�L�9�E��K�:�
 ��&8�#�=�=�?�L� ����5����6� �������)�4�
3�
3�sA�=C$�C�B�B�B�.C�B�AC�	C$�C!�C$c�K�t�}t|j��5|j�23d{���}|j	|�D]}|����	�%7� 6|j�D]}|����		ddd�y#1swYyxYw�wr�)rrr&r�rwr?r�s    r6�aiter_lineszResponse.aiter_linessm�����-��
�T�]�]�
3�"�o�o�/�
�d�#�N�N�4�0�D��J�1�
��/� �
�
����
�(�	4�
3�
3�s<�!B�B�A�A�A�B�A�B�7	B�B	�Bc�FK�|jr
t��|jr
t��t	|j
t�std��d|_d|_t|��}t|j��5|j
23d{���}|xjt|�z
c_|j|�D]}|����	�C7�>6	ddd�n#1swYnxYw|j�D]}|����	|j��d{���7y�w)r�z6Attempted to call an async iterator on an sync stream.Trr�r�N)r)rr(rr:r�rr.r*r
rr&r�rwr?�acloser�s     r6r�zResponse.aiter_raw
s������"�"� �"�"��>�>��.� ��$�+�+��7��W�X�X�"&���%&��"���4��
�T�]�]�
3�*.�+�+�
 �&��*�*�c�2B�.C�C�*�$�^�^�,<�=�E��K�>�
 ��+�4�
3�
3���]�]�_�E��K�%��k�k�m���sN�BD!�
C!�C�C�C�;C!�C�C!�	D!�!C*�&4D!�D�D!c��K�t|jt�std��|jsId|_t|j��5|jj��d{���ddd�yy7�#1swYyxYw�w)r�z3Attempted to call an async close on an sync stream.Tr�N)r:r�rr.r(rr&r�r�s r6r�zResponse.aclose)sm����
�$�+�+��7��T�U�U��~�~�!�D�N� ����7��k�k�(�(�*�*�*�8�7��+��8�7�s0�AB�B�/A>�0B�4
B�>B�B	�B)r%r�rpr�r�zResponseContent | Nonerr�r r�r�r�r�rr!zRequest | Noner�zResponseExtensions | Noner"zlist[Response] | Noner#z#str | typing.Callable[[bytes], str]r�r�r)r��datetime.timedelta)r/r�r�r�)r�r-)rDr-r�r�r�)r�r(r)r�r�r�)r�r�r�r�)r�r.)rnr�r�r�)r�r+)r�z dict[str | None, dict[str, str]]r�rrrk)r��
int | Noner�ztyping.Iterator[bytes])r�r�r��typing.Iterator[str]�r�r�)r�r�)r�r�r�ztyping.AsyncIterator[bytes])r�r�r��typing.AsyncIterator[str])r�r�),r�r�r�rsr�r�r/r�r!r4r9rSr�rr5rBrJrLrNrPrRrUrWr_rjr�r�rZrvr�rrr�r~r�r�r�r�rr�r�r�r�r�r�r?r6r.r.s��
'+�*.����:>�"&�04�)-�@G�5'��5'�$�	5'�
(�5'��
5'��5'��5'�8�5'� �5'�.�5'�'�5'�>�5'�
�5'�n0��
��
�
�^�^� �� �����
�^�^�����A��A��B��B�� �� �����
��������*�_�_�����9��9��2�8��8��2��2��	3��	3��7��7��7��7��0��0��
��
�,#G�J5������
��
��*��*�G�
�)�� �.�&��4$��(,� �$� �	$� �4(,��$��	"��*�(,��$��	$��8+r?r.c��eZdZdZddd�Zdd�Zdd�Zddd�Z			d									dd�Z		d							dd�Z	dd d	�Z
ddd
�Zd!d�Zd"d�Z
d#d
�Zd$d�Zd%d�Zd&d�Zd'd�ZGd�dej(j*�ZGd�d�Zy)(r+z-
    HTTP Cookies, as a mutable mapping.
    Nc���|�t|t�rKt�|_t|t�r+|j	�D]\}}|j||��yyt|t�r,t�|_|D]\}}|j||��yt|t�r<t�|_|jD]}|jj|��y||_yrk)	r:r�r�jarre�setrmr+�
set_cookie)ror�r=rD�cookies     r6rszCookies.__init__<s����?�j��$�7� �{�D�H��'�4�(�")�-�-�/�J�C���H�H�S�%�(�#2�)����
&� �{�D�H�%�
��U�����e�$�&�
���
)� �{�D�H�!�+�+�����#�#�F�+�&��D�Hr?c��|j|�}|j|j�}|jj	||�y)zO
        Loads any cookies based on the response `Set-Cookie` headers.
        N)�_CookieCompatResponse�_CookieCompatRequestr!r�rq)rorf�urllib_response�urllib_requests    r6rqzCookies.extract_cookiesMs>���4�4�X�>���2�2�8�3C�3C�D����� � ��.�Ar?c�\�|j|�}|jj|�y)zM
        Sets an appropriate 'Cookie:' HTTP header on the `Request`.
        N)r�r��add_cookie_header)ror!r�s   r6r�zCookies.set_cookie_headerVs&���2�2�7�;�����"�"�>�2r?c��idd�d|�d|�dd�dd�d	|�d
t|��d|jd��d
|�dt|��dd�dd�dd�dd�dd�dddi�dd�}tdi|��}|jj	|�y)zU
        Set a cookie value by name. May optionally include domain and path.
        �versionrrrD�portN�port_specifiedF�domain�domain_specified�domain_initial_dot�.�path�path_specified�secure�expires�discardT�comment�comment_url�rest�HttpOnly�rfc2109r�)r��
startswithrr�r�)rorrDr�r�rnr�s       r6r�zCookies.set]s
��
��q�
��D�
�
�U�
�
�D�	
�

�e�
�
�f�

�
��V��
�
!�&�"3�"3�C�"8�
�
�D�
�
�d�4�j�
�
�e�
�
�t�
�
�t�
�
�t�
�
�4�
� 
�Z��&�!
�"
�u�#
��&�!�&�!�������F�#r?c���d}|jD]T}|j|k(s�|�|j|k(s�%|�|j|k(s�7|�d|��}t	|��|j
}�V|�|S|S)z�
        Get a cookie by name. May optionally include domain and path
        in order to specify exactly which cookie to retrieve.
        Nz!Multiple cookies exist with name=)r�rr�r�rrD)rorr�r�r�rDr�rJs        r6r�zCookies.getwsz�����h�h�F��{�{�d�"��>�V�]�]�f�%<��|�v�{�{�d�':� �,�(I�$��&P�G�"0��"9�9� &������=��N��r?c�h�|�|�|jj|||�S|jD�cgc]5}|j|k(r$|�|j|k(r|�|j|k(r|��7}}|D]=}|jj|j|j|j��?ycc}w)z�
        Delete a cookie by name. May optionally include domain and path
        in order to specify exactly which cookie to delete.
        N)r��clearrr�r�)rorr�r�r��removes      r6�deletezCookies.delete�s�����$�"2��8�8�>�>�&�$��5�5��(�(�
�"���{�{�d�"���6�=�=�F�#:�������!4�	
�"�	�
��F��H�H�N�N�6�=�=�&�+�+�v�{�{�C���
s�:B/c��g}|�|j|�|�|�J�|j|�|jj|�y)z�
        Delete all cookies. Optionally include a domain and path in
        order to only delete a subset of all the cookies.
        N)rYr�r�)ror�r��argss    r6r�z
Cookies.clear�sK��
�����K�K������%�%�%��K�K����������r?c�r�t|�}|jD]}|jj|��yrk)r+r�r�)ror�r�s   r6r�zCookies.update�s,���'�"���k�k�F��H�H����'�"r?c�&�|j||�Srk)r�rs   r6r�zCookies.__setitem__�s���x�x��e�$�$r?c�B�|j|�}|�t|��|Srk)r�r�rs   r6r�zCookies.__getitem__�s#���������=��4�.� ��r?c�$�|j|�Srk)r�)rors  r6r�zCookies.__delitem__�s���{�{�4� � r?c�,�t|j�Srk)r�r�r�s r6r�zCookies.__len__�s���4�8�8�}�r?c�(�d�|jD�S)Nc3�4K�|]}|j���y�wrk)r)�.0r�s  r6�	<genexpr>z#Cookies.__iter__.<locals>.<genexpr>�s����3�(�����(�s��r�r�s r6r�zCookies.__iter__�s��3�$�(�(�3�3r?c�(�|jD]}yy)NTFr�)ror}s  r6�__bool__zCookies.__bool__�s�����A���r?c��dj|jD�cgc],}d|j�d|j�d|j�d���.c}�}d|�d�Scc}w)Nr�z<Cookie rTz for z />z	<Cookies[ry)r�r�rrDr�)ror��cookies_reprs   r6r�zCookies.__repr__�sh���y�y�#�h�h�
�&�F��6�;�;�-�q�����e�F�M�M�?�#�N�&�
�
���<�.��+�+��

s�1Ac�0��eZdZdZd�fd�Zd�fd�Z�xZS)�Cookies._CookieCompatRequest��
        Wraps a `Request` instance up in a compatibility interface suitable
        for use with `CookieJar` operations.
        c���t�|�t|j�t	|j
�|j��||_y)N)rSrpr�)�superrsrArSr�rpr�r!)ror!r�s  �r6rsz%Cookies._CookieCompatRequest.__init__�s=����G������$��W�_�_�-��~�~�
�
�
#�D�Lr?c�X��t�|�||�||jj|<yrk)r��add_unredirected_headerr!rp)ror=rDr�s   �r6r�z4Cookies._CookieCompatRequest.add_unredirected_header�s&����G�+�C��7�(-�D�L�L� � ��%r?�r!r-r�r�r�)r�r�r�r�rsr��
__classcell__)r�s@r6r�r��s���	�
	#�	.�	.r?r�c� �eZdZdZdd�Zdd�Zy)�Cookies._CookieCompatResponser�c��||_yrk)rf)rorfs  r6rsz&Cookies._CookieCompatResponse.__init__�s	��$�D�Mr?c��tjj�}|jjj�D]
\}}|||<�|Srk)rIrJrKrfrpr�)ro�infor=rDs    r6r�z"Cookies._CookieCompatResponse.info�sH���=�=�(�(�*�D�"�m�m�3�3�?�?�A�
��U�"��S�	�	B�
�Kr?N�rfr.r�r�)r�zemail.message.Message)r�r�r�r�rsr�r�r?r6r�r��s��	�
	%�	r?r�rk)r�rr�r�r�r�)rR�/)
rrArDrAr�rAr�rAr�r�)NNN)
rrAr�r�r�r�r�r�r�r�r�)rrAr�r�r�r�r�r�)r�r�r�r�r�r�)rrArDrAr�r�)rrAr�rA)rrAr�r�r�r�r�r�)r�r�r�r�rsrqr�r�r�r�r�r�r�r�r�r�r�r�r��urllibr!r-r�r�r�r?r6r+r+7s�����"B�3�$�:#�!��������	�
��
�
�8"��	D��D��D��	D�

�D�0�(�
%��!��4��
,�.�v�~�~�5�5�.�$�r?r+)r5rAr�r�rk)r=�str | bytesr5r�r�r;)rDr�r5r�r�r;)rMrAr�r�)rDrAr�zlist[dict[str, str]])rez4typing.Iterable[tuple[typing.AnyStr, typing.AnyStr]]r�z4typing.Iterator[tuple[typing.AnyStr, typing.AnyStr]])J�
__future__rr1�datetime�
email.messagerIr�rlrVr�urllib.requestr��collections.abcr�http.cookiejarrrr�rr	r
r�	_decodersrr
rrrrrr�_exceptionsrrrrrrr�
_multipartr�
_status_codesr�_typesrrrr r!r"r#r$r%r&r'�_urlsr(�_utilsr)r*�__all__rdr7r>rErOr`rh�MutableMappingrAr,r-r.r+r�r?r6�<module>rs��"�
����	�
��#�,�S�S�	�	�	����A� ������+�
7��$�&;�<���N�-�1�"�J�?��9��p:�f�#�#�C��H�-�p:�fB)�B)�Jq+�q+�hF�f�#�#�C��H�-�Fr?