AlkantarClanX12

Your IP : 3.145.33.244


Current Path : /opt/alt/python310/lib64/python3.10/urllib/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/urllib/__pycache__/parse.cpython-310.opt-1.pyc

o

6��f
��@sdZddlZddlZddlZddlZddlZgd�Zgd�Zgd�Zgd�Z	gd�Z
gd�Zgd	�Zd
Z
dZgd�Zd
ZiZdd�ZdZdZdd�Zeefdd�Zeefdd�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!ee�ZGd"d#�d#ee�Zdd$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 e�Z+Gd7d'�d'e!e�Z,Gd8d)�d)e"e�Z-Gd9d:�d:e e�Z.Gd;d<�d<e!e�Z/Gd=d>�d>e"e�Z0d?d@�Z1e1�[1d�dCdD�Z2dEdF�Z3d�dGdH�Z4dIdJ�Z5d�dKdL�Z6dMdN�Z7dOdP�Z8d�dQdR�Z9dSdT�Z:dUZ;da<dVdW�Z=e�>dX�Z?d�d[d\�Z@	]	^d�d_d`�ZA	]	^d�dadb�ZBd�dcdd�ZCeDde�ZEeFeE�ZGiZHGdfdg�dgejI�ZJd�didj�ZKd�dkdl�ZLd�dmdn�ZMd]dAddeLfdodp�ZNdqdr�ZOdsdt�ZPdudv�ZQdwdx�ZRdaSdydz�ZTd{d|�ZUdaVd}d~�ZWdd��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\da]d�d��Z^d�d�d��Z_d�d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��ZhdS)�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)��ftp�http�gopher�nntp�imap�wais�file�https�shttp�mms�prospero�rtsp�rtspu�sftp�svn�svn+ssh�ws�wss)rrrrr�telnetrrrr!rr �snewsr"r#r$Zrsyncr&r'r%ZnfsZgitzgit+sshr(r))rr�hdlr"rrrr r#r$�sip�sipsr!r%Ztel)
rr,Zmailto�newsr*rrr+r-r.)rrrrrr r!rr#r$r-r.)
rrr,rrr/rrrr r+rr"zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!	

 )�	�
�
�cCst��t��dS)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear�
_safe_quoters�r7r7�3/opt/alt/python310/lib64/python3.10/urllib/parse.py�clear_cache`sr9�ascii�strictcCs|S�Nr7)�objr7r7r8�_nooposr>cCs|�||�Sr<��encode)r=�encoding�errorsr7r7r8�_encode_resultrsrCcst��fdd�|D��S)Nc3s$�|]
}|r|����ndVqdS)rN��decode��.0�x�rArBr7r8�	<genexpr>xs�"z_decode_args.<locals>.<genexpr>)�tuple)�argsrArBr7rIr8�_decode_argsvsrMcGsVt|dt�}|dd�D]}|rt|t�|krtd��q
|r$|tfSt|�tfS)Nr�z$Cannot mix str and non-str arguments)�
isinstance�str�	TypeErrorr>rMrC)rLZ	str_input�argr7r7r8�_coerce_argszs�
rSc@�eZdZdZdZddd�ZdS)	�_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr7r:r;c�|j��fdd�|D��S)Nc3��|]	}|����VqdSr<r?rFrIr7r8rJ���z)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart��selfrArBr7rIr8r@��z_ResultMixinStr.encodeN�r:r;)�__name__�
__module__�__qualname__�__doc__�	__slots__r@r7r7r7r8rU��rUc@rT)	�_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr7r:r;crV)Nc3rWr<rDrFrIr7r8rJ�rXz+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpartrZr7rIr8rE�r\z_ResultMixinBytes.decodeNr])r^r_r`rarbrEr7r7r7r8rd�rcrdc@sNeZdZdZdZedd��Zedd��Zedd��Zed	d
��Z	e
ej�Z
dS)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr7cC�
|jdS)Nr��	_userinfo�r[r7r7r8�username��
z_NetlocResultMixinBase.usernamecCrg)NrNrhrjr7r7r8�password�rlz_NetlocResultMixinBase.passwordcCsD|jd}|s	dSt|t�rdnd}|�|�\}}}|��||S)Nr�%�%)�	_hostinforOrP�	partition�lower)r[�hostname�	separatorZpercentZzoner7r7r8rs�s
z_NetlocResultMixinBase.hostnamecCsb|jd}|dur/|��r|��rt|�}ntd|����d|kr*dks/td��td��|S)NrNz+Port could not be cast to integer value as ri��zPort out of range 0-65535)rp�isdigit�isascii�int�
ValueError)r[�portr7r7r8ry�s

�z_NetlocResultMixinBase.portN)r^r_r`rarb�propertyrkrmrsry�classmethod�types�GenericAlias�__class_getitem__r7r7r7r8rf�s




rfc@�(eZdZdZedd��Zedd��ZdS)�_NetlocResultMixinStrr7cC�J|j}|�d�\}}}|r|�d�\}}}|sd}||fSd}}||fS)N�@�:��netloc�
rpartitionrq�r[r�ZuserinfoZ	have_info�hostinforkZ
have_passwordrmr7r7r8ri���z_NetlocResultMixinStr._userinfocC�l|j}|�d�\}}}|�d�\}}}|r&|�d�\}}}|�d�\}}}n|�d�\}}}|s2d}||fS)Nr��[�]r�r��r[r��_r�Zhave_open_brZ	bracketedrsryr7r7r8rp��z_NetlocResultMixinStr._hostinfoN�r^r_r`rbrzrirpr7r7r7r8r���
r�c@r)�_NetlocResultMixinBytesr7cCr�)N�@�:r�r�r7r7r8ri�r�z!_NetlocResultMixinBytes._userinfocCr�)Nr��[�]r�r�r�r7r7r8rp�r�z!_NetlocResultMixinBytes._hostinfoNr�r7r7r7r8r��r�r�)�
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@�eZdZdZdd�ZdS)rr7cC�|jr|jd|jS|jS)N�#��fragment�urlrjr7r7r8�geturlJ�zDefragResult.geturlN�r^r_r`rbr�r7r7r7r8rH�c@r�)rr7cC�t|�Sr<�rrjr7r7r8r�R�zSplitResult.geturlNr�r7r7r7r8rPr�c@r�)rr7cCr�r<�rrjr7r7r8r�Wr�zParseResult.geturlNr�r7r7r7r8rUr�c@r�)rr7cCr�)N�#r�rjr7r7r8r�]r�zDefragResultBytes.geturlNr�r7r7r7r8r[r�rc@r�)rr7cCr�r<r�rjr7r7r8r�er�zSplitResultBytes.geturlNr�r7r7r7r8rcr�rc@r�)rr7cCr�r<r�rjr7r7r8r�jr�zParseResultBytes.geturlNr�r7r7r7r8rhr�rcCs4ttfttfttff}|D]
\}}||_||_q
dSr<)rrrrrrrYre)Z
_result_pairsZ_decodedZ_encodedr7r7r8�_fix_result_transcodingns��r�rTc
Csft||�\}}}t|||�}|\}}}}}|tvr$d|vr$t|�\}}nd}t||||||�}	||	�S)a�Parse a URL into 6 components:
    <scheme>://<netloc>/<path>;<params>?<query>#<fragment>

    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)
r��scheme�allow_fragments�_coerce_resultZsplitresultr��queryr��params�resultr7r7r8r{srcCsRd|vr|�d|�d��}|dkr|dfSn|�d�}|d|�||dd�fS)N�/r�rrrN)�find�rfind)r��ir7r7r8r��s�
r�cCsHt|�}dD]}|�||�}|dkrt||�}q|||�||d�fS)Nz/?#r)�lenr��min)r��start�delim�cZwdelimr7r7r8�_splitnetloc�s
�r�cCs�|r|��rdSddl}|�dd�}|�dd�}|�dd�}|�dd�}|�d|�}||kr0dSdD]}||vrBtd	|d
d��q2dS)Nrr�rr�r��?�NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)rv�unicodedata�replace�	normalizerx)r�r��nZnetloc2r�r7r7r8�_checknetloc�s"���r�c
Cs�t||�\}}}|�t�}|�t�}tD]}|�|d�}|�|d�}qt|�}|||t|�t|�f}t�	|d�}|r>||�St
t�tkrGt�d}}}	|�
d�}
|
dkrv|d|
�D]}|tvrdnq\|d|
���||
dd�}}|dd�dkr�t|d�\}}d|vr�d	|vs�d	|vr�d|vr�td
��|r�d|vr�|�dd�\}}	d|vr�|�dd�\}}t|�t|||||	�}|t|<||�S)
a�Parse a URL into 5 components:
    <scheme>://<netloc>/<path>?<query>#<fragment>

    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.
    rNr�rrN��//r�r�zInvalid IPv6 URLr�r�)rS�lstrip�_WHATWG_C0_CONTROL_OR_SPACE�strip�_UNSAFE_URL_BYTES_TO_REMOVEr��bool�typer4�getr��MAX_CACHE_SIZEr9r��scheme_charsrrr�rx�splitr�r)
r�r�r�r��b�key�cachedr�r�r�r�r��vr7r7r8r�sD


�"rcCs<t|�\}}}}}}}|rd||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)rSr)�
componentsr�r�r�r�r�r�r�r7r7r8r�s
�rcCs�t|�\}}}}}}|s|r|tvs|dd�dkr0|r(|dd�dkr(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).Nr�r�rNr�rr�r�r�)rS�uses_netloc)r�r�r�r�r�r�r�r7r7r8rs� rc	Cs�|s|S|s|St||�\}}}t|d|�\}}}}}}	t|||�\}
}}}
}}|
|ks0|
tvr4||�S|
tvrH|rF|t|
|||
||f��S|}|s`|
s`|}|}
|sT|}|t|
|||
||f��S|�d�}|ddkrn|d=|dd�dkr||�d�}n||�d�}td|dd��|dd�<g}|D] }|dkr�z|��Wq�ty�Yq�w|dkr�q�|�	|�q�|ddvr�|�	d�|t|
|d�
|�p�d|
||f��S)	zaJoin a base URL and a possibly relative URL to form an absolute
    interpretation of the latter.rr����NrN�..�.)r�r�)rSr�
uses_relativer�rr��filter�pop�
IndexError�append�join)�baser�r�r�ZbschemeZbnetlocZbpathZbparamsZbqueryZ	bfragmentr�r��pathr�r�r�Z
base_partsZsegmentsZ
resolved_pathZsegr7r7r8rsd
�
�
�
�
�
��rc	CsTt|�\}}d|vrt|�\}}}}}}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.
    r�r)rSrrr)	r�r��sr��p�a�qZfragZdefragr7r7r8r\srZ0123456789ABCDEFabcdefc	Cs�|s|jdSt|t�r|�d�}|�d�}t|�dkr|S|dg}|j}tdur1dd�tD�a|dd�D]'}z|t|dd	��||d	d��Wq7ty^|d�||�Yq7wd�	|�S)
z,unquote_to_bytes('abc%20def') -> b'abc def'.��utf-8rorNrNcSs.i|]}tD]}||��t�||��qqSr7)�_hexdigr@�bytes�fromhex)rGr�r�r7r7r8�
<dictcomp>�s
��z$unquote_to_bytes.<locals>.<dictcomp>r�)
r�rOrPr@r�r��
_hextobyter��KeyErrorr�)�string�bits�resr��itemr7r7r8ros.



��
rz([-]+)r�r�cCs�t|t�r
t|��||�Sd|vr|j|S|durd}|dur"d}t�|�}|dg}|j}tdt|�d�D]}|t||��||��|||d�q7d�	|�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'.
    rnNr�r�rrNr�r)
rOr�rrEr��_asciirer��ranger�r�)r�rArBr�r�r�r�r7r7r8r�s 




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.
    )rArB�max_num_fieldsrt)r
r�)�qs�keep_blank_values�strict_parsingrArBr�rtZ
parsed_resultZpairs�name�valuer7r7r8r	�s�r	cCs t|�\}}t|�\}}|rt|ttf�std��|dur,d|�|�}	||	kr,td��g}
|�|�D]Z}|s:|s:q3|�dd�}t|�dkrX|rOtd|f��|rW|�d�nq3t|d�s`|r�|d	�	d
d�}
t
|
||d�}
||
�}
|d�	d
d�}t
|||d�}||�}|
�|
|f�q3|
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�=r�zbad query field: %rrr�+� rI)rSrOrPr�rx�countr�r�r�r�r)r�r�r�rArBr�rtr�r��
num_fields�rZ
name_valueZnvr�r�r7r7r8r
�s:�r
cCs|�dd�}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�rArBr7r7r8rsrsBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~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).
    cCst�|�|_dS)zsafe: bytes object.N)�_ALWAYS_SAFE�union�safe)r[rr7r7r8�__init__/szQuoter.__init__cCsd|jjt|�fS)Nz<%s %r>)�	__class__r^�dictrjr7r7r8�__repr__3szQuoter.__repr__cCs(||jvr	t|�nd�|�}|||<|S)Nz%{:02X})r�chr�format)r[r�r�r7r7r8�__missing__7szQuoter.__missing__N)r^r_r`rarrrr7r7r7r8r�'s
r�r�cCsbt|t�r|s	|S|durd}|durd}|�||�}n|dur$td��|dur,td��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. 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).
    Nr�r;z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)rOrPr@rQr
)r�rrArBr7r7r8r=s
'
rcCsdt|t�r	d|vst|t�rd|vrt||||�St|t�r!d}nd}t|||||�}|�dd�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�)rOrPr�rr�)r�rrArBZspacer7r7r8rss�
rcs�t|ttf�std��|sdSt|t�r|�dd�}n	tdd�|D��}|�t|�s/|��Szt	|�Wnt
yGt|�jt	|<�Ynwd�
�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)�r7)rGr�r7r7r8�
<listcomp>�sz$quote_from_bytes.<locals>.<listcomp>csg|]}�|��qSr7r7)rG�char�Zquoterr7r8r�s)rOr��	bytearrayrQrPr@�rstrip�_ALWAYS_SAFE_BYTESrEr6r�r��__getitem__r�)Zbsrr7rr8r
�s
�r
c	Cs�t|d�r
|��}n%zt|�rt|dt�st�Wnty.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|
�q�qnd�|	�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�)
�hasattrrr�rOrKrQ�sys�exc_info�with_tracebackr�rPr�r�)r�ZdoseqrrArBZ	quote_viaZtyZva�tb�l�kr�rH�eltr7r7r8r�s\

���

�



�
�
rcC�tjdtdd�t|�S)Nz/urllib.parse.to_bytes() is deprecated as of 3.8r���
stacklevel)�warnings�warn�DeprecationWarning�	_to_bytes�r�r7r7r8�to_bytes�s�r$cCsFt|t�r!z
|�d���}W|Sty tdt|�d��w|S)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)rOrPr@rE�UnicodeError�reprr#r7r7r8r"�s
���r"cCs`t|���}|dd�dkr|dd�dkr|dd���}|dd�dkr.|dd���}|S)z�Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'.

    The string is returned unchanged if it's not a wrapped URL.
    NrN�<r��>�zURL:)rPr�r#r7r7r8�unwrap�s r+cCr)NzUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�
_splittyper#r7r7r8�	splittype��r-cCsDtdurt�dtj�at�|�}|r|��\}}|��|fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz
([^/:]+):(.*))�	_typeprog�re�compile�DOTALL�match�groupsrr)r�r3r��datar7r7r8r,s
r,cCr)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�
_splithostr#r7r7r8�	splithost!r.r7cCsXtdurt�dtj�at�|�}|r(|��\}}|r$|ddkr$d|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rr�)�	_hostprogr0r1r2r3r4)r�r3Z	host_portr�r7r7r8r6)s
r6cCr)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�
_splituser��hostr7r7r8�	splituser8r.r<cCs$|�d�\}}}|r||fSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r�N�r�)r;�userr�r7r7r8r9?sr9cCr)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�_splitpasswd)r>r7r7r8�splitpasswdEr.r@cC�"|�d�\}}}||r|fSdfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.r�N�rq)r>r�Zpasswdr7r7r8r?L�r?cCr)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�
_splitportr:r7r7r8�	splitportRr.rEcCsDtdurt�dtj�at�|�}|r|��\}}|r||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz
(.*):([0-9]*))�	_portprogr0r1r2�	fullmatchr4)r;r3ryr7r7r8rD[s
rDr�cCstjdtdd�t||�S)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�_splitnport)r;�defportr7r7r8�
splitnportis�
rJcCsX|�d�\}}}|s|}||fS|r(|��r"|��r"t|�}||fSd}||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 is found after ':'.
    Return None if ':' but not a valid number.r�N)r�rurvrw)r;rIr�ryZnportr7r7r8rHps��rHcCr)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�_splitqueryr#r7r7r8�
splitquery�r.rLcC�$|�d�\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.r�Nr=)r�r�r�r�r7r7r8rK��rKcCr)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�	_splittagr#r7r7r8�splittag�r.rPcCrM)z)splittag('/path#tag') --> '/path', 'tag'.r�Nr=)r�r�r��tagr7r7r8rO�rNrOcCr)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r)rr r!�
_splitattrr#r7r7r8�	splitattr�r.rScCs|�d�}|d|dd�fS)zksplitattr('/path;attr1=value1;attr2=value2;...') ->
        '/path', ['attr1=value1', 'attr2=value2', ...].r�rrNN)r�)r�Zwordsr7r7r8rR�s
rRcCr)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadr�r)rr r!�_splitvalue)�attrr7r7r8�
splitvalue�r.rVcCrA)z-splitvalue('attr=value') --> 'attr', 'value'.r�NrB)rUr�r�r7r7r8rT�rCrT)rT)r)T)r�r�)FFr�r�Nr�)r�NN)rNN)r�)r�)irar0rr|�collectionsr�__all__r�r�r�Znon_hierarchicalZ
uses_queryZ
uses_fragmentr�r�r�r�r4r9Z_implicit_encodingZ_implicit_errorsr>rCrMrS�objectrUrdrfr�r�r�Z_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaser�r�r�r�r�r�r�Z
ResultBaserrrrrrr�rr�r�r�rrrrrr�r�rr1r�rr	r
r�	frozensetr�r�rr6�defaultdictr�rrr
rr$r"r+r-r/r,r7r8r6r<r9r@r?rErFrDrJrHrLrKrPrOrSrRrVrTr7r7r7r8�<module>s�!
�
�&
��


	
=
E


�*
�
B	

6

�Q