o w[e@sdZddlZddlZddlZddlZddlZgdZgdZgdZgdZ gdZ gdZ gd Z d Z d Zgd Zd ZiZddZdZdZddZeefddZeefddZddZGdddeZGdddeZGdddeZGd d!d!eeZGd"d#d#eeZdd$lmZed%d&Z ed'd(Z!ed)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"eZ0d?d@Z1e1[1ddCdDZ2dEdFZ3ddGdHZ4dIdJZ5ddKdLZ6dMdNZ7dOdPZ8ddQdRZ9dSdTZ:dUZ;dadXZ?dd[d\Z@ ] ^dd_d`ZA ] ^ddadbZBddcddZCeDdeZEeFeEZGiZHGdfdgdgejIZJddidjZKddkdlZLddmdnZMd]dAddeLfdodpZNdqdrZOdsdtZPdudvZQdwdxZRdaSdydzZTd{d|ZUdaVd}d~ZWddZXddZYddZZddZ[ddZ\da]ddZ^dddZ_dddZ`ddZaddZbddZcddZdddZeddZfddZgddZhdS)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$rsyncr&r'r%nfsgitzgit+sshr(r))rrhdlr"rrrr r#r$sipsipsr!r%tel) rr/mailtonewsr*rrr+r0r1) rrrrrr r!rr#r$r0r1) rrr/rrr4rrrr r+rr"zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!  )   cCsttdS)z,Clear the parse cache and the quoters cache.N) _parse_cacheclear _safe_quotersr<r<#/usr/lib/python3.10/urllib/parse.py clear_cache`s r>asciistrictcCs|SNr<)objr<r<r=_nooposrCcCs |||SrAencode)rBencodingerrorsr<r<r=_encode_resultrs rHcstfdd|DS)Nc3s$|] }|r |ndVqdS)rNdecode.0xrFrGr<r= xs"z_decode_args..)tuple)argsrFrGr<rNr= _decode_argsvsrRcGsVt|dt}|ddD]}|rt|t|krtdq |r$|tfSt|tfS)Nrz$Cannot mix str and non-str arguments) isinstancestr TypeErrorrCrRrH)rQ str_inputargr<r<r= _coerce_argszs rYc@eZdZdZdZdddZdS) _ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr<r?r@c|jfdd|DS)Nc3|] }|VqdSrArDrKrNr<r=rOz)_ResultMixinStr.encode..)_encoded_counterpartselfrFrGr<rNr=rEz_ResultMixinStr.encodeNr?r@)__name__ __module__ __qualname____doc__ __slots__rEr<r<r<r=r[r[c@rZ) _ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr<r?r@cr\)Nc3r]rArIrKrNr<r=rOr^z+_ResultMixinBytes.decode..)_decoded_counterpartr`r<rNr=rJrbz_ResultMixinBytes.decodeNrc)rdrerfrgrhrJr<r<r<r=rjrirjc@sNeZdZdZdZeddZeddZeddZed d Z e e j Z d S) _NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr<cC |jdS)Nr _userinforar<r<r=username z_NetlocResultMixinBase.usernamecCrm)NrSrnrpr<r<r=passwordrrz_NetlocResultMixinBase.passwordcCsD|jd}|s dSt|trdnd}||\}}}|||S)Nr%%) _hostinforTrU partitionlower)rahostname separatorpercentzoner<r<r=rys z_NetlocResultMixinBase.hostnamecCsb|jd}|dur/|r|rt|}ntd|d|kr*dks/tdtd|S)NrSz+Port could not be cast to integer value as rizPort out of range 0-65535)rvisdigitisasciiint ValueError)raportr<r<r=rs  z_NetlocResultMixinBase.portN)rdrerfrgrhpropertyrqrsryr classmethodtypes GenericAlias__class_getitem__r<r<r<r=rls     rlc@(eZdZdZeddZeddZdS)_NetlocResultMixinStrr<cCJ|j}|d\}}}|r|d\}}}|sd}||fSd}}||fS)N@:netloc rpartitionrwraruserinfo have_infohostinforq have_passwordrsr<r<r=roz_NetlocResultMixinStr._userinfocCl|j}|d\}}}|d\}}}|r&|d\}}}|d\}}}n|d\}}}|s2d}||fS)Nr[]rrrar_r have_open_br bracketedryrr<r<r=rvz_NetlocResultMixinStr._hostinfoNrdrerfrhrrorvr<r<r<r=r   rc@r)_NetlocResultMixinBytesr<cCr)N@:rrr<r<r=rorz!_NetlocResultMixinBytes._userinfocCr)Nr[]rrrr<r<r=rvrz!_NetlocResultMixinBytes._hostinfoNrr<r<r<r=rrr) 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)rr<cC|jr |jd|jS|jS)N#fragmenturlrpr<r<r=geturlJzDefragResult.geturlNrdrerfrhrr<r<r<r=rH c@r)rr<cCt|SrArrpr<r<r=rRzSplitResult.geturlNrr<r<r<r=rPrc@r)rr<cCrrArrpr<r<r=rWrzParseResult.geturlNrr<r<r<r=rUrc@r)rr<cCr)N#rrpr<r<r=r]rzDefragResultBytes.geturlNrr<r<r<r=r[rrc@r)rr<cCrrArrpr<r<r=rerzSplitResultBytes.geturlNrr<r<r<r=rcrrc@r)rr<cCrrArrpr<r<r=rjrzParseResultBytes.geturlNrr<r<r<r=rhrrcCs4ttfttfttff}|D] \}}||_||_q dSrA)rrrrrrr_rk) _result_pairs_decoded_encodedr<r<r=_fix_result_transcodingns 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)rYr uses_params _splitparamsr) rschemeallow_fragments_coerce_result splitresultrqueryrparamsresultr<r<r=r{s rcCsRd|vr|d|d}|dkr|dfSn|d}|d|||ddfS)N/rrrrS)findrfind)rir<r<r=rs rcCsHt|}dD]}|||}|dkrt||}q|||||dfS)Nz/?#r)lenrmin)rstartdelimcwdelimr<r<r= _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)r~ unicodedatareplace normalizer)rrnnetloc2rr<r<r= _checknetlocs"       rc Cst||\}}}|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 |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. rNrrrS//rrzInvalid IPv6 URLrr)rYlstrip_WHATWG_C0_CONTROL_OR_SPACEstrip_UNSAFE_URL_BYTES_TO_REMOVErbooltyper9getrMAX_CACHE_SIZEr>r scheme_charsrxrrsplitrr) rrrrbkeycachedrrrrrvr<r<r=rsD       " 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)rYr) componentsrrrrrrrr<r<r=rs  rcCst|\}}}}}}|s|r0|tvr0|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).NrrrSrrrrr)rY uses_netloc)rrrrrrrr<r<r=rs    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.rrNrS...)rr) rYr uses_relativerrrfilterpop IndexErrorappendjoin)baserrrbschemebnetlocbpathbparamsbquery bfragmentrrpathrrr base_partssegments resolved_pathsegr<r<r=rsd             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)rYrrr) rrsrpaqfragdefragr<r<r=r\s r0123456789ABCDEFabcdefc 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-8rurSrNcSs.i|]}tD]}||t||qqSr<)_hexdigrEbytesfromhex)rLrrr<r<r= s z$unquote_to_bytes..r) rrTrUrErr _hextobyterKeyErrorr)stringbitsresritemr<r<r=ros.        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'. rtNrrrrSrr) rTrrrJr_asciirerrangerr)r rFrGr r rrr<r<r=rs    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. )rFrGmax_num_fieldsrz)r r) qskeep_blank_valuesstrict_parsingrFrGrrz parsed_resultpairsnamevaluer<r<r=r 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.NrSzMax number of fields exceeded=rzbad query field: %rrr+ rN) rYrTrUrrcountrrrrr)rrrrFrGrrzrr num_fieldsr name_valuenvrrr<r<r=r 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)r rFrGr<r<r=rs  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)rar%r<r<r=__init__/szQuoter.__init__cCsd|jjt|fS)Nz<%s %r>) __class__rddictrpr<r<r=__repr__3szQuoter.__repr__cCs(||jvr t|nd|}|||<|S)Nz%{:02X})r%chrformat)rarr r<r<r= __missing__7szQuoter.__missing__N)rdrerfrgr&r)r,r<r<r<r=r"'s  r"rcCsbt|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)rTrUrErVr )r r%rFrGr<r<r=r =s ' 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)rTrUrr r)r r%rFrGspacer<r<r=r ss  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)r<)rLrr<r<r= sz$quote_from_bytes..csg|]}|qSr<r<)rLcharquoterr<r=r1s)rTr bytearrayrVrUrErstrip_ALWAYS_SAFE_BYTESrJr;r r" __getitem__r)bsr%r<r3r=r 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) hasattrr:rrTrPrVsysexc_infowith_tracebackrrUrr)rdoseqr%rFrG quote_viatyvatblkrrMeltr<r<r=rs\                  rcCtjdtddt|S)Nz/urllib.parse.to_bytes() is deprecated as of 3.8r stacklevel)warningswarnDeprecationWarning _to_bytesrr<r<r=to_bytessrOcCsFt|tr!z |d}W|Sty tdt|dw|S)zto_bytes(u"URL") --> 'URL'.ASCIIzURL z contains non-ASCII characters)rTrUrErJ UnicodeErrorreprrNr<r<r=rMs  rMcCs`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. NrSzURL:)rUrrNr<r<r=unwraps  rVcCrG)NzUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splittyperNr<r<r= splittype rXcCsDtdur tdtjat|}|r|\}}||fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz ([^/:]+):(.*)) _typeprogrecompileDOTALLmatchgroupsrx)rr^rdatar<r<r=rWs   rWcCrG)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splithostrNr<r<r= splithost!rYrbcCsXtdur tdtjat|}|r(|\}}|r$|ddkr$d|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rr) _hostprogr[r\r]r^r_)rr^ host_portrr<r<r=ra)s  racCrG)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splituserhostr<r<r= splituser8rYrhcCs$|d\}}}|r||fSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rNr)rguserrr<r<r=re?srecCrG)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splitpasswd)rjr<r<r= splitpasswdErYrlcC"|d\}}}||r|fSdfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rNrw)rjrpasswdr<r<r=rkLrkcCrG)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splitportrfr<r<r= splitportRrYrrcCsDtdur tdtjat|}|r|\}}|r||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz (.*):([0-9]*)) _portprogr[r\r] fullmatchr_)rgr^rr<r<r=rq[s  rqrcCstjdtddt||S)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splitnport)rgdefportr<r<r= splitnportis rwcCsX|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)rr}r~r)rgrvrrnportr<r<r=rupsrucCrG)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splitqueryrNr<r<r= splitqueryrYrzcC$|d\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.rNri)rrrrr<r<r=ryrycCrG)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splittagrNr<r<r=splittagrYr~cCr{)z)splittag('/path#tag') --> '/path', 'tag'.rNri)rrrtagr<r<r=r}r|r}cCrG)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadrrH)rJrKrL _splitattrrNr<r<r= splitattrrYrcCs|d}|d|ddfS)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].rrrSN)r)rwordsr<r<r=rs rcCrG)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadrrH)rJrKrL _splitvalue)attrr<r<r= splitvaluerYrcCrm)z-splitvalue('attr=value') --> 'attr', 'value'.rNrn)rrrr<r<r=rrpr)rT)r)T)rr)FFrrNr)rNN)rNN)r)r)irgr[r<r collectionsrJ__all__rrrnon_hierarchical uses_query uses_fragmentrrrrr9r>_implicit_encoding_implicit_errorsrCrHrRrYobjectr[rjrlrrr_DefragResultBase_SplitResultBase_ParseResultBaserrrrrrr ResultBaserrrrrrrrrrrrrrrrrr rr\rrr r r frozensetr#rr7r; defaultdictr"r r r rrOrMrVrXrZrWrbrcrarhrerlrkrrrsrqrwrurzryr~r}rrrrr<r<r<r=s!    &           = E   * B   6  Q