Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_urls.cpython-313.pyc334 linesDownload Raw Back to __pycache__
1�

2��j.T���SSKJr SSKrSSKJrJrJr SSKrSSKJ	r	 SSK3Jr SSKJ
r
 SS	/r"S4S5r"SS	\R \\45rg)�)�annotationsN)�parse_qs�unquote�	urlencode�)�QueryParamTypes)�urlparse)�primitive_value_to_str�URL�QueryParamsc���\rSrSrSrS!S"Sjjr\S#Sj5r\S$Sj5r\S$Sj5r	\S#Sj5r5\S#Sj5r\S#S	j5r\S$S6j5r
\S%Sj5r\S$Sj5r\S#S
j5r\S$Sj5r\S&Sj5r\S$Sj5r\S#Sj5r\S'Sj5r\S'Sj5rS(SjrS)S*SjjrS)S*SjjrS+SjrS,SjrS-SjrS.SjrS/SjrS#SjrS#Sjr \S0Sj5r!S r"g)1r�ut	7url = httpx.URL("HTTPS://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink")8 9assert url.scheme == "https"10assert url.username == "jo@email.com"11assert url.password == "a secret"12assert url.userinfo == b"jo%40email.com:a%20secret"13assert url.host == "müller.de"14assert url.raw_host == b"xn--mller-kva.de"15assert url.port == 123416assert url.netloc == b"xn--mller-kva.de:1234"17assert url.path == "/pa th"18assert url.query == b"?search=ab"19assert url.raw_path == b"/pa%20th?search=ab"20assert url.fragment == "anchorlink"21 22The components of a URL are broken down like this:23 24   https://jo%40email.com:a%20secret@müller.de:1234/pa%20th?search=ab#anchorlink25[scheme]   [  username  ] [password] [ host ][port][ path ] [ query ] [fragment]26           [       userinfo        ] [   netloc   ][    raw_path    ]27 28Note that:29 30* `url.scheme` is normalized to always be lowercased.31 32* `url.host` is normalized to always be lowercased. Internationalized domain33  names are represented in unicode, without IDNA encoding applied. For instance:34 35  url = httpx.URL("http://中国.icom.museum")36  assert url.host == "中国.icom.museum"37  url = httpx.URL("http://xn--fiqs8s.icom.museum")38  assert url.host == "中国.icom.museum"39 40* `url.raw_host` is normalized to always be lowercased, and is IDNA encoded.41 42  url = httpx.URL("http://中国.icom.museum")43  assert url.raw_host == b"xn--fiqs8s.icom.museum"44  url = httpx.URL("http://xn--fiqs8s.icom.museum")45  assert url.raw_host == b"xn--fiqs8s.icom.museum"46 47* `url.port` is either None or an integer. URLs that include the default port for48  "http", "https", "ws", "wss", and "ftp" schemes have their port49  normalized to `None`.50 51  assert httpx.URL("http://example.com") == httpx.URL("http://example.com:80")52  assert httpx.URL("http://example.com").port is None53  assert httpx.URL("http://example.com:80").port is None54 55* `url.userinfo` is raw bytes, without URL escaping. Usually you'll want to work56  with `url.username` and `url.password` instead, which handle the URL escaping.57 58* `url.raw_path` is raw bytes of both the path and query, without URL escaping.59  This portion is used as the target when constructing HTTP requests. Usually you'll60  want to work with `url.path` instead.61 62* `url.query` is raw bytes, without URL escaping. A URL query string portion can63  only be properly URL escaped when decoding the parameter names and values64  themselves.65c
�B�U(Ga[[[[[[[[[[[[S.nUR	5H�upEXC;aU<S3n[U5eUbM[
XSU5(d:X4Rn[U5RnSU<SUSU3n[U5e[
U[5(dM�URS5X$'M� SU;a1URS5n	U	(dSO[[U	55US'[
U[5(a[U40UD6Ul
g[
U[5(a"URR"S0UD6Ul
g[S	[U5S66U<35e)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�67isinstance�__name__�type�decode�poprr	�_uri_referencer�	copy_with)68�self�url�kwargs�allowed�key�value�message�expected�seenrs69          �=D:\code\apps\devtools\python\Lib\site-packages\httpx/_urls.py�__init__�URL.__init__Msq������!������!�� �
�G� %�l�l�n�70���%�!$��'P�Q�G�#�G�,�,��$�Z��s�|�-L�-L�&�|�4�4�H���;�/�/�D� )�#��	�(��9�T�F�S�G�#�G�,�,��e�U�+�+�"'�,�,�w�"7�F�K�-��6�!� ���H�-��.4�$�#�k�&�>Q�:R��w���c�3���"*�3�"9�&�"9�D��
��S�
!�
!�"%�"4�"4�">�">�"H��"H�D�����S�	�{�"�S�G�-��
�c�.�URR$)zJ71The URL scheme, such as "http", "https".72Always normalised to lowercase.73)r)r�r+s r4r�74URL.scheme~s���"�"�)�)�)r7c�L�URRRS5$)zl75The raw bytes representation of the URL scheme, such as b"http", b"https".76Always normalised to lowercase.77r)r)r�encoder9s r4�78raw_scheme�URL.raw_scheme�s!���"�"�)�)�0�0��9�9r7c�L�URRRS5$)zR79The URL userinfo as a raw bytestring.80For example: b"jo%40email.com:a%20secret".81r)r)rr<r9s r4r�URL.userinfo�s!���"�"�+�+�2�2�7�;�;r7c�h�URRn[URS5S5$)zV82The URL username as a string, with URL decoding applied.83For example: "jo@email.com"84�:r�r)rr�	partition�r+rs  r4r�URL.username��0���&�&�/�/���x�)�)�#�.�q�1�2�2r7c�h�URRn[URS5S5$)zR85The URL password as a string, with URL decoding applied.86For example: "a secret"87rB�rCrEs  r4r�URL.password�rGr7c��URRnURS5(a[R"U5nU$)u�88The URL host as a string.89Always normalized to lowercase, with IDNA hosts decoded into unicode.90 91Examples:92 93url = httpx.URL("http://www.EXAMPLE.org")94assert url.host == "www.example.org"95 96url = httpx.URL("http://中国.icom.museum")97assert url.host == "中国.icom.museum"98 99url = httpx.URL("http://xn--fiqs8s.icom.museum")100assert url.host == "中国.icom.museum"101 102url = httpx.URL("https://[::ffff:192.168.0.1]")103assert url.host == "::ffff:192.168.0.1"104zxn--)r)r�105startswith�idnar')r+rs  r4r�URL.host�s7��(�'�'�,�,���?�?�6�"�"��;�;�t�$�D��r7c�L�URRRS5$)u�106The raw bytes representation of the URL host.107Always normalized to lowercase, and IDNA encoded.108 109Examples:110 111url = httpx.URL("http://www.EXAMPLE.org")112assert url.raw_host == b"www.example.org"113 114url = httpx.URL("http://中国.icom.museum")115assert url.raw_host == b"xn--fiqs8s.icom.museum"116 117url = httpx.URL("http://xn--fiqs8s.icom.museum")118assert url.raw_host == b"xn--fiqs8s.icom.museum"119 120url = httpx.URL("https://[::ffff:192.168.0.1]")121assert url.raw_host == b"::ffff:192.168.0.1"122r)r)rr<r9s r4�raw_host�URL.raw_host�s!��(�"�"�'�'�.�.�w�7�7r7c�.�URR$)ai123The URL port as an integer.124 125Note that the URL class performs port normalization as per the WHATWG spec.126Default ports for "http", "https", "ws", "wss", and "ftp" schemes are always127treated as `None`.128 129For example:130 131assert httpx.URL("http://www.example.com") == httpx.URL("http://www.example.com:80")132assert httpx.URL("http://www.example.com:80").port is None133)r)rr9s r4r�URL.port�s���"�"�'�'�'r7c�L�URRRS5$)z�134Either `<host>` or `<host>:<port>` as bytes.135Always normalized to lowercase, and IDNA encoded.136 137This property may be used for generating the value of a request138"Host" header.139r)r)rr<r9s r4r�140URL.netloc�s!���"�"�)�)�0�0��9�9r7c�V�URR=(d Sn[U5$)z�141The URL path as a string. Excluding the query string, and URL decoded.142 143For example:144 145url = httpx.URL("https://example.com/pa%20th")146assert url.path == "/pa th"147�/)r)rr�r+rs  r4r�URL.path�s$���"�"�'�'�.�3���t�}�r7c�b�URR=(d SnURS5$)av148The URL query string, as raw bytes, excluding the leading b"?".149 150This is necessarily a bytewise interface, because we cannot151perform URL decoding of this representation until we've parsed152the keys and values into a QueryParams instance.153 154For example:155 156url = httpx.URL("https://example.com/?filter=some%20search%20terms")157assert url.query == b"filter=some%20search%20terms"158�r)r)rr<)r+rs  r4r�	URL.querys)���#�#�)�)�/�R���|�|�G�$�$r7c�@�[URR5$)zb159The URL query parameters, neatly parsed and packaged into an immutable160multidict representation.161)rr)rr9s r4r�162URL.paramss���4�.�.�4�4�5�5r7c���URR=(d SnURRbUSURR--
nURS5$)z�163The complete URL path and query string as raw bytes.164Used as the target when constructing HTTP requests.165 166For example:167 168GET /users?search=some%20text HTTP/1.1169Host: www.example.org170Connection: close171rW�?r)r)rrr<rXs  r4r�URL.raw_pathsV���"�"�'�'�.�3�����$�$�0��C�$�-�-�3�3�3�3�D��{�{�7�#�#r7c�R�[URR=(d S5$)zS172The URL fragments, as used in HTML anchors.173As a string, without the leading '#'.174r[)rr)rr9s r4r�URL.fragment+s ���t�*�*�3�3�9�r�:�:r7c�z�[URR=(a URR5$)zs175Return `True` for absolute URLs such as 'http://example.com/path',176and `False` for relative URLs such as '/path'.177)�boolr)rrr9s r4�is_absolute_url�URL.is_absolute_url3s,���D�'�'�.�.�K�4�3F�3F�3K�3K�L�Lr7c�$�UR(+$)zs178Return `False` for absolute URLs such as 'http://example.com/path',179and `True` for relative URLs such as '/path'.180)rfr9s r4�is_relative_url�URL.is_relative_url?s���'�'�'�'r7c��[U40UD6$)al181Copy this URL, returning a new URL with some components altered.182Accepts the same set of parameters as the components that are made183available via properties on the `URL` class.184 185For example:186 187url = httpx.URL("https://www.example.com").copy_with(188    username="jo@gmail.com", password="a secret"189)190assert url == "https://jo%40email.com:a%20secret@www.example.com"191)r)r+r-s  r4r*�
URL.copy_withGs���4�"�6�"�"r7Nc�R�URURRX5S9$�N)r)r*r�set�r+r/r0s   r4�copy_set_param�URL.copy_set_paramV� ���~�~�T�[�[�_�_�S�%@�~�A�Ar7c�R�URURRX5S9$rn)r*r�addrps   r4�copy_add_param�URL.copy_add_paramYrsr7c�R�URURRU5S9$rn)r*r�remove�r+r/s  r4�copy_remove_param�URL.copy_remove_param\s"���~�~�T�[�[�%7�%7��%<�~�=�=r7c�R�URURRU5S9$rn)r*r�merge�r+rs  r4�copy_merge_params�URL.copy_merge_params_s"���~�~�T�[�[�%6�%6�v�%>�~�?�?r7c192�h�SSKJn [U"[U5[[U5555$)z�193Return an absolute URL, using this URL as the base.194 195Eg.196 197url = httpx.URL("https://www.example.com/test")198url = url.join("/new/path")199assert url == "https://www.example.com/new/path"200r)�urljoin)�urllib.parser�rr)r+r,r�s   r4�join�URL.joinbs%��	)��7�3�t�9�c�#�c�(�m�4�5�5r7c�*�[[U55$�N��hashrr9s r4�__hash__�URL.__hash__p����C��I��r7c�|�[U[[45=(a  [U5[[U55:H$r�)r$rr�r+�others  r4�__eq__�201URL.__eq__ss)���%�#�s��,�M��T��c�#�e�*�o�1M�Mr7c�,�[UR5$r�)rr)r9s r4�__str__�URL.__str__vs���4�&�&�'�'r7c��URupp4pVnSU;aURS5SS3nSRU(aUS3OSSU;aSUS3OUUbSU3OS/5nSRU(aURS3OSU(aSU3OSUUbS	U3OSUbS202U3OS/5n	URR203SU	<S3$)
NrBrz	:[secure]r[�@�[�]z//r`�#�(�))r)�splitr�r�	__class__r%)204r+rrrrrrr�	authorityr,s205          r4�__repr__�URL.__repr__ys���>B�>Q�>Q�;��$�d�8��(�?�"�.�.��-�a�0�1��;�H��G�G�"*�8�*�A���"�d�{�!�D�6����"�.�!�D�6�206�B�
�207�	��g�g�%+�4�;�;�-�q�!��$-�"�Y�K� �2��$�0�!�E�7��b�"*�"6�!�H�:��B�
�208���.�.�)�)�*�!�C�7�!�4�4r7c��SSKnSSKnURS5 URS/SQ5nU"URUR209URURS9$)NrzURL.raw is deprecated.�RawURL)r=rPrr)�collections�warnings�warn�210namedtupler=rPrr)r+r�r�r�s    r4�raw�URL.raw�sV�����
�
�.�/��'�'��D�211�������]�]�����]�]�	212�	213r7)r))r[)r,�	URL | strr-�214typing.Any�return�None�r�r)r�r)r�z215int | None)r�r�r�re)r-r�r�rr�)r/rr0r�r�r)r/rr�r)rrr�r)r,r�r�r�r�r �r�r�r�re)r�ztuple[bytes, bytes, int, bytes])#r%�216__module__�__qualname__�__firstlineno__�__doc__r5�propertyrr=rrrrrPrrrrrrrrfrir*rqrvr{r�r�r�r�r�r�r��__static_attributes__rr7r4rrs���;�z/�b�*��*��:��:��<��<��3��3��3��3�����4�8��8�*�
(��
(��:��:��217��218��%��%� �6��6��$��$� �;��;��	M��	M��(��(�
#�B�B�>�@�6��N�(�5�4�
219��
220r7c��\rSrSrSrSSjrSSjrSSjrSSjrSSjr	S S!S	jjr221S"S222jrS S#SjjrS S#Sjjr
S$S
jrS S%SjjrS&SjrS'SjrS(SjrS)SjrS*SjrS)SjrS+SjrS,SjrS,SjrS S-SjjrS.SjrSrg)/ri�z(223URL query parameters, as a multi-dict.224c���[U5S:dS5eU(aU(aS5eU(aUSOUnUb[U[[45(a8[U[5(aUR	S5OUn[USS9Ulg[U[5(a?URR5VVs0sHupEU[U5_M snnUlg0n[U[[45(a1UH*nURUS/5RUS5 M, OLUR5VVs0sH/upEU[U[[45(a[U5OU/_M1 nnnUR5VVVs0sH+upE[U5UVs/sHn[U5PM sn_M- snnnUlgs snnfs snnfs snfs snnnf)	NrIzToo many arguments.z'Cannot mix named and unnamed arguments.rrT)�keep_blank_valuesr)�lenr$rrr'r�_dictrr"�list�tuple�225setdefault�appendr226)r+�argsr-r0�k�v�227dict_value�items        r4r5�QueryParams.__init__�s����4�y�1�}�3�3�3�}��V�O�&O�O�$���Q��V���=�J�u�s�E�l�;�;�-7��u�-E�-E�E�L�L��)�5�E�!�%�4�@�D�J�
��{�
+�
+�16���1B�1B�1D�E�1D���!�T�!�W�*�1D�E�D�J�=?�J��%�$���/�/�228"�D��)�)�$�q�'�2�6�=�=�d�1�g�F�"�!&���
�� -����*�Q��u�
�">�">�t�A�w�Q�C�G� -���'�,�,�.��.�D�A��A��!�D�!�$�/��5�!�D�D�.��D�J��/F����E��s$�G�6G�G �(G�=G �G c�6�URR5$)z�229Return all the keys in the query params.230 231Usage:232 233q = httpx.QueryParams("a=123&a=456&b=789")234assert list(q.keys()) == ["a", "b"]235)r��keysr9s r4r��QueryParams.keys�s���z�z��� � r7c��URR5VVs0sH236upXS_M snnR5$s snnf)z�237Return all the values in the query params. If a key occurs more than once238only the first item for that key is returned.239 240Usage:241 242q = httpx.QueryParams("a=123&a=456&b=789")243assert list(q.values()) == ["123", "789"]244r)r�r"�values�r+r�r�s   r4r��QueryParams.values�s<��%)�J�J�$4�$4�$6�7�$6�D�A��Q�4��$6�7�>�>�@�@��7��Ac��URR5VVs0sH245upXS_M snnR5$s snnf)z�246Return all items in the query params. If a key occurs more than once247only the first item for that key is returned.248 249Usage:250 251q = httpx.QueryParams("a=123&a=456&b=789")252assert list(q.items()) == [("a", "123"), ("b", "789")]253r)r�r"r�s   r4r"�QueryParams.items�s<��%)�J�J�$4�$4�$6�7�$6�D�A��Q�4��$6�7�=�=�?�?��7r�c��/nURR5H(up#URUVs/sHoBU4PM sn5 M* U$s snf)z�254Return all items in the query params. Allow duplicate keys to occur.255 256Usage:257 258q = httpx.QueryParams("a=123&a=456&b=789")259assert list(q.multi_items()) == [("a", "123"), ("a", "456"), ("b", "789")]260)r�r"�extend)r+�multi_itemsr�r��is     r4r��QueryParams.multi_items�sL��.0���J�J�$�$�&�D�A�����2��1�A���2�3�'���� 3s�
A261Nc�Z�XR;aUR[U5S$U$)z�262Get a value from the query param for a given key. If the key occurs263more than once, then only the first value is returned.264 265Usage:266 267q = httpx.QueryParams("a=123&a=456&b=789")268assert q.get("a") == "123"269r)r�r)r+r/�defaults   r4�get�QueryParams.gets+���*�*���:�:�c�#�h�'��*�*��r7c�^�[URR[U5/55$)z�270Get all values from the query param for a given key.271 272Usage:273 274q = httpx.QueryParams("a=123&a=456&b=789")275assert q.get_list("a") == ["123", "456"]276)r�r�r�rrzs  r4�get_list�QueryParams.get_lists"���D�J�J�N�N�3�s�8�R�0�1�1r7c��[5n[UR5Ul[U5/UR[	U5'U$)z�277Return a new QueryParams instance, setting the value of a key.278 279Usage:280 281q = httpx.QueryParams("a=123")282q = q.set("a", "456")283assert q == httpx.QueryParams("a=456")284)r�dictr�r285r�r+r/r0�qs    r4ro�QueryParams.sets:��
�M���t�z�z�"���3�E�:�;�����C����r7c��[5n[UR5UlURU5[	U5/-UR[U5'U$)z�286Return a new QueryParams instance, setting or appending the value of a key.287 288Usage:289 290q = httpx.QueryParams("a=123")291q = q.add("a", "456")292assert q == httpx.QueryParams("a=123&a=456")293)rr�r�r�r294rr�s    r4ru�QueryParams.add(sH��
�M���t�z�z�"����J�J�s�O�/E�e�/L�.M�M�����C����r7c��[5n[UR5UlURR[	U5S5 U$)z�295Return a new QueryParams instance, removing the value of a key.296 297Usage:298 299q = httpx.QueryParams("a=123")300q = q.remove("a")301assert q == httpx.QueryParams("")302N)rr�r�r(r)r+r/r�s   r4ry�QueryParams.remove7s6��
�M���t�z�z�"���	�����C��H�d�#��r7c�Z�[U5n0UREUREUlU$)a303Return a new QueryParams instance, updated with.304 305Usage:306 307q = httpx.QueryParams("a=123")308q = q.merge({"b": "456"})309assert q == httpx.QueryParams("a=123&b=456")310 311q = httpx.QueryParams("a=123")312q = q.merge({"a": "456", "b": "789"})313assert q == httpx.QueryParams("a=456&b=789")314)rr�)r+rr�s   r4r~�QueryParams.mergeFs,��
����+�T�Z�Z�+�1�7�7�+����r7c�&�URUS$)Nr�r�rzs  r4�__getitem__�QueryParams.__getitem__Xs���z�z�#��q�!�!r7c��XR;$r�r�rzs  r4�__contains__�QueryParams.__contains__[s���j�j� � r7c�4�[UR55$r�)�iterr�r9s r4�__iter__�QueryParams.__iter__^s���D�I�I�K� � r7c�,�[UR5$r�)r�r�r9s r4�__len__�QueryParams.__len__as���4�:�:��r7c�,�[UR5$r�)rer�r9s r4�__bool__�QueryParams.__bool__ds���D�J�J��r7c�*�[[U55$r�r�r9s r4r��QueryParams.__hash__gr�r7c��[XR5(dg[UR55[UR55:H$)NF)r$r��sortedr�r�s  r4r��QueryParams.__eq__js;���%���0�0���d�&�&�(�)�V�E�4E�4E�4G�-H�H�Hr7c�4�[UR55$r�)rr�r9s r4r��QueryParams.__str__os����)�)�+�,�,r7c�V�URRn[U5nUSU<S3$)Nr�r�)r�r%r)r+�315class_name�query_strings   r4r��QueryParams.__repr__rs.���^�^�,�,�316��4�y����Q�|�.�a�0�0r7c��[S5e)NzYQueryParams are immutable since 0.18.0. Use `q = q.merge(...)` to create an updated copy.��RuntimeErrorrs  r4�update�QueryParams.updatews���
@�317�	318r7c��[S5e)Nz^QueryParams are immutable since 0.18.0. Use `q = q.set(key, value)` to create an updated copy.rrps   r4�__setitem__�QueryParams.__setitem__}s���
E�319�	320r7r�)r��QueryParamTypes | Noner-r�r�r�)r�ztyping.KeysView[str])r�ztyping.ValuesView[str])r�ztyping.ItemsView[str, str])r�zlist[tuple[str, str]]r�)r/r�r�r�r�r�)r/rr�z	list[str])r/rr0r�r�r)r/rr�r)rrr�r)r/r�r�r)r/r�r�re)r�ztyping.Iterator[typing.Any]r�r�r�r�)rrr�r�)r/rr0rr�r�)r%r�r�r�r�r5r�r�r"r�r�r�roruryr~r�r�r�r�r�r�r�r�r�rr321r�rr7r4rr�sy���$�L	!�322A�323@���	2�
�
�
��$"�!�!�� ��I�324-�1�325326�327r7)�328__future__r�typingr�rrrrM�_typesr�	_urlparser	�_utilsr329�__all__r�Mappingrrrr7r4�<module>rsO��"�
�5�5��#��*��-�330 ��R331�R332�j]333�&�.�.��c��*�]334r7
codekingpro/portable-devtools · Team Ai