gЯdZddlmZddlZddlZddlZddlZddlZddlZgdZ gdZ gdZ gdZ gdZ gd Zgd Zd Zd Zgd ZdZdZdZdZeefdZeefdZdZGddeZGddeZGddeZGddeeZGddeeZedd Z ed!d"Z!ed#d$Z"d%e _d&e jF_d'e jH_d(e!_d)e!jJ_d*e!jL_d+e!jN_d,e!jP_d-e!jH_d.e"_e!jJje"jJ_e!jLje"jL_e!jNje"jN_d/e"jR_e!jPje"jP_e!jHje"jH_eZ*Gd0de eZ+Gd1d!e!eZ,Gd2d#e"eZ-Gd3d4e eZ.Gd5d6e!eZ/Gd7d8e"eZ0d9Z1e1[1dsd<Z2d=Z3dtd>Z4d?Z5d@Z6ejnd;AdsdBZ8dCZ9dDZ:dudEZ;dFZdHZ?dIe@eAzeBzdJe@eAzfdKZCejdLZEdMZFdvdNZG dwdPZH dwdQZIdvdRZJeKdSZLe@eLZMdTZNGdUdVeOZPdxdWZQdydXZRejndYZSdzdZZTdOd:ddeRfd[ZUd\ZVd]ZWd^ZXd_ZYdaZd`Z[daZ\da]dbZ^dcZ_ddZ`deZadfZbdgZcdaddhZed{diZfd{djZgdkZhdlZidmZjdnZkdoZldpZmdqZndrZoy)|a3Parse (absolute and relative) URLs. urlparse module is based upon the following RFC specifications. RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding and L. Masinter, January 2005. RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter and L.Masinter, December 1999. RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T. Berners-Lee, R. Fielding, and L. Masinter, August 1998. RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998. RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June 1995. RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M. McCahill, December 1994 RFC 3986 is considered the current standard and any future changes to urlparse module should conform with it. The urlparse module is currently not entirely compliant with this RFC due to defacto scenarios for parsing, and for backward compatibility purposes, some parsing quirks from older RFCs are retained. The testcases in test_urlparse.py provides a good indicator of parsing behavior. The WHATWG URL Parser spec should also be considered. We are not compliant with it either due to existing user code API behavior expectations (Hyrum's Law). It serves as a useful guide when making changes. ) namedtupleN)urlparse urlunparseurljoin urldefragurlsplit urlunsplit urlencodeparse_qs parse_qslquote quote_plusquote_from_bytesunquote unquote_plusunquote_to_bytes DefragResult ParseResult SplitResultDefragResultBytesParseResultBytesSplitResultBytes)ftphttpgophernntpimapwaisfilehttpsshttpmmsprosperortsprtspsrtspusftpsvnsvn+sshwswss)rrrrrtelnetrrr r#r!r"snewsr$r%r&r'rsyncr)r*r(nfsgitzgit+sshr+r,z itms-services)rrhdlr$rrr!r"r%r&r'sipsipsr#r(tel) rr2mailtonewsr-rrr.r3r4) rrrrr!r"r#rr%r&r'r3r4) rrr2rrr7rrr!r"r.r r$zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!  )   cTtjtjy)zDClear internal performance caches. Undocumented; some tests want it.N)r cache_clear_byte_quoter_factory3/opt/alt/python312/lib64/python3.12/urllib/parse.py clear_cacherA^s $$&r?asciistrictc|SNr>)objs r@_nooprGls Jr?c&|j||SrEencode)rFencodingerrorss r@_encode_resultrMos ::h ''r?c0tfd|DS)Nc3JK|]}|r|jndyw)rNdecode.0xrKrLs r@ z_decode_args..us$G$Qq(F+b8$s #)tuple)argsrKrLs ``r@ _decode_argsrXss G$G GGr?ct|dt}|ddD]#}|st|t|k7std|r |tfzSt |t fzS)Nrz$Cannot mix str and non-str arguments) isinstancestr TypeErrorrGrXrM)rW str_inputargs r@ _coerce_argsr`wsg 47C(IABx :c3'94BC C  uh   1 11r?ceZdZdZdZddZy)_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr>c8|jfd|DS)Nc3BK|]}|jywrErIrRs r@rUz)_ResultMixinStr.encode..*Tt!188Hf+Et)_encoded_counterpartselfrKrLs ``r@rJz_ResultMixinStr.encode(t((*Tt*TUUr?NrBrC)__name__ __module__ __qualname____doc__ __slots__rJr>r?r@rbrbHIVr?rbceZdZdZdZddZy)_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr>c8|jfd|DS)Nc3BK|]}|jywrErPrRs r@rUz+_ResultMixinBytes.decode..rerf)_decoded_counterpartrhs ``r@rQz_ResultMixinBytes.decoderjr?Nrk)rlrmrnrorprQr>r?r@rsrsrqr?rscxeZdZdZdZedZedZedZedZ e e jZ y)_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr>c |jdS)Nr _userinforis r@usernamez_NetlocResultMixinBase.username~~a  r?c |jdS)NrZrzr|s r@passwordz_NetlocResultMixinBase.passwordr~r?c|jd}|syt|trdnd}|j|\}}}|j |z|zS)Nr%%) _hostinfor[r\ partitionlower)rihostname separatorpercentzones r@rz_NetlocResultMixinBase.hostnamesV>>!$&h4C$ "*"4"4Y"?'4~~')D00r?c|jd}|\|jr|jr t|}nt d|d|cxkrdkst dt d|S)NrZz+Port could not be cast to integer value as rizPort out of range 0-65535)risdigitisasciiint ValueError)riports r@rz_NetlocResultMixinBase.portsr~~a   ||~$,,.4y #Nth!WXX&& !<==' !<== r?N)rlrmrnrorppropertyr}rrr classmethodtypes GenericAlias__class_getitem__r>r?r@rxrxskRI !!!!11  $E$6$67r?rxc0eZdZdZedZedZy)_NetlocResultMixinStrr>c|j}|jd\}}}|r|jd\}}}|sd}||fSdx}}||fS)N@:netloc rpartitionrriruserinfo have_infohostinfor} have_passwordrs r@r{z_NetlocResultMixinStr._userinfosh(.(9(9#(>%)X 080B0B30G -HmX !!#' &Hx!!r?c|j}|jd\}}}|jd\}}}|r+|jd\}}}|jd\}}}n|jd\}}}|sd}||fS)Nr[]rrrir_r have_open_br bracketedrrs r@rz_NetlocResultMixinStr._hostinfos**3/1h%-%7%7%<"<  ) 3 3C 8 Ha,JAq$ ( 2 23 7 HaD~r?Nrlrmrnrprr{rr>r?r@rr-I  " "  r?rc0eZdZdZedZedZy)_NetlocResultMixinBytesr>c|j}|jd\}}}|r|jd\}}}|sd}||fSdx}}||fS)N@:rrs r@r{z!_NetlocResultMixinBytes._userinfosh(.(9(9$(?%)X 080B0B40H -HmX !!#' &Hx!!r?c|j}|jd\}}}|jd\}}}|r+|jd\}}}|jd\}}}n|jd\}}}|sd}||fS)Nr[]rrrs r@rz!_NetlocResultMixinBytes._hostinfos**401h%-%7%7%="<  ) 3 3D 9 Ha-JAq$ ( 2 24 8 HaD~r?Nrr>r?r@rrrr?rrz url fragmentrz!scheme netloc path query fragmentrz(scheme netloc path params query fragmentz DefragResult(url, fragment) A 2-tuple that contains the url without fragment identifier and the fragment identifier as a separate argument. z$The URL with no fragment identifier.z Fragment identifier separated from URL, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. z SplitResult(scheme, netloc, path, query, fragment) A 5-tuple that contains the different components of a URL. Similar to ParseResult, but does not split params. z%Specifies URL scheme for the request.z0 Network location where the request is made to. z@ The hierarchical path, such as the path to a file to download. z The query component, that contains non-hierarchical data, that along with data in path component, identifies a resource in the scope of URI's scheme and network location. z Fragment identifier, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. zq ParseResult(scheme, netloc, path, params, query, fragment) A 6-tuple that contains components of a parsed URL. z Parameters for last path element used to dereference the URI in order to provide access to perform some operation on the resource. ceZdZdZdZy)rr>cj|jr|jdz|jzS|jS)N#fragmenturlr|s r@geturlzDefragResult.geturlEs) ==88c>DMM1 188Or?Nrlrmrnrprr>r?r@rrC Ir?ceZdZdZdZy)rr>ct|SrEr r|s r@rzSplitResult.geturlM $r?Nrr>r?r@rrK I r?ceZdZdZdZy)rr>ct|SrErr|s r@rzParseResult.geturlRrr?Nrr>r?r@rrPrr?ceZdZdZdZy)rr>cj|jr|jdz|jzS|jS)N#rr|s r@rzDefragResultBytes.geturlXs) ==88d?T]]2 288Or?Nrr>r?r@rrVrr?rceZdZdZdZy)rr>ct|SrErr|s r@rzSplitResultBytes.geturl`rr?Nrr>r?r@rr^rr?rceZdZdZdZy)rr>ct|SrErr|s r@rzParseResultBytes.geturlerr?Nrr>r?r@rrcrr?rczttfttftt ff}|D]\}}||_||_yrE)rrrrrrrgrv) _result_pairs_decoded_encodeds r@_fix_result_transcodingrisE () &' &'M ,((0%(0%,r?rTct||\}}}t|||}|\}}}}}|tvrd|vrt|\}}nd}t ||||||} || S)aParse a URL into 6 components: :///;?# The result is a named 6-tuple with fields corresponding to the above. It is either a ParseResult or ParseResultBytes object, depending on the type of the url parameter. The username, password, hostname, and port sub-components of netloc can also be accessed as attributes of the returned object. The scheme argument provides the default value of the scheme component when no scheme is found in url. If allow_fragments is False, no attempt is made to separate the fragment component from the previous component, which can be either path or query. Note that % escapes are not expanded. ;r)r`r uses_params _splitparamsr) rschemeallow_fragments_coerce_result splitresultrqueryrparamsresults r@rrvsu(#/sF";C38K+6(FFC "3' V feX FF & !!r?cd|vr*|jd|jd}|dkr|dfS|jd}|d|||dzdfS)N/rrrrZ)findrfind)ris r@rrsY s{ HHS#))C. ) q57N HHSM r7C!I r?ct|}dD]&}|j||}|dk\st||}(|||||dfS)Nz/?#r)lenrmin)rstartdelimcwdelims r@ _splitnetlocrsR HE !U# Q;v&E uU S[ ((r?c0|r|jryddl}|jdd}|jdd}|jdd}|jdd}|jd|}||k(rydD]}||vst d |zd zd zy) Nrrrrr?NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)r unicodedatareplace normalizer)rrnnetloc2rs r@ _checknetlocrs V^^%sBA #rA #rA #rA##FA.GG|  <Z&03HHBCD Dr?c|jdr"tjd|s tdyt j |}t |tjr tdy)Nvz\Av[a-fA-F0-9]+\..+\ZzIPvFuture address is invalidz%An IPv4 address cannot be in brackets) startswithrematchr ipaddress ip_addressr[ IPv4Address)rips r@_check_bracketed_hostrsc3xx0(;;= =< ! !( + b)// 0DF F 1r?)typedcNt||\}}}|jt}|jt}tD]&}|j |d}|j |d}(t |}dx}x}}|jd}|dkDrU|djrB|djr/|d|D] } | tvs n|d|j||dzd}}|dddk(rct|d\}}d|vrd |vsd |vrd|vr td d|vr5d |vr1|jddjd d} t| |rd |vr|j!d d\}}d |vr|j!d d\}}t#|t%|||||} || S) aParse a URL into 5 components: :///?# The result is a named 5-tuple with fields corresponding to the above. It is either a SplitResult or SplitResultBytes object, depending on the type of the url parameter. The username, password, hostname, and port sub-components of netloc can also be accessed as attributes of the returned object. The scheme argument provides the default value of the scheme component when no scheme is found in url. If allow_fragments is False, no attempt is made to separate the fragment component from the previous component, which can be either path or query. Note that % escapes are not expanded. rrrNrZ//rrzInvalid IPv6 URLrr)r`lstrip_WHATWG_C0_CONTROL_OR_SPACEstrip_UNSAFE_URL_BYTES_TO_REMOVErboolrrisalpha scheme_charsrrrrrsplitrr) rrrrbrrrrrbracketed_hostrs r@rrs,#/sF";C **0 1C \\5 6F (kk!R 2&)?+O ""F"UX  A1uQ!c!fnn&6RaA $bq'--/3qst9CF 2Aw$"3*  F]s&03f#4/0 0 &=SF]#--c215??DQGN !. 13#: #q) X czYYsA& UFFC9A ! r?c `t|\}}}}}}}|r|d|}|t|||||fS)zPut a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).r)r`r ) componentsrrrrrrrs r@rrsH 3? 2KAFFC. f% *ffc5(%KL MMr?ct|\}}}}}}|r|r |dddk7rd|z}d|z|z}n'|dddk(rd|z}n|r|tvr|r|dddk(rd|z}|r|dz|z}|r|dz|z}|r|dz|z}||S) akCombine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example, a ? with an empty query; the RFC states that these are equivalent).NrZrrrrrr)r` uses_netloc)r rrrrrrs r@r r s+7 *C9FFC. 3r7c>s3Vmc! RaDSj Fk)3#bq'S.Sj slS  Ci%Ci(" # r?c |s|S|s|St||\}}}t|d|\}}}}}} t|||\} } } } }}| |k7s| tvr||S| tvr| r|t | | | | ||fS|} | s!| s|} |} |s|}|t | | | | ||fS|j d}|ddk7r|d=| dddk(r| j d}n&|| j dz}t d|dd|ddg}|D]0}|dk(r |j|dk(r |j|2|ddvr|jd|t | | dj|xsd| ||fS#t$rYwxYw) zaJoin a base URL and a possibly relative URL to form an absolute interpretation of the latter.rrNrZ...)rr) r`r uses_relativer rrfilterpop IndexErrorappendjoin)baserrrbschemebnetlocbpathbparamsbquery bfragmentrrpathrrr base_partssegments resolved_pathsegs r@rrs   ,T3 7D#~ T2 /8GWeWfi S'? 32FFD&%F-7c""  !*ffd.4eX.G#HI I Ej&&$*0%*CDE ES!J"~ rN BQx3::c? 3/ hqn52M $; !!# CZ    %|{" R *ffchh77vuh&89 ::  sE11 E=<E=ct|\}}d|vr$t|\}}}}}}t|||||df}nd}|}|t||S)zRemoves any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string. rr)r`rrr) rrsrpaqfragdefrags r@rrdsc's+C cz&sm1aAtQ1aB/0 ,vt4 55r?0123456789ABCDEFabcdefc*tt|S)z,unquote_to_bytes('abc%20def') -> b'abc def'.)bytes _unquote_impl)strings r@rrws v& ''r?r/returnc |s |jyt|tr|jd}|jd}t |dk(r|St |d}|j }tItDcic]7}tD],}||zjtj||z.9c}}a|ddD] } |t|dd||dd"|Scc}}w#t$r|d||YFwxYw)Nr?utf-8rrZrr) rr[r\rJr bytearrayextend _hextobyte_hexdigr-fromhexKeyError)r/bitsresrr'ritems r@r.r.{s   &#w' << D 4yA~ DG C ZZF&9&!11unn& a!e(<<07'&9 QR  :d2Ah' ( 48  J9   4L 4L s;}|j\}}|||t|dj |||}@||dyw)NrrZ)_asciirefinditerspanr.rQ)r/rKrLprevious_match_end ascii_matchrends r@_generate_unquoted_partsrCst((0  %%' s'..KN+228VDD  1 #$ %%sA!A#ct|trt|j||Sd|vr|j|S|d}|d}dj t |||S)aReplace %xx escapes by their single-character equivalent. The optional encoding and errors parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. By default, percent-encoded sequences are decoded with UTF-8, and invalid sequences are replaced by a placeholder character. unquote('abc%20def') -> 'abc def'. rr2rr)r[r-r.rQrrrCr/rKrLs r@rrsh&% V$++Hf== &   ~ 77+FHfE FFr?Fc i}t|||||||}|D]$\} } | |vr|| j| | g|| <&|S)aXParse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a dictionary. )rKrLmax_num_fieldsr)r r) qskeep_blank_valuesstrict_parsingrKrLrGr parsed_resultpairsnamevalues r@r r sd<M b+^'%3y JE e = $  & &u -#('M$   r?cX|rt|ttfs tdt|tr%t|ts t|d}d}fd}n9|sgStt |}t|tr t|d}d}d}|sgS|$d|j |z} || kr tdg} |j |D]V} | s|s| j|\} } }| s|rtd | |s|s4|| } ||}| j| |fX| S) aXParse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a list, as G-d intended. z*Separator must be of type string or bytes.rB=c t|S)N)rKrL)r)r%rKrLs r@_unquotezparse_qsl.._unquote sHVD Dr?=c8t|jddS)N+ )rr)r%s r@rRzparse_qsl.._unquotes#AIIdD$9: :r?rZzMax number of fields exceededzbad query field: ) r[r\r-r memoryviewcountrrr)rHrIrJrKrLrGreqrR num_fieldsr name_valuerMhas_eqrNs `` r@r r s5< Jy3,?EFF"c)S)Iw/I  EI:b> " i %i1I  ;  !),, J &<= = Ahhy) ","6"6r": D&%n *!FGG)~ $'* Hr?c@|jdd}t|||S)zLike unquote(), but also replace plus signs by spaces, as required for unquoting HTML form values. unquote_plus('%7e/abc+def') -> '~/abc def' + )rrrEs r@rr.s# ^^C %F 68V ,,r?sBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~cz|dk(r"tjdtdtSt dt d|)NQuoterzoDeprecated in 3.11. urllib.parse.Quoter will be removed in Python 3.14. It was not intended to be a public API.r stacklevelzmodule z has no attribute )warningswarnDeprecationWarning_QuoterAttributeErrorrl)rMs r@ __getattr__rj=sC x @)Q 8 78,.@I JJr?c"eZdZdZdZdZdZy)rhzA mapping from bytes numbers (in range(0,256)) to strings. String values are percent-encoded byte values, unless the key < 128, and in either of the specified safe set, or the always safe set. c8tj||_y)zsafe: bytes object.N) _ALWAYS_SAFEunionsafe)riros r@__init__z_Quoter.__init__Ns &&t, r?c dt|dS)Nz)dictr|s r@__repr__z_Quoter.__repr__Rs$t*q))r?cd||jvr t|ndj|}|||<|S)Nz%{:02X})rochrformat)rirr:s r@ __missing__z_Quoter.__missing__Us0TYYc!fI,<,r?r@rhrhFs-*r?rhct|tr|s|S|d}|d}|j||}n| td| tdt ||S)aquote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. The quote function offers a cautious (not minimal) way to quote a string for most of these parts. RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists the following (un)reserved characters. unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" reserved = gen-delims / sub-delims gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" Each of the reserved characters is reserved in some component of a URL, but not necessarily in all of them. The quote function %-escapes all characters that are neither in the unreserved chars ("always safe") nor the additional chars set via the safe arg. The default for the safe arg is '/'. The character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are to be preserved. Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings. Now, "~" is included in the set of unreserved characters. string and safe may be either str or bytes objects. encoding and errors must not be specified if string is a bytes object. The optional encoding and errors parameters specify how to deal with non-ASCII characters, as accepted by the str.encode method. By default, encoding='utf-8' (characters are encoded with UTF-8), and errors='strict' (unsupported characters raise a UnicodeEncodeError). r2rCz,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r[r\rJr]r)r/rorKrLs r@r r [smN&#M  H >Fx0  JK K  HI I FD ))r?ct|trd|vst|trd|vrt||||St|trd}nd}t|||z||}|j ddS)zLike quote(), but also replace ' ' with '+', as required for quoting HTML form values. Plus signs in the original string are escaped unless they are included in safe. It also does not have safe default to '/'. r`rVr_)r[r\r-r r)r/rorKrLspaces r@rrsp FC S%6 FE "t6'9VT8V44$ 64%<6 :F >>#s ##r?c,t|jSrE)rh __getitem__)ros r@r=r=s 4= $ $$r?c \t|ttfs td|syt|tr|j dd}nt|Dcgc] }|dks | c}}|j t|zs|jSt|}t|x}dkrdjt||Stj|}td||Dcgc]#}djt|||||z%}}dj|Scc}wcc}w)zLike quote(), but accepts a bytes object rather than a str, and does not perform string-to-bytes encoding. It always returns an ASCII string. quote_from_bytes(b'abc def?') -> 'abc%20def%3f' z!quote_from_bytes() expected bytesrrBignorei@ r)r[r-r3r]r\rJrstrip_ALWAYS_SAFE_BYTESrQr=rrmapmathisqrtrange)bsrorquoterbs_len chunk_sizerchunkss r@rrs b5), -;<< ${{7H-1ASa12 99'$. /yy{ !$ 'Fb'W$wws62''ZZ'  FJ797a''#fb1Z<&89:7 9wwv29s D$D$)(D)cDt|dr|j}n% t|rt|dtst g}|s~|D]x\}} t|t r |||}n|t||||}t| t r || |} n|t| |||} |j|dz| zzn|D]\}} t|t r |||}n|t||||}t| t r!|| |} |j|dz| zet| tr#|| |||} |j|dz| z t| } | D]G} t| t r || |} n|t| |||} |j|dz| zIdj|S#t $r}t d|d}~wwxYw#t $r/|t| |||} |j|dz| zYWwxYw)a^Encode a dict or sequence of two-element tuples into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order of the parameters in the output will match the order of parameters in the input. The components of a query arg may each be either a string or a bytes type. The safe, encoding, and errors parameters are passed down to the function specified by quote_via (encoding and errors only if a component is a str). itemsrz1not a valid non-string sequence or mapping objectNrP&) hasattrrrr[rVr]r-r\rr) rdoseqrorKrL quote_viaerrlkrrTelts r@r r s"ug  :5z*U1Xu"= A DAq!U#a&c!fdHf=!U#a&c!fdHf= HHQWq[ !DAq!U#a&c!fdHf=!U#a&S1%As#ax8S1%0AA !%c51"+C"6C"+CHdHf"MCS3/ !-8 88A;] :0169 : :D!*!#a&$&AAHHQWq[)*s)$G G' G$ GG$'4HHcPtjdtdt|S)Nz/urllib.parse.to_bytes() is deprecated as of 3.8rrc)rerfrg _to_bytesrs r@to_bytesrs  MMC$4 S>r?ct|tr" |jdj}|S|S#t$rt dt |zdzwxYw)zto_bytes(u"URL") --> 'URL'.ASCIIzURL z contains non-ASCII characters)r[r\rJrQ UnicodeErrorreprrs r@rrsl #s A**W%,,.C J3J AvS 1? @A A As 5$Act|j}|dddk(r|dddk(r|ddj}|dddk(r|ddj}|S)zTransform a string like '' into 'scheme://host/path'. The string is returned unchanged if it's not a wrapped URL. NrZ 'type', 'opaquestring'.Nz ([^/:]+):(.*)) _typeprogrcompileDOTALLrgroupsr)rrrdatas r@rr;sYJJ : OOC E ||~ ||~t## 9r?cPtjdtdt|S)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splithostrs r@ splithostrHrr?ct$tjdtjatj |}|r&|j \}}|r |ddk7rd|z}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rr) _hostprogrrrrr)rr host_portrs r@rrPsiJJ0"))< OOC E ,,. 4 DGsN:D$ 9r?cPtjdtdt|S)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splituserhosts r@ splituserr_% MM8$4 d r?c@|jd\}}}|r||fSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rNr)ruserrs r@rrfs.,D%Dd **td **r?cPtjdtdt|S)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splitpasswd)rs r@ splitpasswdrls% MM8$4  r?c>|jd\}}}||r|fSdfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rNr)rrpasswds r@rrss,..-D% E& ,,t ,,r?cPtjdtdt|S)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splitportrs r@ splitportryrr?ct$tjdtjatj |}|r|j \}}|r||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz (.*):([0-9]*)) _portprogrrr fullmatchr)rrrs r@rrsWJJ :    %E \\^ d :  :r?cRtjdtdt||S)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splitnport)rdefports r@ splitnportrs' MM8$4 tW %%r?c|jd\}}}|s|}||fS|r5|jr|jrt|}||fSd}||fS||fS)zSplit host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number is found after ':'. Return None if ':' but not a valid number.rN)rrrr)rrrrnports r@rrss ,D%  =  <<>dllnIEU{EU{ =r?cPtjdtdt|S)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splitqueryrs r@ splitqueryrs% MM8$4 s r?c@|jd\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.rNr)rrrrs r@rrs.,D% U{ 9r?cPtjdtdt|S)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splittagrs r@splittagrs$ MM8$4 S>r?c@|jd\}}}|r||fS|dfS)z)splittag('/path#tag') --> '/path', 'tag'.rNr)rrrtags r@rrs.~~c*D% Sy 9r?cPtjdtdt|S)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrc)rerfrg _splitattrrs r@ splitattrrrr?c8|jd}|d|ddfS)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].rrrZN)r)rwordss r@rrs& IIcNE 8U12Y r?cPtjdtdt|S)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadrrc)rerfrg _splitvalue)attrs r@ splitvaluers% MM9$4 t r?c>|jd\}}}||r|fSdfS)z-splitvalue('attr=value') --> 'attr', 'value'.rPNr)rrrNs r@rrs,,D% 5% ++d ++r?)rT)r)T)r2r)FFr2rNr)rNN)rNN)r)r)pro collectionsr functoolsrrrrer__all__rr rnon_hierarchical uses_query uses_fragmentrrrrA_implicit_encoding_implicit_errorsrGrMrXr`objectrbrsrxrr_DefragResultBase_SplitResultBase_ParseResultBaserrrrrrr ResultBaserrrrrrrrrrrr lru_cacherrr rrr6r5rr-r3r\r.rr=rCrr r r frozensetrmrrjrsrhr rr=rr rrrrrrrrrrrrrrrrrrrrrrrrrrr>r?r@rsB#  H0 - - FA %  \1'"4/(!3.H2"VfVVV#8V#8L2O<46G<~~>68=?!K&" #N#!" %!  #3"9"9"A"A"2"9"9"A"A 0 5 5 = =# "2!7!7!?!?$4$=$=$E$E! # $o "$9  "$9 )+< ')@  ')@ 1"<)D(G4 6!6p N.B:J6 #  (%)+c1ei6G: 2::& '&G.:?PS'T;@QTG R-!" <(Kd*4*l$$ %%6!rD"M`        + -    &",r?