
    ^ho                     2   S r SSKrSSKrSSKr/ SQr/ SQr/ SQr/ SQr/ SQr/ SQr	/ S	Qr
S
r/ SQrSr0 rS rSrSrS r\\4S jr\\4S jrS r " S S\5      r " S S\5      r " S S\5      r " S S\\5      r " S S\\5      rSSKJr  \" SS 5      r\" S!S"5      r\" S#S$5      rS%\l         S&\R@                  l         S'\RB                  l         S(\l         S)\RD                  l         S*\RF                  l         S+\RH                  l         S,\RJ                  l         S-\RB                  l         S.\l         \RD                  R                   \RD                  l         \RF                  R                   \RF                  l         \RH                  R                   \RH                  l         S/\RL                  l         \RJ                  R                   \RJ                  l         \RB                  R                   \RB                  l         \r' " S0 S\\5      r( " S1 S!\\5      r) " S2 S#\\5      r* " S3 S4\\5      r+ " S5 S6\\5      r, " S7 S8\\5      r-S9 r.\." 5         C.S`S; jr/S< r0SaS= jr1S> r2S? r3S`S@ jr4SA r5SB r6SbSC jr7SD r8SEr9Sq:SF r;\Rx                  " SG5      r=ScSH jr>  SdSJ jr?  SdSK jr@ScSL jrA\B" SM5      rC\D" \C5      rE0 rF " SN SO\R                  5      rHSeSP jrISfSQ jrJSgSR jrKSIS:SS\J4SS jrLST rMSU rNSqOSV rPSqQSW rRSX rSSY rTSqUSZ rVShS[ jrWS\ rXS] rYS^ rZS_ r[g)iac  Parse (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.
    N)urlparse
urlunparseurljoin	urldefragurlsplit
urlunsplit	urlencodeparse_qs	parse_qslquote
quote_plusquote_from_bytesunquoteunquote_plusunquote_to_bytesDefragResultParseResultSplitResultDefragResultBytesParseResultBytesSplitResultBytes) ftphttpgophernntpimapwaisfilehttpsshttpmmsprosperortsprtspusftpsvnsvn+sshwswss)r   r   r   r   r   telnetr   r   r   r"   r    r!   snewsr#   r$   r%   rsyncr'   r(   r&   nfsgitzgit+sshr)   r*   )r   r   hdlr#   r   r   r    r!   r$   r%   sipsipsr"   r&   tel)
r   r0   mailtonewsr+   r   r   r,   r1   r2   )r   r   r   r   r    r!   r"   r   r$   r%   r1   r2   )r   r   r0   r   r   r5   r   r   r    r!   r,   r   r#   zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.)	
   c                  T    [         R                  5         [        R                  5         g)z,Clear the parse cache and the quoters cache.N)_parse_cacheclear_safe_quoters     N/home/james-whalen/.local/lib/python3.13/site-packages/bleach/_vendor/parse.pyclear_cacherA   V   s    r?   asciistrictc                     U $ Nr>   )objs    r@   _nooprG   e   s    Jr?   c                 $    U R                  X5      $ rE   encode)rF   encodingerrorss      r@   _encode_resultrM   h   s    ::h''r?   c                 2   ^^ [        UU4S jU  5       5      $ )Nc              3   X   >#    U  H  o(       a  UR                  TT5      OS v   M!     g7f)r   Ndecode.0xrK   rL   s     r@   	<genexpr>_decode_args.<locals>.<genexpr>n   s#     G$Qq(F+b8$s   '*)tuple)argsrK   rL   s    ``r@   _decode_argsrY   l   s    G$GGGr?   c                      [        U S   [        5      nU SS   H+  nU(       d  M  [        U[        5      U:w  d  M"  [        S5      e   U(       a
  U [        4-   $ [	        U 5      [
        4-   $ )Nr      z$Cannot mix str and non-str arguments)
isinstancestr	TypeErrorrG   rY   rM   )rX   	str_inputargs      r@   _coerce_argsra   p   si     47C(IABx 3:c3'94BCC	 
 uh 111r?   c                   &    \ rS rSrSrSrSS jrSrg)_ResultMixinStr   z>Standard approach to encoding parsed results from str to bytesr>   c                 :   ^^ U R                   " UU4S jU  5       6 $ )Nc              3   F   >#    U  H  oR                  TT5      v   M     g 7frE   rI   rR   s     r@   rU   )_ResultMixinStr.encode.<locals>.<genexpr>        *Tt!88Hf+E+Et   !)_encoded_counterpartselfrK   rL   s    ``r@   rJ   _ResultMixinStr.encode       ((*Tt*TUUr?   NrB   rC   )__name__
__module____qualname____firstlineno____doc__	__slots__rJ   __static_attributes__r>   r?   r@   rc   rc          HIVr?   rc   c                   &    \ rS rSrSrSrSS jrSrg)_ResultMixinBytes   z>Standard approach to decoding parsed results from bytes to strr>   c                 :   ^^ U R                   " UU4S jU  5       6 $ )Nc              3   F   >#    U  H  oR                  TT5      v   M     g 7frE   rP   rR   s     r@   rU   +_ResultMixinBytes.decode.<locals>.<genexpr>   rh   ri   )_decoded_counterpartrk   s    ``r@   rQ   _ResultMixinBytes.decode   rn   r?   Nro   )rp   rq   rr   rs   rt   ru   rQ   rv   r>   r?   r@   ry   ry      rw   r?   ry   c                   \    \ rS rSrSrSr\S 5       r\S 5       r\S 5       r	\S 5       r
Srg)	_NetlocResultMixinBase   zHShared methods for the parsed result objects containing a netloc elementr>   c                      U R                   S   $ )Nr   	_userinforl   s    r@   username_NetlocResultMixinBase.username       ~~a  r?   c                      U R                   S   $ )Nr[   r   r   s    r@   password_NetlocResultMixinBase.password   r   r?   c                     U R                   S   nU(       d  g [        U[        5      (       a  SOSnUR                  U5      u  pnUR	                  5       U-   U-   $ )Nr   %   %)	_hostinfor\   r]   	partitionlower)rl   hostname	separatorpercentzones        r@   r   _NetlocResultMixinBase.hostname   sW    >>!$ &h44C$	"*"4"4Y"?4~~')D00r?   c                 v    U R                   S   nUb&  [        US5      nSUs=::  a  S::  d  O  [        S5      eU$ )Nr[   
   r   i  zPort out of range 0-65535)r   int
ValueError)rl   ports     r@   r   _NetlocResultMixinBase.port   s?    ~~a tR=D$'%' !<==r?   N)rp   rq   rr   rs   rt   ru   propertyr   r   r   r   rv   r>   r?   r@   r   r      sX    RI! ! ! ! 1 1  r?   r   c                   8    \ rS rSrSr\S 5       r\S 5       rSrg)_NetlocResultMixinStr   r>   c                     U R                   nUR                  S5      u  p#nU(       a   UR                  S5      u  pVnU(       d  S nXW4$ S =pWXW4$ )N@:netloc
rpartitionr   rl   r   userinfo	have_infohostinfor   have_passwordr   s           r@   r   _NetlocResultMixinStr._userinfo   s^    (.(9(9#(>%X080B0B30G-HX  !! #'&H!!r?   c                 
   U R                   nUR                  S5      u    p#UR                  S5      u  p$nU(       a)  UR                  S5      u  pbnUR                  S5      u    p'OUR                  S5      u  pbnU(       d  S nXg4$ )Nr   []r   r   rl   r   _r   have_open_br	bracketedr   r   s           r@   r   _NetlocResultMixinStr._hostinfo   s    **3/1%-%7%7%<" ) 3 3C 8H,JAq$ ( 2 23 7HD~r?   N	rp   rq   rr   rs   ru   r   r   r   rv   r>   r?   r@   r   r      -    I	" 	"  r?   r   c                   8    \ rS rSrSr\S 5       r\S 5       rSrg)_NetlocResultMixinBytes   r>   c                     U R                   nUR                  S5      u  p#nU(       a   UR                  S5      u  pVnU(       d  S nXW4$ S =pWXW4$ )N   @   :r   r   s           r@   r   !_NetlocResultMixinBytes._userinfo   s^    (.(9(9$(?%X080B0B40H-HX  !! #'&H!!r?   c                 
   U R                   nUR                  S5      u    p#UR                  S5      u  p$nU(       a)  UR                  S5      u  pbnUR                  S5      u    p'OUR                  S5      u  pbnU(       d  S nXg4$ )Nr      [   ]r   r   r   s           r@   r   !_NetlocResultMixinBytes._hostinfo   s    **401%-%7%7%=" ) 3 3D 9H-JAq$ ( 2 24 8HD~r?   Nr   r>   r?   r@   r   r      r   r?   r   )
namedtupler   zurl fragmentr   z!scheme netloc path query fragmentr   z(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.
zr
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                       \ rS rSrSrS rSrg)r   i9  r>   c                 t    U R                   (       a  U R                  S-   U R                   -   $ U R                  $ )N#fragmenturlr   s    r@   geturlDefragResult.geturl;  s)    ==88c>DMM1188Or?   Nrp   rq   rr   rs   ru   r   rv   r>   r?   r@   r   r   9      Ir?   c                       \ rS rSrSrS rSrg)r   iA  r>   c                     [        U 5      $ rE   r   r   s    r@   r   SplitResult.geturlC      $r?   Nr   r>   r?   r@   r   r   A      I r?   c                       \ rS rSrSrS rSrg)r   iF  r>   c                     [        U 5      $ rE   r   r   s    r@   r   ParseResult.geturlH  r   r?   Nr   r>   r?   r@   r   r   F  r   r?   c                       \ rS rSrSrS rSrg)r   iL  r>   c                 t    U R                   (       a  U R                  S-   U R                   -   $ U R                  $ )N   #r   r   s    r@   r   DefragResultBytes.geturlN  s)    ==88d?T]]2288Or?   Nr   r>   r?   r@   r   r   L  r   r?   r   c                       \ rS rSrSrS rSrg)r   iT  r>   c                     [        U 5      $ rE   r   r   s    r@   r   SplitResultBytes.geturlV  r   r?   Nr   r>   r?   r@   r   r   T  r   r?   r   c                       \ rS rSrSrS rSrg)r   iY  r>   c                     [        U 5      $ rE   r   r   s    r@   r   ParseResultBytes.geturl[  r   r?   Nr   r>   r?   r@   r   r   Y  r   r?   r   c                  x    [         [        4[        [        4[        [
        44n U  H  u  pX!l        Xl        M     g rE   )r   r   r   r   r   r   rj   r~   )_result_pairs_decoded_encodeds      r@   _fix_result_transcodingr   _  s?    	()	&'	&'M
 ,(0%(0% ,r?   r   c                     [        X5      u  pn[        XU5      nUu  ppnU[        ;   a  SU ;   a  [        U 5      u  pOSn[	        XXXg5      n	U" U	5      $ )a  Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes.;r   )ra   r   uses_params_splitparamsr   )
r   schemeallow_fragments_coerce_resultsplitresultr   queryr   paramsresults
             r@   r   r   l  se     #/s";C38K+6(FC"3'VeFF&!!r?   c                     SU ;   a,  U R                  SU R                  S5      5      nUS:  a  U S4$ OU R                  S5      nU S U XS-   S  4$ )N/r   r   r   r[   )findrfind)r   is     r@   r   r   |  s^    
s{HHS#))C.)q57N  HHSMr7C!Ir?   c                     [        U 5      nS H'  nU R                  X15      nUS:  d  M  [        X$5      nM)     XU XS  4$ )Nz/?#r   )lenr   min)r   startdelimcwdelims        r@   _splitnetlocr     sJ    HE!#Q;&E  US[((r?   c                 N   U (       a  [        S U  5       5      (       d  g SS KnU R                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SU5      nX#:X  a  g S	 H  nXC;   d  M
  [	        S
U -   S-   S-   5      e   g )Nc              3   >   #    U  H  n[        U5      S :  v   M     g7f)   N)ordrS   r   s     r@   rU   _checknetloc.<locals>.<genexpr>  s     :6aSVc\6s   r   r   r   r   r   ?NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)anyunicodedatareplace	normalizer   )r   r  nnetloc2r   s        r@   _checknetlocr    s    :6::: sBA			#rA			#rA			#rA##FA.G|<Z&03HHBC D D r?   c                 D    [          H  nU R                  US5      n M     U $ )Nr   )_UNSAFE_URL_BYTES_TO_REMOVEr	  )r   bs     r@   _remove_unsafe_bytes_from_urlr    s!    (kk!R  )Jr?   c                    [        X5      u  pn[        U 5      n [        U5      n[        U5      nXU[        U 5      [        U5      4n[        R                  US5      nU(       a  U" U5      $ [        [        5      [        :  a
  [        5         S=n=pxU R                  S5      n	U	S:  Ga  U SU	 S:X  a  U SU	 R                  5       nX	S-   S n U SS S:X  a1  [        U S5      u  p`S	U;   a  S
U;  d  S
U;   a  S	U;  a  [        S5      eU(       a  SU ;   a  U R                  SS5      u  pSU ;   a  U R                  SS5      u  p[        U5        [        XXU5      n
U
[        U'   U" U
5      $ U SU	  H  nU[         ;  d  M    O;   X	S-   S nU(       a  [#        S U 5       5      (       a  U SU	 R                  5       UpU SS S:X  a1  [        U S5      u  p`S	U;   a  S
U;  d  S
U;   a  S	U;  a  [        S5      eU(       a  SU ;   a  U R                  SS5      u  pSU ;   a  U R                  SS5      u  p[        U5        [        XXU5      n
U
[        U'   U" U
5      $ )a  Parse a URL into 5 components:
<scheme>://<netloc>/<path>?<query>#<fragment>
Return a 5-tuple: (scheme, netloc, path, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes.Nr   r   r   r   r[      //r   r   zInvalid IPv6 URLr   r  c              3   *   #    U  H	  oS ;  v   M     g7f)
0123456789Nr>   r  s     r@   rU   urlsplit.<locals>.<genexpr>  s     Cd4ds   )ra   r  booltyper;   getr   MAX_CACHE_SIZErA   r   r   r   r   splitr  r   scheme_charsr  )r   r   r   r   keycachedr   r   r   r   vr   rests                r@   r   r     sZ    #/s";C
'
,C*62F?+O
S	4<
?Cc4(Ff%%
<N* ""F"UA1ur7f!W]]_Fcd)C2Aw$*32F]s&'83f+<$%7883#: #		#q 1cz YYsA.
 FCAA !L!!$$RaA$  st9D3CdCCC!"1gmmot
2Aw$"3*F]s&03f#4/003#:		#q)
czYYsA&
FC9AL!r?   c           	      d    [        U 6 u  pp4pVnU(       a	  U< SU< 3nU" [        XX5U45      5      $ )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   )ra   r   )
componentsr   r   r   r   r   r   r   s           r@   r   r     s>     3?
2K AFC.f%*fc(%KLMMr?   c                    [        U 6 u  pp4pVU(       d  U(       a9  U[        ;   a/  USS S:w  a&  U(       a  USS S:w  a  SU-   nSU=(       d    S-   U-   nU(       a  US-   U-   nU(       a  US-   U-   nU(       a  US	-   U-   nU" U5      $ )
a[  Combine 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).Nr  r  r[   r   r   r   r  r   )ra   uses_netloc)r#  r   r   r   r   r   r   s          r@   r   r     s     +7
*C 9FC&V{2s2Aw$3r7c>s3fl#c)slS Ci%Ci("#r?   c           
      H   U (       d  U$ U(       d  U $ [        X5      u  pn[        U SU5      u  pEpgp[        XU5      u  pppX:w  d
  U
[        ;  a  U" U5      $ U
[        ;   a  U(       a  U" [	        XUXU45      5      $ UnU(       d)  U(       d"  UnUnU(       d  UnU" [	        XUXU45      5      $ UR                  S5      nUS   S:w  a  US	 USS S:X  a  UR                  S5      nO&UUR                  S5      -   n[        SUSS 5      USS& / nU H5  nUS:X  a   UR                  5         M  US:X  a  M$  UR                  U5        M7     US   S;   a  UR                  S5        U" [	        XSR                  U5      =(       d    SXU45      5      $ ! [         a     M  f = f)	z]Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.r   r   Nr[   ...)r)  r(  )ra   r   uses_relativer%  r   r  filterpop
IndexErrorappendjoin)baser   r   r   bschemebnetlocbpathbparamsbquery	bfragmentr   r   pathr   r   r   
base_partssegmentsresolved_pathsegs                       r@   r   r     s    
 ,T 7D~T2/ 8Gef S?3 2FD% F-7c""!*fd.4X.G #H I IEj&$*0*C D E 	E S!J"~ rN BQx3::c?

3/  hqn52M$;!!#
 CZ  %  |{" 	R *fchh7 7vh&8 9 : :   s   F
F! F!c                     [        U 5      u  pSU ;   a  [        U 5      u  p#pEpg[        X#XEUS45      nOSnU nU" [        X5      5      $ )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.
r   r   )ra   r   r   r   )	r   r   sr  paqfragdefrags	            r@   r   r   C  sU     's+C
cz&smaAQ1B/0,v455r?   0123456789ABCDEFabcdefc                 L   U (       d  U R                     g[        U [        5      (       a  U R                  S5      n U R                  S5      n[	        U5      S:X  a  U $ US   /nUR
                  n[        cN  [         VVs0 s H:  n[          H,  nXE-   R                  5       [        [        XE-   S5      /5      _M.     M<     snnqUSS  H!  n U" [        USS    5        U" USS 5        M#     SR                  U5      $ s  snnf ! [         a    U" S5        U" U5         MY  f = f)	z,unquote_to_bytes('abc%20def') -> b'abc def'.r?   utf-8r   r[   r   N   r  )r  r\   r]   rJ   r   r.  
_hextobyte_hexdigbytesr   KeyErrorr/  )stringbitsresr.  r?  r  items          r@   r   r   V  s    &#w'<<D
4yA~7)CZZF &9&!1 unn&s15"~.>(??07 '&9
QR	:d2Ah'(48  88C=9  	4L4L	s   ?AC?DD#"D#z([ -]+)c                 F   SU ;  a  U R                     U $ Uc  SnUc  Sn[        R                  U 5      nUS   /nUR                  n[        S[	        U5      S5       H2  nU" [        X6   5      R                  X5      5        U" X6S-      5        M4     SR                  U5      $ )az  Replace %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'.
r   rE  r	  r   r[   r  r   )r  _asciirer.  ranger   r   rQ   r/  )rK  rK   rL   rL  rM  r.  r   s          r@   r   r   v  s     &~>>&!D7)CZZF1c$i#(//ABtE{ $ 773<r?   Fc           
      v    0 n[        XUX4XVS9nU H$  u  pX;   a  Xy   R                  U
5        M  U
/Xy'   M&     U$ )a  Parse 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.
)rK   rL   max_num_fieldsr   )r   r.  )qskeep_blank_valuesstrict_parsingrK   rL   rS  r   parsed_resultpairsnamevalues              r@   r
   r
     sU    < Mb^'%3JE  &&u-#('M	 
 r?   c                    [        U 5      u  pU(       a  [        U[        [        45      (       d  [	        S5      eUb$  SU R                  U5      -   nXX:  a  [	        S5      eU R                  U5       V	s/ s H  oPM     n
n	/ nU
 H  nU(       d	  U(       d  M  UR                  SS5      n[        U5      S:w  a1  U(       a  [	        SU< 35      eU(       a  UR                  S5        OMe  [        US   5      (       d	  U(       d  M  US   R                  S	S
5      n[        XUS9nU" U5      nUS   R                  S	S
5      n[        XUS9nU" U5      nUR                  X45        M     U$ s  sn	f )a  Parse 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.r[   zMax number of fields exceeded=r  zbad query field: r   r   + )rK   rL   )ra   r\   r]   rI  r   countr  r   r.  r	  r   )rT  rU  rV  rK   rL   rS  r   r   
num_fieldss1rX  r
name_valuenvrY  rZ  s                   r@   r   r     sS   : &b)BZ	C<@@EFF
 !),,
&<==((9-.-BR-E.
A
.c1%r7a< *!FGG 		"r!u::**a5==c*D46BD!$'DqEMM#s+EEVDE"5)EHHd]#' ( H- /s   5E-c                 >    U R                  SS5      n [        XU5      $ )zLike unquote(), but also replace plus signs by spaces, as required for
unquoting HTML form values.

unquote_plus('%7e/abc+def') -> '~/abc def'
r]  r^  )r	  r   )rK  rK   rL   s      r@   r   r     s!     ^^C%F6V,,r?   sA   ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-c                   *    \ rS rSrSrS rS rS rSrg)Quoteri  zA 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).
c                 8    [         R                  U5      U l        g)zsafe: bytes object.N)_ALWAYS_SAFEunionsafe)rl   rk  s     r@   __init__Quoter.__init__  s     &&t,	r?   c                 R    SU R                   R                  < S[        U 5      < S3$ )N<r^  >)	__class__rp   dictr   s    r@   __repr__Quoter.__repr__  s     NN33T$Z@@r?   c                 d    XR                   ;   a  [        U5      OSR                  U5      nX U'   U$ )Nz%{:02X})rk  chrformat)rl   r  rM  s      r@   __missing__Quoter.__missing__  s,    YYc!fI,<,<Q,?Q
r?   )rk  N)	rp   rq   rr   rs   rt   rl  rs  rx  rv   r>   r?   r@   rg  rg    s    -Ar?   rg  c                     [        U [        5      (       a%  U (       d  U $ Uc  SnUc  SnU R                  X#5      n OUb  [        S5      eUb  [        S5      e[	        X5      $ )a\  quote('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.

RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
the following reserved characters.

reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
              "$" | ","

Each of these characters is reserved in some component of a URL,
but not necessarily in all of them.

By default, the quote function is intended for quoting the path
section of a URL.  Thus, it will not encode '/'.  This character
is reserved, but in typical usage the quote function is being
called on a path where the existing slash characters are used as
reserved 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).
rE  rC   z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r\   r]   rJ   r^   r   )rK  rk  rK   rL   s       r@   r   r   "  sk    : &#MH>Fx0JKKHIIF))r?   c                     [        U [        5      (       a  SU ;  d  [        U [        5      (       a  SU ;  a  [        XX#5      $ [        U[        5      (       a  SnOSn[        XU-   X#5      n U R	                  SS5      $ )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]  )r\   r]   rI  r   r	  )rK  rk  rK   rL   spaces        r@   r   r   N  sq     
FC	 	 S%6	FE	"	"t6'9V844$6%<:F>>#s##r?   c                     [        U [        [        45      (       d  [        S5      eU (       d  g[        U[        5      (       a  UR                  SS5      nO#[        U Vs/ s H  o"S:  d  M
  UPM     sn5      nU R                  [        U-   5      (       d  U R                  5       $  [        U   nSR                  U  Vs/ s H
  oC" U5      PM     sn5      $ s  snf ! [         a!    [        U5      R                  =[        U'   n NVf = fs  snf )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 bytesr   rB   ignore   )r\   rI  	bytearrayr^   r]   rJ   rstrip_ALWAYS_SAFE_BYTESrQ   r=   rJ  rg  __getitem__r/  )bsrk  r   quoterchars        r@   r   r   _  s    
 b5),--;<<${{7H-1ASa1299'$.//yy{@t$ 77R0RTF4LR011 2
  @'-d|'?'??df@0s$    	C-C(	C  D(DDc                    [        U S5      (       a  U R                  5       n O/ [        U 5      (       a  [        U S   [        5      (       d  [
        e/ n	U(       d  U  H~  u  p[        U
[        5      (       a	  U" X5      n
OU" [        U
5      X#U5      n
[        U[        5      (       a	  U" X5      nOU" [        U5      X#U5      nU	R                  U
S-   U-   5        M     GOU  GH  u  p[        U
[        5      (       a	  U" X5      n
OU" [        U
5      X#U5      n
[        U[        5      (       a!  U" X5      nU	R                  U
S-   U-   5        Mm  [        U[        5      (       a"  U" XX45      nU	R                  U
S-   U-   5        M   [        U5      nU HK  n[        U[        5      (       a	  U" X5      nOU" [        U5      X#U5      nU	R                  U
S-   U-   5        MM     GM     SR                  U	5      $ ! [
         a3    [        R                  " 5       u  pgn[        S5      R                  U5      ef = f! [
         a/    U" [        U5      X#U5      nU	R                  U
S-   U-   5         GM  f = f)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).
itemsr   z1not a valid non-string sequence or mapping objectr\  &)hasattrr  r   r\   rW   r^   sysexc_infowith_tracebackrI  r]   r.  r/  )r   doseqrk  rK   rL   	quote_viatyvatblkr   rT   elts                 r@   r	   r	   u  s.   " ug	D 5zz*U1Xu"="= 	ADA!U##a&c!fdf=!U##a&c!fdf=HHQWq[!  DA!U##a&c!fdf=!U##a&S1%As##ax8S1%0AA  !%c511"+C"6C"+CHdf"MCS3/  !- 8 88A;_  	DJBB 0 11?1CD	DF ! *!#a&$&AAHHQWq[))*s   .G: H::=H7:4I32I3c                     [        U [        5      (       a"   U R                  S5      R                  5       n U $ U $ ! [         a    [	        S[        U 5      -   S-   5      ef = f)zto_bytes(u"URL") --> 'URL'.ASCIIzURL z contains non-ASCII characters)r\   r]   rJ   rQ   UnicodeErrorreprr   s    r@   to_bytesr    so    
 #s	A**W%,,.C J3J  	AvS	1? @ A A	As	   : %Ac                     [        U 5      R                  5       n U SS S:X  a  U SS S:X  a  U SS R                  5       n U SS S:X  a  U SS R                  5       n U $ )z8unwrap('<URL:type://host/path>') --> 'type://host/path'.Nr[   ro  r'  rp     zURL:)r]   stripr  s    r@   unwrapr    s`    
c(..
C
2Aw#~#bc(c/!Bioo
2Aw&AB#Jr?   c                     [         c%  [        R                  " S[        R                  5      q [         R	                  U 5      nU(       a$  UR                  5       u  p#UR                  5       U4$ SU 4$ )z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz([^/:]+):(.*))	_typeprogrecompileDOTALLmatchgroupsr   )r   r  r   datas       r@   	splittyper    sW     JJ		:	OOC E||~||~t##9r?   c                     [         c%  [        R                  " S[        R                  5      q [         R	                  U 5      nU(       a*  UR                  5       u  p#U(       a  US   S:w  a  SU-   nX#4$ SU 4$ )z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)r   r   )	_hostprogr  r  r  r  r  )r   r  	host_portr7  s       r@   	splithostr    se     JJ0"))<	OOC E,,.	DGsN:D9r?   c                 F    U R                  S5      u  pn U(       a  X4$ SU 4$ )zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r   Nr   )hostuserr   s      r@   	splituserr    s*    ,DD**td**r?   c                 D    U R                  S5      u  pnX(       a  U4$ S4$ )z/splitpasswd('user:passwd') -> 'user', 'passwd'.r   Nr   )r  r   passwds      r@   splitpasswdr    s*    ..-DE&,,t,,r?   c                     [         c%  [        R                  " S[        R                  5      q [         R	                  U 5      nU(       a  UR                  5       u  pU(       a  X4$ U S4$ )z*splitport('host:port') --> 'host', 'port'.Nz(.*):([0-9]*)$)	_portprogr  r  r  r  r  )r  r  r   s      r@   	splitportr    sR     JJ/;	OOD!E\\^
::r?   c                     U R                  S5      u  pnU(       d  Un X4$ U(       a   [        U5      nX4$ X4$ ! [         a    Sn X4$ f = f)zSplit host and port, returning numeric port.
Return given default port if no ':' found; defaults to -1.
Return numerical port if a valid number are found after ':'.
Return None if ':' but not a valid number.r   N)r   r   r   )r  defportr   r   nports        r@   
splitnportr    sl    
 ,D = 
	IE {=  	E{	s   : A
Ac                 F    U R                  S5      u  pnU(       a  X4$ U S4$ )z/splitquery('/path?query') --> '/path', 'query'.r  Nr  )r   r7  r   r   s       r@   
splitqueryr    s*    ,D{9r?   c                 F    U R                  S5      u  pnU(       a  X4$ U S4$ )z)splittag('/path#tag') --> '/path', 'tag'.r   Nr  )r   r7  r   tags       r@   splittagr  &  s*    ~~c*Dy9r?   c                 8    U R                  S5      nUS   USS 4$ )zcsplitattr('/path;attr1=value1;attr2=value2;...') ->
'/path', ['attr1=value1', 'attr2=value2', ...].r   r   r[   N)r  )r   wordss     r@   	splitattrr  -  s&     IIcNE8U12Yr?   c                 D    U R                  S5      u  pnX(       a  U4$ S4$ )z-splitvalue('attr=value') --> 'attr', 'value'.r\  Nr  )attrr   rZ  s      r@   
splitvaluer  3  s*    ,D5%++d++r?   )r   T)r   )T)rE  r	  )FFrE  r	  Nr  )r   NN)r   NN)r   )r'  )\rt   r  r  collections__all__r*  r%  r   non_hierarchical
uses_queryuses_fragmentr  r  r  r;   rA   _implicit_encoding_implicit_errorsrG   rM   rY   ra   objectrc   ry   r   r   r   r   _DefragResultBase_SplitResultBase_ParseResultBaser   r   r   r   r7  r   r   
ResultBaser   r   r   r   r   r   r   r   r   r   r  r  r   r   r   r   r   rH  rG  r   r  rP  r   r
   r   r   	frozensetri  rI  r  r=   defaultdictrg  r   r   r   r	   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r>   r?   r@   <module>r     s  : 
 
 H0
%F 8
%
 1      "4/( !3.H2"Vf VV VV B2O <46G < #~~> 68 =?    !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$
:x	N&B:J6  #
< ::&'4 :?PS'T ;@QT@D-    ! <( [$$ ,**X$"2, !rD"N` 	
 	+
- 	 ,r?   