4V=jddlmZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd l mZd(dZejded)dZegedddRZedeZededzZededzZededzZd*d Zd+d"Zd#ejjvrejjd#d,d%Zd-d'Z dS).) annotationsN)quote)unquote) urlencode)urlsplit) urlunsplit)iter_multi_itemse UnicodeErrorreturntuple[str, int]cdt|j|j|jd}||jfS)zRUsed in :func:`uri_to_iri` after unquoting to re-quote any invalid bytes. safe)robjectstartend)r outs ;C:\PYTHON\_runtimes\venv\Lib\site-packages\werkzeug/urls.py_codec_error_url_quoters1 15) 3 3 3C :werkzeug.url_quotenamestrcharst.Callable[[str], str]cddt|D}tjd|dtjd fd }d ||_|S) zCreate a function that unquotes all percent encoded characters except those given. This allows working with unquoted characters if possible while not changing the meaning of a given part of a URL. |c38K|]}t|dVdS)02XN)ord).0cs r z%_make_unquote_part.."s,>>1#a&&>>>>>>rz((?:%(?:z))+)valuerr ct|}g}|D]I}|t|dd|t |dJd|S)Nzutf-8rr)itersplitappendrnextjoin)r'partsrpartpatterns r_unquote_partialz,_make_unquote_part.._unquote_partial%s|W]]5))** ( (D JJwtW.BCC D D D JJtE2 ' ' ' 'wws||r _unquote_)r'rr r)r-sortedrecompileI__name__)rrchoicesr1r0s @r_make_unquote_partr9s hh>>u >>>>>Gj1G1112488G!3D 2 2 r!%fragmentqueryz&=+#pathz/?#userz:@/?#urict|}t|j}t|j}t |j}|jrt|j}nd}d|vrd|d}|j r |d|j }|j r=t|j }|j rt|j }|d|}|d|}t|j||||fS)a-Convert a URI to an IRI. All valid UTF-8 characters are unquoted, leaving all reserved and invalid characters quoted. If the URL has a domain, it is decoded from Punycode. >>> uri_to_iri("http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF") 'http://\u2603.net/p\xe5th?q=\xe8ry%DF' :param uri: The URI to convert. .. versionchanged:: 3.0 Passing a tuple or bytes, and the ``charset`` and ``errors`` parameters, are removed. .. versionchanged:: 2.3 Which characters remain quoted is specific to each part of the URL. .. versionchanged:: 0.15 All reserved and invalid characters remain quoted. Previously, only some reserved characters were preserved, and invalid bytes were replaced instead of left quoted. .. versionadded:: 0.6 r:[]@)r _unquote_pathr?_unquote_queryr>_unquote_fragmentr=hostname _decode_idnaportusername _unquote_userpasswordrscheme)rAr.r?r>r=netlocauthrOs r uri_to_irirS=s0 SMME  $ $D 5; ' 'E 00H ~en-- f}}V z*))UZ)) ~$U^,, > ($U^44H''X''D##6## u|VT5(C D DDririct|}t|jd}t|jd}t|jd}|jr.|jdd}nd}d|vrd |d }|jr |d|j}|j rAt|j d }|j rt|j d }|d|}|d |}t|j ||||fS) a,Convert an IRI to a URI. All non-ASCII and unsafe characters are quoted. If the URL has a domain, it is encoded to Punycode. >>> iri_to_uri('http://\u2603.net/p\xe5th?q=\xe8ry%DF') 'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF' :param iri: The IRI to convert. .. versionchanged:: 3.0 Passing a tuple or bytes, the ``charset`` and ``errors`` parameters, and the ``safe_conversion`` parameter, are removed. .. versionchanged:: 2.3 Which characters remain unquoted is specific to each part of the URL. .. versionchanged:: 0.15 All reserved characters remain unquoted. Previously, only some reserved characters were left unquoted. .. versionchanged:: 0.9.6 The ``safe_conversion`` parameter was added. .. versionadded:: 0.6 z%!$&'()*+,/:;=@rz%!$&'()*+,/:;=?@z%!#$&'()*+,/:;=?@idnaasciirrCrDrEz %!$&'()*+,;=rF) rrr?r>r=rJencodedecoderLrMrOrrP)rTr.r?r>r=rQrRrOs r iri_to_urirZqs62 SMME "3 4 4 4D %+$6 7 7 7EU^*=>>>H ~&&v..55g>> f}}V z*))UZ)) ~$U^.999 > (U^.AAAH''X''D##6## u|VT5(C D DDrz itms-servicesdomainc |d}n#t$r|cYSwxYw |dS#t$rYnwxYwg}|dD]c} ||d,#t$r+||dY`wxYwd|S)NrWrV..)rXUnicodeEncodeErrorrYUnicodeDecodeErrorr*r+r-)r[datar.r/s rrKrKs}}W%%   {{6"""       E 4  // / LLV,, - - - -! / / / LLW-- . . . . . / 88E??s/ ''A A  A *(B2CC1t.Mapping[str, str] | t.Iterable[tuple[str, str]]cVdt|D}t|dS)Nc"g|] }|d | S)r )r$xs r z_urlencode..s! D D D11Q43CQ3C3C3Crz !$'()*,/:;?@r)r r)r>itemss r _urlencoderis1 D D(// D D DE U 0 0 00r)r r r r)rrrrr r)rArr r)rTrr r)r[rr r)r>rbr r)! __future__rcodecsr4typingt urllib.parseurllibrrrrrdatastructuresr rregister_errorr9bytesrangerY_always_unsaferIrHrGrNrSrZparse uses_netlocr+rKrirerrrws """"""  """"""!!!!!!######,,,,,,*,BCCC21t1d1D112299;;&&z>BB##G^f-DEE""6>E+ABB ""6>G+CDD 1E1E1E1Eh4E4E4E4Et&,222 L##O4442111111r