Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 N”ªja›ã@sddZddlZddlZddlZddddddd d d d d ddddddddddgZddddddddd d!d"d#d$d%d&d'd(d)d*gZdddddd+dddd"d d!d,d#d$d%d-d'd(d&d.d/d0d)d*gZddd1d#ddd d!d$d%d2d3d"d&d4gZdd1d5d6d+ddd,d2d3g Zddddd d!d"dd$d%d2d3g Z ddd1ddd6ddd d!d,dd#g Z d7Z d8Z d9d:d;gZ d„Zd?Zd@ZdAdB„ZeefdCdD„ZeefdEdF„ZdGdH„ZGdIdJ„dJeƒZGdKdL„dLeƒZGdMdN„dNeƒZGdOdP„dPeeƒZGdQdR„dReeƒZddSlmZeddTƒZeddUƒZeddVƒZ dWe_dXej!_dYej"_dZe_d[ej#_d\ej$_d]ej%_d^ej&_d_ej"_d`e _ej#je j#_ej$je j$_ej%je j%_dae j'_ej&je j&_ej"je j"_eZ(Gdbd„deeƒZ)Gdcd„deeƒZ*Gddd„de eƒZ+Gded„deeƒZ,Gdfd„deeƒZ-Gdgd„de eƒZ.dhdi„Z/e/ƒ[/d¥dkd„Z0dldm„Z1d¦dndo„Z2dpdq„Z3drds„Z4d§dtd„Z5dud„Z6dvd„Z7d¨dwd„Z8dxd„Z9dyZ:da;dzd„Zd©d~d„Z?dªd�d „Z@d«d‚d „ZAd¬dƒd„ZBeCd„ƒZDeEeDƒZFiZGGd…d†„d†ejHƒZId­dˆd „ZJd®d‰d „ZKd¯dŠd„ZLddddeKfd‹d „ZMdŒd�„ZNdŽd�„ZOdaPd�d‘„ZQdaRd’d“„ZSd”d•„ZTd–d—„ZUdaVd˜d™„ZWd±d›dœ„ZXd�dž„ZYdŸd „ZZd¡d¢„Z[d£d¤„Z\dS)²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Ú 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ÚZftpÚhttpZgopherZnntpZimapZwaisÚfileZhttpsZshttpZmmsZprosperoZrtspZrtspuZsftpZsvnzsvn+sshZwsZwssZtelnetZsnewsZrsyncZnfsZgitzgit+sshZhdlZsipZsipsZtelZmailtoZnewszAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!  ú ú Ú écCstjƒtjƒdS)z,Clear the parse cache and the quoters cache.N)Ú _parse_cacheÚclearÚ _safe_quoters©r!r!ú/usr/lib64/python3.6/parse.pyÚ clear_cache^sr#ÚasciiÚstrictcCs|S)Nr!)Úobjr!r!r"Ú_noopmsr'cCs |j||ƒS)N)Úencode)r&ÚencodingÚerrorsr!r!r"Ú_encode_resultpsr+cst‡‡fdd„|DƒƒS)Nc3s"|]}|r|jˆˆƒndVqdS)rN)Údecode)Ú.0Úx)r)r*r!r"ú vsz_decode_args..)Útuple)Úargsr)r*r!)r)r*r"Ú _decode_argstsr2cGsZt|dtƒ}x.|dd…D]}|rt|tƒ|krtdƒ‚qW|rL|tfSt|ƒtfS)Nréz$Cannot mix str and non-str arguments)Ú isinstanceÚstrÚ TypeErrorr'r2r+)r1Z str_inputÚargr!r!r"Ú _coerce_argsxs  r8c@seZdZdZfZddd„ZdS)Ú_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr$r%cs|j‡‡fdd„|DƒŽS)Nc3s|]}|jˆˆƒVqdS)N)r()r-r.)r)r*r!r"r/Žsz)_ResultMixinStr.encode..)Ú_encoded_counterpart)Úselfr)r*r!)r)r*r"r(�sz_ResultMixinStr.encodeN)r$r%)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__r(r!r!r!r"r9‰sr9c@seZdZdZfZddd„ZdS)Ú_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr$r%cs|j‡‡fdd„|DƒŽS)Nc3s|]}|jˆˆƒVqdS)N)r,)r-r.)r)r*r!r"r/–sz+_ResultMixinBytes.decode..)Ú_decoded_counterpart)r;r)r*r!)r)r*r"r,•sz_ResultMixinBytes.decodeN)r$r%)r<r=r>r?r@r,r!r!r!r"rA‘srAc@sDeZdZdZfZedd„ƒZedd„ƒZedd„ƒZedd „ƒZ d S) Ú_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementcCs |jdS)Nr)Ú _userinfo)r;r!r!r"Úusername�sz_NetlocResultMixinBase.usernamecCs |jdS)Nr3)rD)r;r!r!r"Úpassword¡sz_NetlocResultMixinBase.passwordcCsD|jd}|sdSt|tƒr dnd}|j|ƒ\}}}|jƒ||S)Nrú%ó%)Ú _hostinfor4r5Ú partitionÚlower)r;ÚhostnameÚ separatorZpercentZzoner!r!r"rL¥s  z_NetlocResultMixinBase.hostnamecCs@|jd}|dk rr?r@ÚpropertyrErFrLrQr!r!r!r"rC™s    rCc@s(eZdZfZedd„ƒZedd„ƒZdS)Ú_NetlocResultMixinStrcCsD|j}|jdƒ\}}}|r4|jdƒ\}}}|sr@rRrDrIr!r!r!r"rSºs rSc@s(eZdZfZedd„ƒZedd„ƒZdS)Ú_NetlocResultMixinBytescCsD|j}|jdƒ\}}}|r4|jdƒ\}}}|sr@rRrDrIr!r!r!r"raØs ra)Ú namedtuplez url fragmentz!scheme netloc path query fragmentz(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@seZdZfZdd„ZdS)rcCs |jr|jd|jS|jSdS)Nú#)ÚfragmentÚurl)r;r!r!r"ÚgeturlCszDefragResult.geturlN)r<r=r>r@rjr!r!r!r"rAsc@seZdZfZdd„ZdS)rcCst|ƒS)N)r)r;r!r!r"rjKszSplitResult.geturlN)r<r=r>r@rjr!r!r!r"rIsc@seZdZfZdd„ZdS)rcCst|ƒS)N)r)r;r!r!r"rjPszParseResult.geturlN)r<r=r>r@rjr!r!r!r"rNsc@seZdZfZdd„ZdS)rcCs |jr|jd|jS|jSdS)Nó#)rhri)r;r!r!r"rjVszDefragResultBytes.geturlN)r<r=r>r@rjr!r!r!r"rTsc@seZdZfZdd„ZdS)rcCst|ƒS)N)r)r;r!r!r"rj^szSplitResultBytes.geturlN)r<r=r>r@rjr!r!r!r"r\sc@seZdZfZdd„ZdS)rcCst|ƒS)N)r)r;r!r!r"rjcszParseResultBytes.geturlN)r<r=r>r@rjr!r!r!r"rascCs8ttfttfttff}x|D]\}}||_||_qWdS)N)rrrrrrr:rB)Z _result_pairsZ_decodedZ_encodedr!r!r"Ú_fix_result_transcodinggs  rlTc Csft||ƒ\}}}t|||ƒ}|\}}}}}|tkrHd|krHt|ƒ\}}nd}t||||||ƒ} || ƒS)a#Parse a URL into 6 components: :///;?# 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)r8rÚ uses_paramsÚ _splitparamsr) riÚschemeÚallow_fragmentsÚ_coerce_resultZ splitresultrVÚqueryrhÚparamsÚresultr!r!r"rts cCsRd|kr,|jd|jdƒƒ}|dkr6|dfSn |jdƒ}|d|…||dd…fS)Nú/rmrrr3)ÚfindÚrfind)riÚir!r!r"ro„s   rocCsLt|ƒ}x*dD]"}|j||ƒ}|dkrt||ƒ}qW|||…||d…fS)Nz/?#r)ÚlenrwÚmin)riÚstartÚdelimÚcZwdelimr!r!r"Ú _splitnetloc�s   rcCsœ| stdd„|Dƒƒ rdSddl}|jddƒ}|jddƒ}|jddƒ}|jddƒ}|jd |ƒ}||krndSx(d D] }||krttd |d d ƒ‚qtWdS)Ncss|]}t|ƒdkVqdS)éN)Úord)r-r~r!r!r"r/–sz_checknetloc..rrTrrUrgú?ÚNFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)ÚanyÚ unicodedataÚreplaceÚ normalizerP)rVr…ÚnZnetloc2r~r!r!r"Ú _checknetloc•s       r‰cCsxtD]}|j|dƒ}qW|S)Nr)Ú_UNSAFE_URL_BYTES_TO_REMOVEr†)riÚbr!r!r"Ú_remove_unsafe_bytes_from_url§s rŒc Cs–t||ƒ\}}}t|ƒ}t|ƒ}|jtƒ}|jtƒ}t|ƒ}|||t|ƒt|ƒf}tj|dƒ}|rj||ƒSt tƒt kr|t ƒd}}}|j dƒ} | dk�rä|d| …dk�r~|d| …j ƒ}|| dd…}|dd…dk�rt|dƒ\}}d |koüd |k�sd |k�rd |k�rtd ƒ‚|�r:///?# 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.NrrUrrr3éz//r\r]zInvalid IPv6 URLrgr‚css|]}|dkVqdS)Ú 0123456789Nr!)r-r~r!r!r"r/Úszurlsplit..)r8rŒÚlstripÚ_WHATWG_C0_CONTROL_OR_SPACEÚstripÚboolÚtyperÚgetrzÚMAX_CACHE_SIZEr#rwrKrrPÚsplitr‰rÚ scheme_charsr„) rirprqrrÚkeyÚcachedrVrsrhryÚvr~Úrestr!r!r"r¬sd          cCs<t|Ž\}}}}}}}|r&d||f}|t|||||fƒƒS)zúPut 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)r8r)Ú componentsrprVrirtrsrhrrr!r!r"rìs cCs˜t|Ž\}}}}}}|s4|r`|tkr`|dd…dkr`|rP|dd…dkrPd|}d|pXd|}|rp|d|}|r€|d|}|r�|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).Nr�z//r3rvrrUr‚rg)r8Ú uses_netloc)rœrprVrirsrhrrr!r!r"r÷s    c CsÀ|s|S|s|St||ƒ\}}}t|d|ƒ\}}}}}} t|||ƒ\} } } } }}| |ks`| tkrh||ƒS| tkr�| rŒ|t| | | | ||fƒƒS|} | rÄ| rÄ|} |} |s¬|}|t| | | | ||fƒƒS|jdƒ}|ddkrà|d=| dd…dk�rþ| jdƒ}n(|| jdƒ}td|dd …ƒ|dd …<g}xX|D]P}|dk�rdy |jƒWntk �r`YnXn|dk�rt�q0n |j |ƒ�q0W|d d k�rœ|j dƒ|t| | dj |ƒ�p²d| ||fƒƒS) zaJoin a base URL and a possibly relative URL to form an absolute interpretation of the latter.rrvr3Nú..Ú.éÿÿÿÿr r r r )rŸrž) r8rÚ uses_relativer�rr–ÚfilterÚpopÚ IndexErrorÚappendÚjoin)ÚbaserirqrrZbschemeZbnetlocZbpathZbparamsZbqueryZ bfragmentrprVÚpathrtrsrhZ base_partsZsegmentsZ resolved_pathZsegr!r!r"r sT            c CsTt|ƒ\}}d|kr>t|ƒ\}}}}}}t|||||dfƒ}nd}|}|t||ƒƒS)z¿Removes 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. rgr)r8rrr) rirrÚsrˆÚpÚaÚqZfragZdefragr!r!r"rOs Z0123456789ABCDEFabcdefc CsÐ|s|jdSt|tƒr"|jdƒ}|jdƒ}t|ƒdkr<|S|dg}|j}tdkrbdd„tDƒaxb|dd…D]R}y(|t|dd …ƒ||d d…ƒWqptk rÀ|dƒ||ƒYqpXqpWdj |ƒS) z,unquote_to_bytes('abc%20def') -> b'abc def'.ózutf-8rHr3rNcSs4i|],}tD]"}tt||dƒgƒ||jƒ“q qS)é)Ú_hexdigÚbytesrOr()r-r«r‹r!r!r"ú usz$unquote_to_bytes..r�) r–r4r5r(rzr¥Ú _hextobyter¯ÚKeyErrorr¦)ÚstringÚbitsÚresr¥Úitemr!r!r"rbs*     z([-]+)úutf-8r†cCs�d|kr|j|S|dkrd}|dkr*d}tj|ƒ}|dg}|j}x@tdt|ƒdƒD],}|t||ƒj||ƒƒ|||dƒqVWdj|ƒS) a–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'. rGNzutf-8r†rr3r�r)r–Ú_asciirer¥Úrangerzrr,r¦)r´r)r*rµr¶r¥ryr!r!r"r‚s   Fú&c CsRi}t|||||||d�}x2|D]*\} } | |kr@|| j| ƒq | g|| <q W|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. )r)r*Úmax_num_fieldsrM)r r¥) ÚqsÚkeep_blank_valuesÚstrict_parsingr)r*r¼rMZ parsed_resultÚpairsÚnameÚvaluer!r!r"r œs cCs.t|ƒ\}}| s"t|ttfƒ r*tdƒ‚|dk rPd|j|ƒ}||krPtdƒ‚dd„|j|ƒDƒ} g} xÀ| D]¸} | r€| r€qn| jddƒ} t| ƒdkr¼|rªtd | fƒ‚|rn| jd ƒnqnt| dƒsÌ|rn| d j d d ƒ} t | ||d�} || ƒ} | dj d d ƒ}t |||d�}||ƒ}| j| |fƒqnW| 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.Nr3zMax number of fields exceededcSsg|]}|‘qSr!r!)r-Ús1r!r!r"ú ðszparse_qsl..ú=r�zbad query field: %rrrú+ú )r)r*) r8r4r5r°rPÚcountr–rzr¥r†r)r½r¾r¿r)r*r¼rMrrÚ num_fieldsrÀÚrZ name_valueZnvrÁrÂr!r!r"r Æs8      cCs|jddƒ}t|||ƒS)z›Like 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)r´r)r*r!r!r"rs sAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-c@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚQuoterzÌA 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). cCstj|ƒ|_dS)zsafe: bytes object.N)Ú _ALWAYS_SAFEÚunionÚsafe)r;rÎr!r!r"Ú__init__ szQuoter.__init__cCsd|jjt|ƒfS)Nz<%s %r>)Ú __class__r<Údict)r;r!r!r"Ú__repr__$szQuoter.__repr__cCs(||jkrt|ƒndj|ƒ}|||<|S)Nz%{:02X})rÎÚchrÚformat)r;r‹r¶r!r!r"Ú __missing__(szQuoter.__missing__N)r<r=r>r?rÏrÒrÕr!r!r!r"rËsrËrvcCsbt|tƒr8|s|S|dkrd}|dkr*d}|j||ƒ}n |dk rHtdƒ‚|dk rXtdƒ‚t||ƒS)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). Nzutf-8r%z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r4r5r(r6r )r´rÎr)r*r!r!r"r .s cCsdt|tƒrd|ks$t|tƒr2d|kr2t||||ƒSt|tƒrBd}nd}t|||||ƒ}|jddƒS)zÞLike 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Æ)r4r5r°r r†)r´rÎr)r*Zspacer!r!r"r Zs c sªt|ttfƒstdƒ‚|sdSt|tƒr6|jddƒ}ntdd„|Dƒƒ}|jt|ƒs^|jƒSy t |‰Wn&t k r�t |ƒj t |<‰YnXdj ‡fdd„|DƒƒS)zËLike 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!)r-r~r!r!r"rÄxsz$quote_from_bytes..csg|] }ˆ|ƒ‘qSr!r!)r-Úchar)Úquoterr!r"rÄs)r4r°Ú bytearrayr6r5r(ÚrstripÚ_ALWAYS_SAFE_BYTESr,r r³rËÚ __getitem__r¦)ZbsrÎr!)rÚr"r ks  cCst|dƒr|jƒ}nRy t|ƒr2t|dtƒ r2t‚Wn0tk rdtjƒ\}}}tdƒj|ƒ‚YnXg} |sæxr|D]j\} } t| t ƒr’|| |ƒ} n|t | ƒ|||ƒ} t| t ƒrº|| |ƒ} n|t | ƒ|||ƒ} | j | d| ƒqtW�n,�x(|D�]\} } t| t ƒ�r|| |ƒ} n|t | ƒ|||ƒ} t| t ƒ�rL|| |ƒ} | j | d| ƒqît| t ƒ�rz|| |||ƒ} | j | d| ƒqîy t| ƒ} Wn:tk �rÀ|t | ƒ|||ƒ} | j | d| ƒYqîXxJ| D]B} t| t ƒ�rä|| |ƒ} n|t | ƒ|||ƒ} | j | d| ƒ�qÈWqîWdj | ƒ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 objectrÅr») Úhasattrrßrzr4r0r6ÚsysÚexc_infoÚwith_tracebackr°r5r¥r¦)rsZdoseqrÎr)r*Z quote_viaZtyZvaÚtbÚlÚkršr.Zeltr!r!r"r�sP                c CsJt|tƒrFy|jdƒjƒ}Wn(tk rDtdt|ƒdƒ‚YnX|S)zto_bytes(u"URL") --> 'URL'.ÚASCIIzURL z contains non-ASCII characters)r4r5r(r,Ú UnicodeErrorÚrepr)rir!r!r"Úto_bytesÑs  rêcCs`t|ƒjƒ}|dd…dkr<|dd…dkr<|dd…jƒ}|dd…dkr\|dd…jƒ}|S) z8unwrap('') --> 'type://host/path'.Nr3ú<ú>ézURL:r r )r5r‘)rir!r!r"ÚunwrapÞs   rîcCsDtdkrtjdtjƒatj|ƒ}|r<|jƒ\}}|jƒ|fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz ([^/:]+):(.*))Ú _typeprogÚreÚcompileÚDOTALLÚmatchÚgroupsrK)rirórpÚdatar!r!r"Ú splittypeçs   röcCsXtdkrtjdtjƒatj|ƒ}|rP|jƒ\}}|rH|ddkrHd|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rrv)Ú _hostprogrðrñròrórô)riróZ host_portr¨r!r!r"Ú splithostôs  røcCs |jdƒ\}}}|r|nd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rTN)rW)ÚhostÚuserr}r!r!r"Ú splitusersrûcCs |jdƒ\}}}||r|ndfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rUN)rJ)rúr}Zpasswdr!r!r"Ú splitpasswdsrücCsDtdkrtjdtjƒatj|ƒ}|r<|jƒ\}}|r<||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz(.*):([0-9]*)$)Ú _portprogrðrñròrórô)rùrórQr!r!r"Ú splitports  rþr3c CsT|jdƒ\}}}|s|}n2|rLy t|ƒ}Wntk rBd}YnX||fS||fS)zÛSplit 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.rUN)rWrOrP)rùZdefportr}rQZnportr!r!r"Ú splitnports  rÿcCs$|jdƒ\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.r‚N)rW)rir¨r}rsr!r!r"Ú splitquery+srcCs$|jdƒ\}}}|r||fS|dfS)z)splittag('/path#tag') --> '/path', 'tag'.rgN)rW)rir¨r}Útagr!r!r"Úsplittag2srcCs|jdƒ}|d|dd…fS)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].rmrr3N)r–)riZwordsr!r!r"Ú splitattr9s rcCs |jdƒ\}}}||r|ndfS)z-splitvalue('attr=value') --> 'attr', 'value'.rÅN)rJ)Úattrr}rÂr!r!r"Ú splitvalue?sr)rT)r)rT)T)r¸r†)FFr¸r†Nr»)FFr¸r†Nr»)r¸r†)rvNN)rNN)rvr )r )]r?rðráÚ collectionsÚ__all__r¡r�rnZnon_hierarchicalZ uses_queryZ uses_fragmentr—r�rŠr•rr#Z_implicit_encodingZ_implicit_errorsr'r+r2r8Úobjectr9rArCrSrarfZ_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaserirhrprVr¨rsrtZ ResultBaserrrrrrrlrrorr‰rŒrrrrrr¯r²rrñr¹rr r rÚ frozensetrÌr°rÝr Ú defaultdictrËr r r rrêrîrïrör÷rørûrürýrþrÿrrrrr!r!r!r"Ú sö                 !           @  E   ) A  ,   O