o ?Og֪@sdZddlZddlZddlZddlZddlZddlZgdZgdZgdZ gdZ gdZ gdZ gd Z d Zd Zgd Zd ZiZddZdZdZddZeefddZeefddZddZGdddeZGdddeZGdddeZGd d!d!eeZGd"d#d#eeZdd$lm Z e d%d&Z!e d'd(Z"e d)d*Z#d+e!_d,e!j$_d-e!j%_d.e"_d/e"j&_d0e"j'_d1e"j(_d2e"j)_d3e"j%_d4e#_e"j&je#j&_e"j'je#j'_e"j(je#j(_d5e#j*_e"j)je#j)_e"j%je#j%_eZ+Gd6d%d%e!eZ,Gd7d'd'e"eZ-Gd8d)d)e#eZ.Gd9d:d:e!eZ/Gd;d<dd>e#eZ1d?d@Z2e2[2ddCdDZ3dEdFZ4ddGdHZ5dIdJZ6dKdLZ7ddMdNZ8dOdPZ9dQdRZ:ddSdTZ;dUdVZdXdYZ?e@dZZAdd]d^ZB _ `ddadbZC _ `ddcddZDddedfZEeFdgZGeHeGZIiZJGdhdidiejKZLddkdlZMddmdnZNddodpZOd_dAddeNfdqdrZPdsdtZQdudvZRdwdxZSdydzZTdaUd{d|ZVd}d~ZWdaXddZYddZZddZ[ddZ\ddZ]ddZ^da_ddZ`dddZadddZbddZcddZdddZeddZfddZgddZhddZiddZjdS)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. N)urlparse urlunparseurljoin urldefragurlsplit urlunsplit urlencodeparse_qs parse_qslquote quote_plusquote_from_bytesunquote unquote_plusunquote_to_bytes DefragResult ParseResult SplitResultDefragResultBytesParseResultBytesSplitResultBytes)ftphttpgophernntpimapwaisfilehttpsshttpmmsprosperortsprtspusftpsvnsvn+sshwswss)rrrrrtelnetrrrr!rr snewsr"r#r$Zrsyncr&r'r%ZnfsZgitzgit+sshr(r))rrhdlr"rrrr r#r$sipsipsr!r%Ztel) rr,Zmailtonewsr*rrr+r-r.) rrrrrr r!rr#r$r-r.) rrr,rrr/rrrr r+rr"zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!  )   cCsttdS)z,Clear the parse cache and the quoters cache.N) _parse_cacheclear _safe_quotersr7r73/opt/alt/python310/lib64/python3.10/urllib/parse.py clear_cacheas r9asciistrictcCs|SNr7)objr7r7r8_nooppsr>cCs |||Sr<encode)r=encodingerrorsr7r7r8_encode_resultss rCcstfdd|DS)Nc3s$|] }|r |ndVqdS)rNdecode.0xrArBr7r8 ys"z_decode_args..)tuple)argsrArBr7rIr8 _decode_argswsrMcGsVt|dt}|ddD]}|rt|t|krtdq |r$|tfSt|tfS)Nrz$Cannot mix str and non-str arguments) isinstancestr TypeErrorr>rMrC)rLZ str_inputargr7r7r8 _coerce_args{s rSc@eZdZdZdZdddZdS) _ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr7r:r;c|jfdd|DS)Nc3|] }|VqdSr<r?rFrIr7r8rJz)_ResultMixinStr.encode..)_encoded_counterpartselfrArBr7rIr8r@z_ResultMixinStr.encodeNr:r;)__name__ __module__ __qualname____doc__ __slots__r@r7r7r7r8rUrUc@rT) _ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr7r:r;crV)Nc3rWr<rDrFrIr7r8rJrXz+_ResultMixinBytes.decode..)_decoded_counterpartrZr7rIr8rEr\z_ResultMixinBytes.decodeNr])r^r_r`rarbrEr7r7r7r8rdrcrdc@sNeZdZdZdZeddZeddZeddZed d Z e e j Z d S) _NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr7cC |jdS)Nr _userinfor[r7r7r8username z_NetlocResultMixinBase.usernamecCrg)NrNrhrjr7r7r8passwordrlz_NetlocResultMixinBase.passwordcCsD|jd}|s dSt|trdnd}||\}}}|||S)Nr%%) _hostinforOrP partitionlower)r[hostname separatorZpercentZzoner7r7r8rss z_NetlocResultMixinBase.hostnamecCsb|jd}|dur/|r|rt|}ntd|d|kr*dks/tdtd|S)NrNz+Port could not be cast to integer value as rizPort out of range 0-65535)rpisdigitisasciiint ValueError)r[portr7r7r8rys  z_NetlocResultMixinBase.portN)r^r_r`rarbpropertyrkrmrsry classmethodtypes GenericAlias__class_getitem__r7r7r7r8rfs     rfc@(eZdZdZeddZeddZdS)_NetlocResultMixinStrr7cCJ|j}|d\}}}|r|d\}}}|sd}||fSd}}||fS)N@:netloc rpartitionrqr[rZuserinfoZ have_infohostinforkZ have_passwordrmr7r7r8riz_NetlocResultMixinStr._userinfocCl|j}|d\}}}|d\}}}|r&|d\}}}|d\}}}n|d\}}}|s2d}||fS)Nr[]rrr[r_rZ have_open_brZ bracketedrsryr7r7r8rpz_NetlocResultMixinStr._hostinfoNr^r_r`rbrzrirpr7r7r7r8r   rc@r)_NetlocResultMixinBytesr7cCr)N@:rrr7r7r8rirz!_NetlocResultMixinBytes._userinfocCr)Nr[]rrrr7r7r8rprz!_NetlocResultMixinBytes._hostinfoNrr7r7r7r8rrr) namedtuplerz 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. c@eZdZdZddZdS)rr7cC|jr |jd|jS|jS)N#fragmenturlrjr7r7r8geturlKzDefragResult.geturlNr^r_r`rbrr7r7r7r8rI c@r)rr7cCt|Sr<rrjr7r7r8rSzSplitResult.geturlNrr7r7r7r8rQrc@r)rr7cCrr<rrjr7r7r8rXrzParseResult.geturlNrr7r7r7r8rVrc@r)rr7cCr)N#rrjr7r7r8r^rzDefragResultBytes.geturlNrr7r7r7r8r\rrc@r)rr7cCrr<rrjr7r7r8rfrzSplitResultBytes.geturlNrr7r7r7r8rdrrc@r)rr7cCrr<rrjr7r7r8rkrzParseResultBytes.geturlNrr7r7r7r8rirrcCs4ttfttfttff}|D] \}}||_||_q dSr<)rrrrrrrYre)Z _result_pairsZ_decodedZ_encodedr7r7r8_fix_result_transcodingos rrTc Csft||\}}}t|||}|\}}}}}|tvr$d|vr$t|\}}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)rSr uses_params _splitparamsr) rschemeallow_fragments_coerce_resultZ splitresultrqueryrparamsresultr7r7r8r|s rcCsRd|vr|d|d}|dkr|dfSn|d}|d|||ddfS)N/rrrrN)findrfind)rir7r7r8rs rcCsHt|}dD]}|||}|dkrt||}q|||||dfS)Nz/?#r)lenrmin)rstartdelimcZwdelimr7r7r8 _splitnetlocs  rcCs|r|rdSddl}|dd}|dd}|dd}|dd}|d|}||kr0dSdD]}||vrBtd |d d q2dS) Nrrrrr?NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)rv unicodedatareplace normalizerx)rrnZnetloc2rr7r7r8 _checknetlocs"       rcCsD|drtd|stddSt|}t|tjr tddS)Nvz\Av[a-fA-F0-9]+\..+\ZzIPvFuture address is invalidz%An IPv4 address cannot be in brackets) startswithrematchrx ipaddressZ ip_addressrOZ IPv4Address)rsZipr7r7r8_check_bracketed_hosts    rcCst||\}}}|t}|t}tD]}||d}||d}qt|}|||t|t|f}t |d}|r>||St tt krGt d}}} | d} | dkrv|d| D]} | tvrdnq\|d| || dd}}|dddkrt|d\}}d|vrd |vsd |vrd|vrtd d|vrd |vr|ddd d} t| |rd |vr|d d\}} d |vr|d d\}}t|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. rNrrrN//rrzInvalid IPv6 URLrr)rSlstrip_WHATWG_C0_CONTROL_OR_SPACEstrip_UNSAFE_URL_BYTES_TO_REMOVErbooltyper4getrMAX_CACHE_SIZEr9r scheme_charsrrrrxrqrsplitrr)rrrrbkeycachedrrrrrZbracketed_hostrr7r7r8rsJ       " rcCs<t|\}}}}}}}|rd||f}|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).z%s;%s)rSr) componentsrrrrrrrr7r7r8rs  rcCst|\}}}}}}|s|r|tvs|dddkr0|r(|dddkr(d|}d|p,d|}|r8|d|}|r@|d|}|rH|d |}||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).NrrrNrrrrr)rS uses_netloc)rrrrrrrr7r7r8rs    rc Cs|s|S|s|St||\}}}t|d|\}}}}}} t|||\} } } } }}| |ks0| tvr4||S| tvrH| rF|t| | | | ||fS|} | s`| s`|} |} |sT|}|t| | | | ||fS|d}|ddkrn|d=| dddkr|| d}n|| d}td|dd|dd<g}|D] }|dkrz|WqtyYqw|dkrq| |q|ddvr| d|t| | d |pd| ||fS) zaJoin a base URL and a possibly relative URL to form an absolute interpretation of the latter.rrNrN...)rr) rSr uses_relativerrrfilterpop IndexErrorappendjoin)baserrrZbschemeZbnetlocZbpathZbparamsZbqueryZ bfragmentrrpathrrrZ base_partsZsegmentsZ resolved_pathZsegr7r7r8r%sd             rc CsTt|\}}d|vrt|\}}}}}}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)rSrrr) rrsrpaqZfragZdefragr7r7r8rjs rZ0123456789ABCDEFabcdefc Cs|s|jdSt|tr|d}|d}t|dkr|S|dg}|j}tdur1ddtDa|ddD]'}z|t|dd ||d dWq7ty^|d||Yq7wd |S) z,unquote_to_bytes('abc%20def') -> b'abc def'.utf-8rorNrNcSs.i|]}tD]}||t||qqSr7)_hexdigr@bytesfromhex)rGrrr7r7r8 s z$unquote_to_bytes..r) rrOrPr@rr _hextobyterKeyErrorr)stringbitsresritemr7r7r8r}s.        rz([-]+)rrcCst|tr t|||Sd|vr|j|S|durd}|dur"d}t|}|dg}|j}tdt|dD]}|t|||||||dq7d |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'. rnNrrrrNrr) rOrrrEr_asciirerrangerr)rrArBrrrrr7r7r8rs    rF&c CsNi}t|||||||d}|D]\} } | |vr|| | q| g|| <q|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. )rArBmax_num_fieldsrt)r r) qskeep_blank_valuesstrict_parsingrArBrrtZ parsed_resultZpairsnamevaluer7r7r8r s  r cCs t|\}}t|\}}|rt|ttfstd|dur,d||} || kr,tdg} ||D]Z} | s:|s:q3| dd} t| dkrX|rOtd| f|rW| dnq3t| ds`|r| d  d d } t | ||d } || } | d d d }t |||d }||}| | |fq3| 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.NrNzMax number of fields exceeded=rzbad query field: %rrr+ rI) rSrOrPrrxcountrrrrr)rrrrArBrrtrr num_fieldsrZ name_valueZnvrrr7r7r8r s:     r cCs|dd}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' rr)rr)rrArBr7r7r8r%s  rsBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~c@s(eZdZdZddZddZddZdS) QuoterzA mapping from bytes (in range(0,256)) to strings. String values are percent-encoded byte values, unless the key < 128, and in the "safe" set (either the specified safe set, or default set). cCst||_dS)zsafe: bytes object.N) _ALWAYS_SAFEunionsafe)r[rr7r7r8__init__=szQuoter.__init__cCsd|jjt|fS)Nz<%s %r>) __class__r^dictrjr7r7r8__repr__AszQuoter.__repr__cCs(||jvr t|nd|}|||<|S)Nz%{:02X})rchrformat)r[rrr7r7r8 __missing__EszQuoter.__missing__N)r^r_r`rarr r r7r7r7r8r5s  rrcCsbt|tr|s |S|durd}|durd}|||}n|dur$td|dur,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). Nrr;z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)rOrPr@rQr )rrrArBr7r7r8r Ks ' r cCsdt|tr d|vst|trd|vrt||||St|tr!d}nd}t|||||}|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 r)rOrPrr r)rrrArBZspacer7r7r8r s  r cst|ttfs td|sdSt|tr|dd}n tdd|D}|t|s/|Szt |Wnt yGt |j t |<Ynwd fdd|DS)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 bytesrr:ignorecSsg|]}|dkr|qS)r7)rGrr7r7r8 sz$quote_from_bytes..csg|]}|qSr7r7)rGcharZquoterr7r8rs)rOr bytearrayrQrPr@rstrip_ALWAYS_SAFE_BYTESrEr6rr __getitem__r)Zbsrr7rr8r s   r c Cst|dr |}n%zt|rt|dtstWnty.t\}}}td|wg} |sl|D]5\} } t| t rD|| |} n |t | |||} t| t rX|| |} n |t | |||} | | d| q5n|D]\} } t| t r}|| |} n |t | |||} t| t r|| |} | | d| qnt| t r|| |||} | | d| qnzt| } Wnty|t | |||} | | d| Yqnw| D]} t| t r|| |} n |t | |||} | | d| qqnd | S)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 objectrr) hasattrrrrOrKrQsysexc_infowith_tracebackrrPrr)rZdoseqrrArBZ quote_viaZtyZvatblkrrHeltr7r7r8rs\                  rcCtjdtddt|S)Nz/urllib.parse.to_bytes() is deprecated as of 3.8r stacklevel)warningswarnDeprecationWarning _to_bytesrr7r7r8to_bytessr)cCsFt|tr!z |d}W|Sty tdt|dw|S)zto_bytes(u"URL") --> 'URL'.ASCIIzURL z contains non-ASCII characters)rOrPr@rE UnicodeErrorreprr(r7r7r8r's  r'cCs`t|}|dddkr|dddkr|dd}|dddkr.|dd}|S)zTransform a string like '' into 'scheme://host/path'. The string is returned unchanged if it's not a wrapped URL. NrNzURL:)rPrr(r7r7r8unwrap s  r0cCr!)NzUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splittyper(r7r7r8 splittyper2cCsDtdur tdtjat|}|r|\}}||fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz ([^/:]+):(.*)) _typeprogrcompileDOTALLrgroupsrr)rrrdatar7r7r8r1"s   r1cCr!)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splithostr(r7r7r8 splithost/r3r:cCsXtdur tdtjat|}|r(|\}}|r$|ddkr$d|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rr) _hostprogrr5r6rr7)rrZ host_portrr7r7r8r97s  r9cCr!)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splituserhostr7r7r8 splituserFr3r?cCs$|d\}}}|r||fSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rNr)r>userrr7r7r8r<Msr<cCr!)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splitpasswd)rAr7r7r8 splitpasswdSr3rCcC"|d\}}}||r|fSdfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rNrq)rArZpasswdr7r7r8rBZrBcCr!)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splitportr=r7r7r8 splitport`r3rHcCsDtdur tdtjat|}|r|\}}|r||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz (.*):([0-9]*)) _portprogrr5r6 fullmatchr7)r>rryr7r7r8rGis  rGrcCstjdtddt||S)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splitnport)r>defportr7r7r8 splitnportws rMcCsX|d\}}}|s|}||fS|r(|r"|r"t|}||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)rrurvrw)r>rLrryZnportr7r7r8rK~srKcCr!)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splitqueryr(r7r7r8 splitqueryr3rOcC$|d\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.rNr@)rrrrr7r7r8rNrNcCr!)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splittagr(r7r7r8splittagr3rScCrP)z)splittag('/path#tag') --> '/path', 'tag'.rNr@)rrrtagr7r7r8rRrQrRcCr!)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrr")r$r%r& _splitattrr(r7r7r8 splitattrr3rVcCs|d}|d|ddfS)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].rrrNN)r)rZwordsr7r7r8rUs rUcCr!)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadrr")r$r%r& _splitvalue)attrr7r7r8 splitvaluer3rYcCrD)z-splitvalue('attr=value') --> 'attr', 'value'.rNrE)rXrrr7r7r8rWrFrW)rT)r)T)rr)FFrrNr)rNN)rNN)r)r)krarrr| collectionsr$r__all__rrrZnon_hierarchicalZ uses_queryZ uses_fragmentrrrrr4r9Z_implicit_encodingZ_implicit_errorsr>rCrMrSobjectrUrdrfrrrZ_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaserrrrrrrZ ResultBaserrrrrrrrrrrrrrrrrrrrr5rrr r r frozensetrrrr6 defaultdictrr r r rr)r'r0r2r4r1r:r;r9r?r<rCrBrHrIrGrMrKrOrNrSrRrVrUrYrWr7r7r7r8s!    &           ? E   * B   6  Q