� K�g.T���ddlmZddlZddlmZmZmZddlZddlm Z ddl m Z ddl m Z dd gZGd �d��ZGd �d ejeef��ZdS) �)� annotationsN)�parse_qs�unquote� urlencode�)�QueryParamTypes)�urlparse��primitive_value_to_str�URL� QueryParamsc��eZdZdZd2d3d �Zed4d ���Zed5d ���Zed5d���Zed4d���Z ed4d���Z ed4d���Z ed5d���Z ed6d���Z ed5d���Zed4d���Zed5d���Zed7d���Zed5d���Zed4d���Zed8d���Zed8d���Zd9d�Zd:d;d#�Zd:d;d$�Zd<d%�Zd=d(�Zd>d)�Zd?d+�Zd@d-�Zd4d.�Zd4d/�ZedAd1���Z d S)Br u( 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. ��url� URL | str�kwargs� typing.Any�return�Nonec �l�|�r9ttttttttttttd� }|���D]�\}}||vr|�d�}t |���|�Qt |||��s;||j}t|��j}d|�d|�d|��}t |���t |t��r|� d��||<��d|vr8|� d��} | sdntt| ����|d<t |t��rt|fi|��|_ dSt |t��r|j jd i|��|_ dSt d 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 �asciir"rz6Invalid 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) �selfrr�allowed�key�value�message�expected�seenr"s �[/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/httpx/_urls.py�__init__z URL.__init__Ms��� �$ S����!������!�� � � �G� %�l�l�n�n� 8� 8� ��U��g�%�%�!$�Q�Q�Q�G�#�G�,�,�,��$�Z��w�s�|�-L�-L�$�&�s�|�4�H���;�;�/�D�S�#�S�S�(�S�S�T�S�S�G�#�G�,�,�,��e�U�+�+�8�"'�,�,�w�"7�"7�F�3�K���6�!�!�  ���H�-�-��.4�"R�$�$�#�k�&�>Q�>Q�:R�:R��w�� �c�3� � � �"*�3�"9�"9�&�"9�"9�D� � � � ��S� !� !� �">�#�"4�">�"H�"H��"H�"H�D� � � ��-��S� � �-�-�%(�-�-��� �r%c��|jjS)zb The URL scheme, such as "http", "https". Always normalised to lowercase. )r0r�r2s r9rz URL.scheme~s�� �"�)�)r;r&c�@�|jj�d��S)z� The raw bytes representation of the URL scheme, such as b"http", b"https". Always normalised to lowercase. r#)r0r�encoder=s r9� raw_schemezURL.raw_scheme�s�� �"�)�0�0��9�9�9r;c�@�|jj�d��S)zj The URL userinfo as a raw bytestring. For example: b"jo%40email.com:a%20secret". r#)r0rr?r=s r9rz URL.userinfo�s�� �"�+�2�2�7�;�;�;r;c�j�|jj}t|�d��d��S)zn The URL username as a string, with URL decoding applied. For example: "jo@email.com" �:r�r0rr� partition�r2rs r9rz URL.username��0�� �&�/���x�)�)�#�.�.�q�1�2�2�2r;c�j�|jj}t|�d��d��S)zj The URL password as a string, with URL decoding applied. For example: "a secret" rC�rDrFs r9rz URL.password�rGr;c�p�|jj}|�d��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--)r0r� startswith�idnar.)r2rs r9rzURL.host�s7��(�'�,�� �?�?�6� "� "� %��;�t�$�$�D�� r;c�@�|jj�d��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#)r0rr?r=s r9�raw_hostz URL.raw_host�s��(�"�'�.�.�w�7�7�7r;� int | Nonec��|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 )r0rr=s r9rzURL.port�s���"�'�'r;c�@�|jj�d��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#)r0rr?r=s r9rz URL.netloc�s���"�)�0�0��9�9�9r;c�<�|jjpd}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" �/)r0rr�r2rs r9rzURL.path�s ���"�'�.�3���t�}�}�r;c�H�|jjpd}|�d��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" rr#)r0rr?)r2rs r9rz URL.querys&���#�)�/�R���|�|�G�$�$�$r;r c�4�t|jj��S)zz The URL query parameters, neatly parsed and packaged into an immutable multidict representation. )r r0rr=s r9r"z URL.paramss�� �4�.�4�5�5�5r;c��|jjpd}|jj�|d|jjzz }|�d��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 rSN�?r#)r0rrr?rTs r9r z URL.raw_pathsG���"�'�.�3�� � � $� 0� �C�$�-�3�3� 3�D��{�{�7�#�#�#r;c�8�t|jjpd��S)zk The URL fragments, as used in HTML anchors. As a string, without the leading '#'. r)rr0r!r=s r9r!z URL.fragment+s�� �t�*�3�9�r�:�:�:r;�boolc�L�t|jjo |jj��S)z� Return `True` for absolute URLs such as 'http://example.com/path', and `False` for relative URLs such as '/path'. )rZr0rrr=s r9�is_absolute_urlzURL.is_absolute_url3s#���D�'�.�K�4�3F�3K�L�L�Lr;c��|j S)z� Return `False` for absolute URLs such as 'http://example.com/path', and `True` for relative URLs such as '/path'. )r\r=s r9�is_relative_urlzURL.is_relative_url?s�� �'�'�'r;c ��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 )r2rs r9r1z URL.copy_withGs���4�"�"�6�"�"�"r;Nr4r5c�`�|�|j�||�����S�N)r")r1r"�set�r2r4r5s r9�copy_set_paramzURL.copy_set_paramV�&���~�~�T�[�_�_�S�%�%@�%@�~�A�A�Ar;c�`�|�|j�||�����Sra)r1r"�addrcs r9�copy_add_paramzURL.copy_add_paramYrer;c�^�|�|j�|�����Sra)r1r"�remove�r2r4s r9�copy_remove_paramzURL.copy_remove_param\s&���~�~�T�[�%7�%7��%<�%<�~�=�=�=r;r"rc�^�|�|j�|�����Sra)r1r"�merge�r2r"s r9�copy_merge_paramszURL.copy_merge_params_s&���~�~�T�[�%6�%6�v�%>�%>�~�?�?�?r;c ��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.parserrr r%)r2rrrs r9�joinzURL.joinbsB�� )�(�(�(�(�(��7�7�3�t�9�9�c�#�c�(�(�m�m�4�4�5�5�5r;r'c�:�tt|����S�N��hashr%r=s r9�__hash__z URL.__hash__p����C��I�I���r;�otherc��t|ttf��o,t|��tt|����kSrv)r+r r%�r2r{s r9�__eq__z URL.__eq__ss2���%�#�s��,�,�M��T���c�#�e�*�*�o�o�1M�Mr;c�*�t|j��Srv)r%r0r=s r9�__str__z URL.__str__vs���4�&�'�'�'r;c�^�|j\}}}}}}}d|vr|�d��d�d�}d�|r|�d�ndd|vrd|�d�n||�d|��ndg��}d�|r |j�d�nd|rd|��nd||�d |��nd|�d |��ndg��} |jj�d | �d �S) NrCrz :[secure]r�@�[�]z//rX�#�(�))r0�splitrtr� __class__r,) r2rrrrrrr!� authorityrs r9�__repr__z URL.__repr__ys!��>B�>Q�;���$��d�E�8� �(�?�?�"�.�.��-�-�a�0�;�;�;�H��G�G�"*�2�8������"�d�{�{� �D� � � � ��"�.� �D� � � �B� � � � ��g�g�%+�3�4�;�!�!�!�!��$-�5� �Y� � � �2��$�0� �E� � � �b�"*�"6��H����B�  � � ���.�)�4�4�C�4�4�4�4r;�tuple[bytes, bytes, int, bytes]c��ddl}ddl}|�d��|�dgd���}||j|j|j|j���S)NrzURL.raw is deprecated.�RawURL)r@rNrr )� collections�warnings�warn� namedtupler@rNrr )r2r�r�r�s r9�rawzURL.raw�sz����������� � �.�/�/�/��'�'� �D�D�D� � ���v����]����]�  � � � r;)r)rrrrrr�rr%)rr&)rrO)rr �rrZ)rrrr rv)r4r%r5rrr )r4r%rr )r"rrr )rrrr �rr'�r{rrrZ)rr�)!r,� __module__� __qualname__�__doc__r:�propertyrr@rrrrrNrrrrr"r r!r\r^r1rdrhrlrprtryr~r�r�r�r$r;r9r r sA������;�;�z/�/�/�/�/�b�*�*�*��X�*��:�:�:��X�:��<�<�<��X�<��3�3�3��X�3��3�3�3��X�3������X��4�8�8�8��X�8�*� (� (� (��X� (��:�:�:��X�:�� � � ��X� ��%�%�%��X�%� �6�6�6��X�6��$�$�$��X�$� �;�;�;��X�;�� M� M� M��X� M��(�(�(��X�(� #� #� #� #�B�B�B�B�B�B�B�B�B�B�>�>�>�>�@�@�@�@� 6� 6� 6� 6�����N�N�N�N�(�(�(�(�5�5�5�5�4�  �  �  ��X�  �  �  r;c���eZdZdZd-d�Zd.d �Zd/d �Zd0d�Zd1d�Zd2d3d�Z d4d�Z d2d5d�Z d2d5d�Z d6d�Z d2d7d�Zd8d�Zd9d �Zd:d"�Zd;d$�Zd<d%�Zd;d&�Zd=d(�Zd>d)�Zd>d*�Zd2d?d+�Zd@d,�ZdS)Ar z0 URL query parameters, as a multi-dict. �args�QueryParamTypes | Nonerrrrc���t|��dks Jd���|r |r Jd���|r|dn|}|�t|ttf��rDt|t��r|�d��n|}t |d���|_dSt|t��r*d�|j���D��|_dSi}t|ttf��r;|D]7}|� |dg��� |d ���8nd �|���D��}d �|���D��|_dS) NrIzToo many arguments.z'Cannot mix named and unnamed arguments.rr#T)�keep_blank_valuesc�4�i|]\}}|t|����Sr$)�list��.0�k�vs r9� <dictcomp>z(QueryParams.__init__.<locals>.<dictcomp>�s$��E�E�E���A�!�T�!�W�W�E�E�Er;rc�r�i|]4\}}|t|ttf��rt|��n|g��5Sr$)r+r��tupler�s r9r�z(QueryParams.__init__.<locals>.<dictcomp>�sM�������1��*�Q��u� �">�">�G�t�A�w�w�w�Q�C���r;c�H�i|]\}}t|��d�|D���� S)c�,�g|]}t|����Sr$r )r��items r9� <listcomp>z3QueryParams.__init__.<locals>.<dictcomp>.<listcomp>�s!��D�D�D�$�/��5�5�D�D�Dr;)r%r�s r9r�z(QueryParams.__init__.<locals>.<dictcomp>�sC������A�q��A���D�D�!�D�D�D���r;) �lenr+r%r&r.r�_dictr r)r�r�� setdefault�append)r2r�rr5� dict_valuer�s r9r:zQueryParams.__init__�s����4�y�y�1�}�}�}�3�}�}�}��O�V�O�O�&O�O�O�$��+��Q���V�� �=�J�u�s�E�l�;�;�=�-7��u�-E�-E�P�E�L�L��)�)�)�5�E�!�%�4�@�@�@�D�J�J�J� ��{� +� +� �E�E���1B�1B�1D�1D�E�E�E�D�J�J�J�=?�J��%�$���/�/� � "�G�G�D��)�)�$�q�'�2�6�6�=�=�d�1�g�F�F�F�F�G��� %� � � � ���� ���&�,�,�.�.����D�J�J�Jr;�typing.KeysView[str]c�4�|j���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��keysr=s r9r�zQueryParams.keys�s���z��� � � r;�typing.ValuesView[str]c�l�d�|j���D�����S)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"] c�&�i|]\}}||d��S�rr$r�s r9r�z&QueryParams.values.<locals>.<dictcomp>��"��7�7�7�D�A�q��1�Q�4�7�7�7r;)r�r)�valuesr=s r9r�zQueryParams.values�s2��8�7�D�J�$4�$4�$6�$6�7�7�7�>�>�@�@�@r;�typing.ItemsView[str, str]c�l�d�|j���D�����S)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")] c�&�i|]\}}||d��Sr�r$r�s r9r�z%QueryParams.items.<locals>.<dictcomp>�r�r;)r�r)r=s r9r)zQueryParams.items�s2��8�7�D�J�$4�$4�$6�$6�7�7�7�=�=�?�?�?r;�list[tuple[str, str]]c���g}|j���D]&\�}|��fd�|D�����'|S)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")] c���g|]}�|f��Sr$r$)r��ir�s �r9r�z+QueryParams.multi_items.<locals>.<listcomp>�s���2�2�2�1��A��2�2�2r;)r�r)�extend)r2� multi_itemsr�r�s @r9r�zQueryParams.multi_items�s]���.0� ��J�$�$�&�&� 4� 4�D�A�q� � � �2�2�2�2��2�2�2� 3� 3� 3� 3��r;Nr4�defaultc�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%)r2r4r�s r9�getzQueryParams.gets.�� �$�*� � ��:�c�#�h�h�'��*� *��r;r%� list[str]c�l�t|j�t|��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�r%rks r9�get_listzQueryParams.get_lists(���D�J�N�N�3�s�8�8�R�0�0�1�1�1r;r5c��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%�r2r4r5�qs r9rbzQueryParams.sets@�� �M�M���t�z�"�"���3�E�:�:�;����C�����r;c���t��}t|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 r%r�s r9rgzQueryParams.add(sP�� �M�M���t�z�"�"����J�J�s�O�O�/E�e�/L�/L�.M�M����C�����r;c��t��}t|j��|_|j�t |��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%)r2r4r�s r9rjzQueryParams.remove7s?�� �M�M���t�z�"�"��� �� � �C��H�H�d�#�#�#��r;r"c�N�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�)r2r"r�s r9rnzQueryParams.mergeFs+�� �� � ��+�T�Z�+�1�7�+����r;c�(�|j|dS)Nr�r�rks r9� __getitem__zQueryParams.__getitem__Xs���z�#��q�!�!r;rZc��||jvSrvr�rks r9� __contains__zQueryParams.__contains__[s���d�j� � r;�typing.Iterator[typing.Any]c�D�t|�����Srv)�iterr�r=s r9�__iter__zQueryParams.__iter__^s���D�I�I�K�K� � � r;r'c�*�t|j��Srv)r�r�r=s r9�__len__zQueryParams.__len__as���4�:���r;c�*�t|j��Srv)rZr�r=s r9�__bool__zQueryParams.__bool__ds���D�J���r;c�:�tt|����Srvrwr=s r9ryzQueryParams.__hash__grzr;r{c��t||j��sdSt|�����t|�����kS)NF)r+r��sortedr�r}s r9r~zQueryParams.__eq__jsN���%���0�0� ��5��d�&�&�(�(�)�)�V�E�4E�4E�4G�4G�-H�-H�H�Hr;c�D�t|�����Srv)rr�r=s r9r�zQueryParams.__str__os����)�)�+�+�,�,�,r;c�H�|jj}t|��}|�d|�d�S)Nr�r�)r�r,r%)r2� class_name� query_strings r9r�zQueryParams.__repr__rs.���^�,� ��4�y�y� ��0�0�|�0�0�0�0r;c� �td���)NzYQueryParams are immutable since 0.18.0. Use `q = q.merge(...)` to create an updated copy.�� RuntimeErrorros r9�updatezQueryParams.updatews��� @� � � r;c� �td���)Nz^QueryParams are immutable since 0.18.0. Use `q = q.set(key, value)` to create an updated copy.r�rcs r9� __setitem__zQueryParams.__setitem__}s��� E� � � r;)r�r�rrrr)rr�)rr�)rr�)rr�rv)r4rr�rrr)r4r%rr�)r4r%r5rrr )r4r%rr )r"r�rr )r4rrr%)r4rrrZ)rr�r�r�r�r�)r"r�rr)r4r%r5r%rr)r,r�r�r�r:r�r�r)r�r�r�rbrgrjrnr�r�r�r�r�ryr~r�r�r�r�r$r;r9r r �s���������$�$�$�$�L !� !� !� !� A� A� A� A� @� @� @� @� � � � � � � � � � 2� 2� 2� 2� � � � � � � � � � � � � � ������$"�"�"�"�!�!�!�!�!�!�!�!����� � � � �����I�I�I�I� -�-�-�-�1�1�1�1�  � � � � �  � � � � � r;)� __future__r�typingrsrrrrL�_typesr� _urlparser �_utilsr �__all__r �Mappingr%r r$r;r9�<module>r�s��"�"�"�"�"�"� � � � �5�5�5�5�5�5�5�5�5�5� � � � �#�#�#�#�#�#�������*�*�*�*�*�*� �-� ��R �R �R �R �R �R �R �R �j ] �] �] �] �] �&�.��c��*�] �] �] �] �] r;
Memory