← back to Atmos Game

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

332 lines

�

c�bj.T���ddlmZddlZddlmZmZmZddlZddlm	Z	ddl
mZddlm
Z
dd	gZGd
�d�ZGd�d	ej eef�Zy)�)�annotationsN)�parse_qs�unquote�	urlencode�)�QueryParamTypes)�urlparse)�primitive_value_to_str�URL�QueryParamsc��eZdZdZdd d�Zed!d��Zed"d��Zed"d��Zed!d��Z	ed!d��Z
ed!d��Zed"d	��Zed#d
��Z
ed"d��Zed!d��Zed"d
��Zed$d��Zed"d��Zed!d��Zed%d��Zed%d��Zd&d�Zd'd(d�Zd'd(d�Zd)d�Zd*d�Zd+d�Zd,d�Zd-d�Zd!d�Zd!d�Zed.d��Z y)/ru(

    url = httpx.URL("HTTPS://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink")

    assert url.scheme == "https"
    assert url.username == "jo@email.com"
    assert url.password == "a secret"
    assert url.userinfo == b"jo%40email.com:a%20secret"
    assert url.host == "müller.de"
    assert url.raw_host == b"xn--mller-kva.de"
    assert url.port == 1234
    assert url.netloc == b"xn--mller-kva.de:1234"
    assert url.path == "/pa th"
    assert url.query == b"?search=ab"
    assert url.raw_path == b"/pa%20th?search=ab"
    assert url.fragment == "anchorlink"

    The components of a URL are broken down like this:

       https://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink
    [scheme]   [  username  ] [password] [ host ][port][ path ] [ query ] [fragment]
               [       userinfo        ] [   netloc   ][    raw_path    ]

    Note that:

    * `url.scheme` is normalized to always be lowercased.

    * `url.host` is normalized to always be lowercased. Internationalized domain
      names are represented in unicode, without IDNA encoding applied. For instance:

      url = httpx.URL("http://中国.icom.museum")
      assert url.host == "中国.icom.museum"
      url = httpx.URL("http://xn--fiqs8s.icom.museum")
      assert url.host == "中国.icom.museum"

    * `url.raw_host` is normalized to always be lowercased, and is IDNA encoded.

      url = httpx.URL("http://中国.icom.museum")
      assert url.raw_host == b"xn--fiqs8s.icom.museum"
      url = httpx.URL("http://xn--fiqs8s.icom.museum")
      assert url.raw_host == b"xn--fiqs8s.icom.museum"

    * `url.port` is either None or an integer. URLs that include the default port for
      "http", "https", "ws", "wss", and "ftp" schemes have their port
      normalized to `None`.

      assert httpx.URL("http://example.com") == httpx.URL("http://example.com:80")
      assert httpx.URL("http://example.com").port is None
      assert httpx.URL("http://example.com:80").port is None

    * `url.userinfo` is raw bytes, without URL escaping. Usually you'll want to work
      with `url.username` and `url.password` instead, which handle the URL escaping.

    * `url.raw_path` is raw bytes of both the path and query, without URL escaping.
      This portion is used as the target when constructing HTTP requests. Usually you'll
      want to work with `url.path` instead.

    * `url.query` is raw bytes, without URL escaping. A URL query string portion can
      only be properly URL escaped when decoding the parameter names and values
      themselves.
    c
���|�rttttttttttttd�}|j	�D]�\}}||vr|�d�}t|��|�It
|||�s:||j}t|�j}d|�d|�d|��}t|��t
|t�s�v|jd�||<��d|vr,|jd�}	|	sdntt|	��|d<t
|t�rt|fi|��|_
yt
|t�r"|jjdi|��|_
ytd	t|��d
|����)N)�scheme�username�password�userinfo�host�port�netloc�path�query�raw_path�fragment�paramsz) is an invalid keyword argument for URL()z	Argument z	 must be z	 but got �asciirrz6Invalid type for url.  Expected str or httpx.URL, got z: �)�str�bytes�int�object�items�	TypeError�
isinstance�__name__�type�decode�poprr	�_uri_referencer�	copy_with)
�self�url�kwargs�allowed�key�value�message�expected�seenrs
          �b/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpx/_urls.py�__init__zURL.__init__Msq������!������!�� �
�G� %�l�l�n�
��U��g�%�!$��'P�Q�G�#�G�,�,��$�Z��w�s�|�-L�&�s�|�4�4�H���;�/�/�D� )�#��	�(��9�T�F�S�G�#�G�,�,��e�U�+�"'�,�,�w�"7�F�3�K�-��6�!� ���H�-��.4�$�#�k�&�>Q�:R��w���c�3��"*�3�"9�&�"9�D��
��S�
!�">�#�"4�"4�">�">�"H��"H�D�����S�	�{�"�S�G�-��
�c�.�|jjS)zb
        The URL scheme, such as "http", "https".
        Always normalised to lowercase.
        )r(r�r*s r3rz
URL.scheme~s���"�"�)�)�)r5c�L�|jjjd�S)z�
        The raw bytes representation of the URL scheme, such as b"http", b"https".
        Always normalised to lowercase.
        r)r(r�encoder7s r3�
raw_schemezURL.raw_scheme�s!���"�"�)�)�0�0��9�9r5c�L�|jjjd�S)zj
        The URL userinfo as a raw bytestring.
        For example: b"jo%40email.com:a%20secret".
        r)r(rr9r7s r3rzURL.userinfo�s!���"�"�+�+�2�2�7�;�;r5c�h�|jj}t|jd�d�S)zn
        The URL username as a string, with URL decoding applied.
        For example: "jo@email.com"
        �:r�r(rr�	partition�r*rs  r3rzURL.username��0���&�&�/�/���x�)�)�#�.�q�1�2�2r5c�h�|jj}t|jd�d�S)zj
        The URL password as a string, with URL decoding applied.
        For example: "a secret"
        r=�r>r@s  r3rzURL.password�rAr5c�~�|jj}|jd�rtj|�}|S)u%
        The URL host as a string.
        Always normalized to lowercase, with IDNA hosts decoded into unicode.

        Examples:

        url = httpx.URL("http://www.EXAMPLE.org")
        assert url.host == "www.example.org"

        url = httpx.URL("http://中国.icom.museum")
        assert url.host == "中国.icom.museum"

        url = httpx.URL("http://xn--fiqs8s.icom.museum")
        assert url.host == "中国.icom.museum"

        url = httpx.URL("https://[::ffff:192.168.0.1]")
        assert url.host == "::ffff:192.168.0.1"
        zxn--)r(r�
startswith�idnar&)r*rs  r3rzURL.host�s4��(�'�'�,�,���?�?�6�"��;�;�t�$�D��r5c�L�|jjjd�S)uA
        The raw bytes representation of the URL host.
        Always normalized to lowercase, and IDNA encoded.

        Examples:

        url = httpx.URL("http://www.EXAMPLE.org")
        assert url.raw_host == b"www.example.org"

        url = httpx.URL("http://中国.icom.museum")
        assert url.raw_host == b"xn--fiqs8s.icom.museum"

        url = httpx.URL("http://xn--fiqs8s.icom.museum")
        assert url.raw_host == b"xn--fiqs8s.icom.museum"

        url = httpx.URL("https://[::ffff:192.168.0.1]")
        assert url.raw_host == b"::ffff:192.168.0.1"
        r)r(rr9r7s r3�raw_hostzURL.raw_host�s!��(�"�"�'�'�.�.�w�7�7r5c�.�|jjS)a�
        The URL port as an integer.

        Note that the URL class performs port normalization as per the WHATWG spec.
        Default ports for "http", "https", "ws", "wss", and "ftp" schemes are always
        treated as `None`.

        For example:

        assert httpx.URL("http://www.example.com") == httpx.URL("http://www.example.com:80")
        assert httpx.URL("http://www.example.com:80").port is None
        )r(rr7s r3rzURL.port�s���"�"�'�'�'r5c�L�|jjjd�S)z�
        Either `<host>` or `<host>:<port>` as bytes.
        Always normalized to lowercase, and IDNA encoded.

        This property may be used for generating the value of a request
        "Host" header.
        r)r(rr9r7s r3rz
URL.netloc�s!���"�"�)�)�0�0��9�9r5c�L�|jjxsd}t|�S)z�
        The URL path as a string. Excluding the query string, and URL decoded.

        For example:

        url = httpx.URL("https://example.com/pa%20th")
        assert url.path == "/pa th"
        �/)r(rr�r*rs  r3rzURL.path�s$���"�"�'�'�.�3���t�}�r5c�X�|jjxsd}|jd�S)a�
        The URL query string, as raw bytes, excluding the leading b"?".

        This is necessarily a bytewise interface, because we cannot
        perform URL decoding of this representation until we've parsed
        the keys and values into a QueryParams instance.

        For example:

        url = httpx.URL("https://example.com/?filter=some%20search%20terms")
        assert url.query == b"filter=some%20search%20terms"
        �r)r(rr9)r*rs  r3rz	URL.querys)���#�#�)�)�/�R���|�|�G�$�$r5c�@�t|jj�S)zz
        The URL query parameters, neatly parsed and packaged into an immutable
        multidict representation.
        )rr(rr7s r3rz
URL.paramss���4�.�.�4�4�5�5r5c��|jjxsd}|jj�|d|jjzz
}|jd�S)a
        The complete URL path and query string as raw bytes.
        Used as the target when constructing HTTP requests.

        For example:

        GET /users?search=some%20text HTTP/1.1
        Host: www.example.org
        Connection: close
        rL�?r)r(rrr9rMs  r3rzURL.raw_pathsV���"�"�'�'�.�3�����$�$�0��C�$�-�-�3�3�3�3�D��{�{�7�#�#r5c�H�t|jjxsd�S)zk
        The URL fragments, as used in HTML anchors.
        As a string, without the leading '#'.
        rO)rr(rr7s r3rzURL.fragment+s ���t�*�*�3�3�9�r�:�:r5c�p�t|jjxr|jj�S)z�
        Return `True` for absolute URLs such as 'http://example.com/path',
        and `False` for relative URLs such as '/path'.
        )�boolr(rrr7s r3�is_absolute_urlzURL.is_absolute_url3s,���D�'�'�.�.�K�4�3F�3F�3K�3K�L�Lr5c��|jS)z�
        Return `False` for absolute URLs such as 'http://example.com/path',
        and `True` for relative URLs such as '/path'.
        )rVr7s r3�is_relative_urlzURL.is_relative_url?s���'�'�'�'r5c��t|fi|��S)a�
        Copy this URL, returning a new URL with some components altered.
        Accepts the same set of parameters as the components that are made
        available via properties on the `URL` class.

        For example:

        url = httpx.URL("https://www.example.com").copy_with(
            username="jo@gmail.com", password="a secret"
        )
        assert url == "https://jo%40email.com:a%20secret@www.example.com"
        )r)r*r,s  r3r)z
URL.copy_withGs���4�"�6�"�"r5Nc�Z�|j|jj||���S�N)r)r)r�set�r*r.r/s   r3�copy_set_paramzURL.copy_set_paramV�"���~�~�T�[�[�_�_�S�%�%@�~�A�Ar5c�Z�|j|jj||���Sr[)r)r�addr]s   r3�copy_add_paramzURL.copy_add_paramYr_r5c�X�|j|jj|���Sr[)r)r�remove�r*r.s  r3�copy_remove_paramzURL.copy_remove_param\s"���~�~�T�[�[�%7�%7��%<�~�=�=r5c�X�|j|jj|���Sr[)r)r�merge�r*rs  r3�copy_merge_paramszURL.copy_merge_params_s"���~�~�T�[�[�%6�%6�v�%>�~�?�?r5c
�h�ddlm}t|t|�tt|����S)z�
        Return an absolute URL, using this URL as the base.

        Eg.

        url = httpx.URL("https://www.example.com/test")
        url = url.join("/new/path")
        assert url == "https://www.example.com/new/path"
        r)�urljoin)�urllib.parserlrr)r*r+rls   r3�joinzURL.joinbs%��	)��7�3�t�9�c�#�c�(�m�4�5�5r5c�*�tt|��S�N��hashrr7s r3�__hash__zURL.__hash__p����C��I��r5c�r�t|ttf�xr t|�tt|��k(Srp)r#rr�r*�others  r3�__eq__z
URL.__eq__ss)���%�#�s��,�M��T��c�#�e�*�o�1M�Mr5c�,�t|j�Srp)rr(r7s r3�__str__zURL.__str__vs���4�&�&�'�'r5c�h�|j\}}}}}}}d|vr|jd�d�d�}dj|r|�d�ndd|vrd|�d�n||�d|��ndg�}dj|r|j�d�nd|rd|��nd||�d	|��nd|�d
|��ndg�}	|jj
�d|	�d�S)
Nr=rz	:[secure]rO�@�[�]z//rR�#�(�))r(�splitrnr�	__class__r$)
r*rrrrrrr�	authorityr+s
          r3�__repr__zURL.__repr__ys���>B�>Q�>Q�;���$��d�E�8��(�?�"�.�.��-�a�0�1��;�H��G�G�"*�8�*�A���"�d�{�!�D�6����"�.�!�D�6�
�B�
�
�	��g�g�%+�4�;�;�-�q�!��$-�"�Y�K� �2��$�0�!�E�7��b�"*�"6�!�H�:��B�
�
���.�.�)�)�*�!�C�7�!�4�4r5c���ddl}ddl}|jd�|jdgd��}||j|j
|j|j��S)NrzURL.raw is deprecated.�RawURL)r:rHrr)�collections�warnings�warn�
namedtupler:rHrr)r*r�r�r�s    r3�rawzURL.raw�sV�����
�
�.�/��'�'��D�
�������]�]�����]�]�	
�	
r5)rO)r+�	URL | strr,�
typing.Any�return�None�r�r)r�r)r�z
int | None)r�r�r�rU)r,r�r�rrp)r.rr/r�r�r)r.rr�r)rrr�r)r+r�r�r�r�r�rwr�r�rU)r�ztuple[bytes, bytes, int, bytes])!r$�
__module__�__qualname__�__doc__r4�propertyrr:rrrrrHrrrrrrrrVrXr)r^rbrfrjrnrsrxrzr�r�rr5r3rrs���;�z/�b�*��*��:��:��<��<��3��3��3��3�����4�8��8�*�
(��
(��:��:��
��
��%��%� �6��6��$��$� �;��;��	M��	M��(��(�
#�B�B�>�@�6��N�(�5�4�

��

r5c���eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zddd�Z	d d	�Z
dd!d
�Zdd!d�Zd"d�Z
dd#d
�Zd$d�Zd%d�Zd&d�Zd'd�Zd(d�Zd'd�Zd)d�Zd*d�Zd*d�Zdd+d�Zd,d�Zy)-rz0
    URL query parameters, as a multi-dict.
    c�j�t|�dksJd��|r	|rJd��|r|dn|}|�t|ttf�r6t|t�r|j	d�n|}t|d��|_yt|t�r=|jj�D��cic]\}}|t|���c}}|_yi}t|ttf�r/|D])}|j|dg�j|d��+nE|j�D��cic]*\}}|t|ttf�rt|�n|g��,}}}|j�D���cic](\}}t|�|D�cgc]
}t|���c}��*c}}}|_ycc}}wcc}}wcc}wcc}}}w)	NrCzToo many arguments.z'Cannot mix named and unnamed arguments.rrT)�keep_blank_valuesr)�lenr#rrr&r�_dictrr!�list�tuple�
setdefault�appendr
)r*�argsr,r/�k�v�
dict_value�items        r3r4zQueryParams.__init__�s����4�y�1�}�3�3�3�}��V�O�&O�O�$���Q��V���=�J�u�s�E�l�;�-7��u�-E�E�L�L��)�5�E�!�%�4�@�D�J�
��{�
+�16���1B�1B�1D�E�1D���A�!�T�!�W�*�1D�E�D�J�=?�J��%�$���/�
"�D��)�)�$�q�'�2�6�=�=�d�1�g�F�"�!&���
�� -���1��*�Q��u�
�">�t�A�w�Q�C�G� -���'�,�,�.��.�D�A�q��A��!�D�!�$�/��5�!�D�D�.��D�J��/F����E��s$�%F�/F#�%F.�;F)�
F.�)F.c�6�|jj�S)z�
        Return all the keys in the query params.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert list(q.keys()) == ["a", "b"]
        )r��keysr7s r3r�zQueryParams.keys�s���z�z��� � r5c��|jj�D��cic]\}}||d��
c}}j�Scc}}w)a
        Return all the values in the query params. If a key occurs more than once
        only the first item for that key is returned.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert list(q.values()) == ["123", "789"]
        r)r�r!�values�r*r�r�s   r3r�zQueryParams.values�s@��%)�J�J�$4�$4�$6�7�$6�D�A�q��1�Q�4��$6�7�>�>�@�@��7��Ac��|jj�D��cic]\}}||d��
c}}j�Scc}}w)a
        Return all items in the query params. If a key occurs more than once
        only the first item for that key is returned.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert list(q.items()) == [("a", "123"), ("b", "789")]
        r)r�r!r�s   r3r!zQueryParams.items�s@��%)�J�J�$4�$4�$6�7�$6�D�A�q��1�Q�4��$6�7�=�=�?�?��7r�c��g}|jj�D]&\}}|j|D�cgc]}||f��c}��(|Scc}w)z�
        Return all items in the query params. Allow duplicate keys to occur.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert list(q.multi_items()) == [("a", "123"), ("a", "456"), ("b", "789")]
        )r�r!�extend)r*�multi_itemsr�r��is     r3r�zQueryParams.multi_items�sP��.0���J�J�$�$�&�D�A�q�����2��1��A���2�3�'���� 3s�A
Nc�X�||jvr|jt|�dS|S)z�
        Get a value from the query param for a given key. If the key occurs
        more than once, then only the first value is returned.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert q.get("a") == "123"
        r)r�r)r*r.�defaults   r3�getzQueryParams.gets-���$�*�*���:�:�c�#�h�'��*�*��r5c�^�t|jjt|�g��S)z�
        Get all values from the query param for a given key.

        Usage:

        q = httpx.QueryParams("a=123&a=456&b=789")
        assert q.get_list("a") == ["123", "456"]
        )r�r�r�rres  r3�get_listzQueryParams.get_lists"���D�J�J�N�N�3�s�8�R�0�1�1r5c��t�}t|j�|_t|�g|jt	|�<|S)z�
        Return a new QueryParams instance, setting the value of a key.

        Usage:

        q = httpx.QueryParams("a=123")
        q = q.set("a", "456")
        assert q == httpx.QueryParams("a=456")
        )r�dictr�r
r�r*r.r/�qs    r3r\zQueryParams.sets:��
�M���t�z�z�"���3�E�:�;�����C����r5c��t�}t|j�|_|j|�t	|�gz|jt|�<|S)z�
        Return a new QueryParams instance, setting or appending the value of a key.

        Usage:

        q = httpx.QueryParams("a=123")
        q = q.add("a", "456")
        assert q == httpx.QueryParams("a=123&a=456")
        )rr�r�r�r
rr�s    r3razQueryParams.add(sH��
�M���t�z�z�"����J�J�s�O�/E�e�/L�.M�M�����C����r5c��t�}t|j�|_|jjt	|�d�|S)z�
        Return a new QueryParams instance, removing the value of a key.

        Usage:

        q = httpx.QueryParams("a=123")
        q = q.remove("a")
        assert q == httpx.QueryParams("")
        N)rr�r�r'r)r*r.r�s   r3rdzQueryParams.remove7s6��
�M���t�z�z�"���	�����C��H�d�#��r5c�Z�t|�}i|j�|j�|_|S)a\
        Return a new QueryParams instance, updated with.

        Usage:

        q = httpx.QueryParams("a=123")
        q = q.merge({"b": "456"})
        assert q == httpx.QueryParams("a=123&b=456")

        q = httpx.QueryParams("a=123")
        q = q.merge({"a": "456", "b": "789"})
        assert q == httpx.QueryParams("a=456&b=789")
        )rr�)r*rr�s   r3rhzQueryParams.mergeFs,��
����+�T�Z�Z�+�1�7�7�+����r5c�&�|j|dS)Nr�r�res  r3�__getitem__zQueryParams.__getitem__Xs���z�z�#��q�!�!r5c��||jvSrpr�res  r3�__contains__zQueryParams.__contains__[s���d�j�j� � r5c�4�t|j��Srp)�iterr�r7s r3�__iter__zQueryParams.__iter__^s���D�I�I�K� � r5c�,�t|j�Srp)r�r�r7s r3�__len__zQueryParams.__len__as���4�:�:��r5c�,�t|j�Srp)rUr�r7s r3�__bool__zQueryParams.__bool__ds���D�J�J��r5c�*�tt|��Srprqr7s r3rszQueryParams.__hash__grtr5c��t||j�syt|j��t|j��k(S)NF)r#r��sortedr�rvs  r3rxzQueryParams.__eq__js:���%����0���d�&�&�(�)�V�E�4E�4E�4G�-H�H�Hr5c�4�t|j��Srp)rr�r7s r3rzzQueryParams.__str__os����)�)�+�,�,r5c�T�|jj}t|�}|�d|�d�S)Nr�r�)r�r$r)r*�
class_name�query_strings   r3r�zQueryParams.__repr__rs.���^�^�,�,�
��4�y����Q�|�.�a�0�0r5c��td��)NzYQueryParams are immutable since 0.18.0. Use `q = q.merge(...)` to create an updated copy.��RuntimeErrorris  r3�updatezQueryParams.updatews���
@�
�	
r5c��td��)Nz^QueryParams are immutable since 0.18.0. Use `q = q.set(key, value)` to create an updated copy.r�r]s   r3�__setitem__zQueryParams.__setitem__}s���
E�
�	
r5)r��QueryParamTypes | Noner,r�r�r�)r�ztyping.KeysView[str])r�ztyping.ValuesView[str])r�ztyping.ItemsView[str, str])r�zlist[tuple[str, str]]rp)r.r�r�r�r�r�)r.rr�z	list[str])r.rr/r�r�r)r.rr�r)rr�r�r)r.r�r�r)r.r�r�rU)r�ztyping.Iterator[typing.Any]r�r�r�r�)rr�r�r�)r.rr/rr�r�)r$r�r�r�r4r�r�r!r�r�r�r\rardrhr�r�r�r�r�rsrxrzr�r�r�rr5r3rr�sy���$�L	!�
A�
@���	2�
�
�
��$"�!�!�� ��I�
-�1�

�
r5)�
__future__r�typingrmrrrrF�_typesr�	_urlparser	�_utilsr
�__all__r�Mappingrrrr5r3�<module>r�sO��"�
�5�5��#��*��-�
 ��R
�R
�j]
�&�.�.��c��*�]
r5