Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python38/lib64/python3.8/urllib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python38/lib64/python3.8/urllib/__pycache__/parse.cpython-38.opt-1.pyc
U

��,a���@s�dZddlZddlZddlZddlZddddddd	d
dd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
Z	ddddd d!d"dd$d%d2d3gZ
ddd1ddd6ddd d!d,dd#g
Zd7Zd8d9d:gZ
d;ZiZd<d=�Zd>Zd?Zd@dA�ZeefdBdC�ZeefdDdE�ZdFdG�ZGdHdI�dIe�ZGdJdK�dKe�ZGdLdM�dMe�ZGdNdO�dOee�ZGdPdQ�dQee�ZddRlmZeddS�ZeddT�ZeddU�Z dVe_dWej!_dXej"_dYe_dZej#_d[ej$_d\ej%_d]ej&_d^ej"_d_e _ej#je j#_ej$je j$_ej%je j%_d`e j'_ej&je j&_ej"je j"_eZ(Gdad�dee�Z)Gdbd�dee�Z*Gdcd�de e�Z+Gddd�dee�Z,Gded�dee�Z-Gdfd�de e�Z.dgdh�Z/e/�[/d�djd�Z0dkdl�Z1d�dmdn�Z2dodp�Z3dqdr�Z4d�dsd�Z5dtd�Z6dud�Z7d�dvd�Z8dwd�Z9dxZ:da;dyd�Z<e�=dz�Z>d�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�ZLd~dddeKfd�d	�ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQdaRd�d��ZSd�d��ZTdaUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[da\d�d��Z]d�d�d��Z^d�d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��ZgdS)�acParse (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�Zftp�httpZgopherZnntpZimapZwais�fileZhttpsZshttpZmmsZprosperoZrtspZrtspuZsftpZsvnzsvn+sshZwsZwssZtelnetZsnewsZrsyncZnfsZgitzgit+sshZhdlZsipZsipsZtelZmailtoZnewszAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.�	�
�
�cCst��t��dS)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear�
_safe_quoters�r!r!�1/opt/alt/python38/lib64/python3.8/urllib/parse.py�clear_cacheWsr#�ascii�strictcCs|S�Nr!)�objr!r!r"�_noopfsr(cCs|�||�Sr&��encode)r'�encoding�errorsr!r!r"�_encode_resultisr-cst��fdd�|D��S)Nc3s"|]}|r|����ndVqdS)rN��decode��.0�x�r+r,r!r"�	<genexpr>osz_decode_args.<locals>.<genexpr>)�tuple)�argsr+r,r!r3r"�_decode_argsmsr7cGsVt|dt�}|dd�D]}|rt|t�|krtd��q|rH|tfSt|�tfS)Nr�z$Cannot mix str and non-str arguments)�
isinstance�str�	TypeErrorr(r7r-)r6Z	str_input�argr!r!r"�_coerce_argsqs

r=c@seZdZdZdZddd�ZdS)	�_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr!r$r%cs|j��fdd�|D��S)Nc3s|]}|����VqdSr&r)r0r3r!r"r4�sz)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart��selfr+r,r!r3r"r*�sz_ResultMixinStr.encodeN)r$r%)�__name__�
__module__�__qualname__�__doc__�	__slots__r*r!r!r!r"r>�sr>c@seZdZdZdZddd�ZdS)	�_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr!r$r%cs|j��fdd�|D��S)Nc3s|]}|����VqdSr&r.r0r3r!r"r4�sz+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpartr@r!r3r"r/�sz_ResultMixinBytes.decodeN)r$r%)rBrCrDrErFr/r!r!r!r"rG�srGc@sDeZdZdZdZedd��Zedd��Zedd��Zed	d
��Z	dS)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr!cCs
|jdS)Nr��	_userinfo�rAr!r!r"�username�sz_NetlocResultMixinBase.usernamecCs
|jdS)Nr8rJrLr!r!r"�password�sz_NetlocResultMixinBase.passwordcCsD|jd}|sdSt|t�r dnd}|�|�\}}}|��||S)Nr�%�%)�	_hostinfor9r:�	partition�lower)rA�hostname�	separatorZpercentZzoner!r!r"rT�s
z_NetlocResultMixinBase.hostnamecCsl|jd}|dk	rhzt|d�}Wn(tk
rHd|��}t|�d�YnXd|kr^dkshntd��|S)Nr8�
z+Port could not be cast to integer value as ri��zPort out of range 0-65535)rQ�int�
ValueError)rA�port�messager!r!r"rY�s

z_NetlocResultMixinBase.portN)
rBrCrDrErF�propertyrMrNrTrYr!r!r!r"rI�s



rIc@s(eZdZdZedd��Zedd��ZdS)�_NetlocResultMixinStrr!cCsD|j}|�d�\}}}|r4|�d�\}}}|s<d}nd}}||fS)N�@�:��netloc�
rpartitionrR�rAr`ZuserinfoZ	have_info�hostinforMZ
have_passwordrNr!r!r"rK�sz_NetlocResultMixinStr._userinfocCsl|j}|�d�\}}}|�d�\}}}|rL|�d�\}}}|�d�\}}}n|�d�\}}}|sdd}||fS)Nr]�[�]r^r_�rAr`�_rcZhave_open_brZ	bracketedrTrYr!r!r"rQ�sz_NetlocResultMixinStr._hostinfoN�rBrCrDrFr[rKrQr!r!r!r"r\�s

r\c@s(eZdZdZedd��Zedd��ZdS)�_NetlocResultMixinBytesr!cCsD|j}|�d�\}}}|r4|�d�\}}}|s<d}nd}}||fS)N�@�:r_rbr!r!r"rK�sz!_NetlocResultMixinBytes._userinfocCsl|j}|�d�\}}}|�d�\}}}|rL|�d�\}}}|�d�\}}}n|�d�\}}}|sdd}||fS)Nrj�[�]rkr_rfr!r!r"rQ�sz!_NetlocResultMixinBytes._hostinfoNrhr!r!r!r"ri�s

ri)�
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.
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@seZdZdZdd�ZdS)rr!cCs |jr|jd|jS|jSdS)N�#��fragment�urlrLr!r!r"�geturl@szDefragResult.geturlN�rBrCrDrFrsr!r!r!r"r>sc@seZdZdZdd�ZdS)rr!cCst|�Sr&�rrLr!r!r"rsHszSplitResult.geturlNrtr!r!r!r"rFsc@seZdZdZdd�ZdS)rr!cCst|�Sr&�rrLr!r!r"rsMszParseResult.geturlNrtr!r!r!r"rKsc@seZdZdZdd�ZdS)rr!cCs |jr|jd|jS|jSdS)N�#rprLr!r!r"rsSszDefragResultBytes.geturlNrtr!r!r!r"rQsc@seZdZdZdd�ZdS)rr!cCst|�Sr&rurLr!r!r"rs[szSplitResultBytes.geturlNrtr!r!r!r"rYsc@seZdZdZdd�ZdS)rr!cCst|�Sr&rvrLr!r!r"rs`szParseResultBytes.geturlNrtr!r!r!r"r^scCs4ttfttfttff}|D]\}}||_||_qdSr&)rrrrrrr?rH)Z
_result_pairsZ_decodedZ_encodedr!r!r"�_fix_result_transcodingds�rxTc
Csft||�\}}}t|||�}|\}}}}}|tkrHd|krHt|�\}}nd}t||||||�}	||	�S)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)r=r�uses_params�_splitparamsr)
rr�scheme�allow_fragments�_coerce_resultZsplitresultr`�queryrq�params�resultr!r!r"rqscCsRd|kr,|�d|�d��}|dkr6|dfSn
|�d�}|d|�||dd�fS)N�/ryrrr8)�find�rfind)rr�ir!r!r"r{�s

r{cCsHt|�}dD]"}|�||�}|dkrt||�}q|||�||d�fS)Nz/?#r)�lenr��min)rr�start�delim�cZwdelimr!r!r"�_splitnetloc�sr�cCs�|r|��rdSddl}|�dd�}|�dd�}|�dd�}|�dd�}|�d|�}||kr`dSdD] }||krdtd	|d
d��qddS)Nrr]rr^ro�?ZNFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�isascii�unicodedata�replace�	normalizerX)r`r��nZnetloc2r�r!r!r"�_checknetloc�s�r�cCstD]}|�|d�}q|S)Nr)�_UNSAFE_URL_BYTES_TO_REMOVEr�)rr�br!r!r"�_remove_unsafe_bytes_from_url�sr�c
Csht||�\}}}t|�}t|�}t|�}|||t|�t|�f}t�|d�}|rV||�Stt�tkrht�d}}}|�	d�}	|	dk�r�|d|	�dk�rR||	dd�}|dd�dkr�t
|d�\}}d	|kr�d
|ks�d
|kr�d	|kr�td��|�rd|k�r|�dd�\}}d
|k�r*|�d
d�\}}t
|�td||||�}
|
t|<||
�S|d|	�D]}|tk�r^�q��q^||	dd�}|�r�tdd�|D���r�|d|	���|}}|dd�dk�rt
|d�\}}d	|k�r�d
|k�s�d
|k�rd	|k�rtd��|�r&d|k�r&|�dd�\}}d
|k�r@|�d
d�\}}t
|�t|||||�}
|
t|<||
�S)aParse 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.Nrr^rrr8��//rdrezInvalid IPv6 URLror�css|]}|dkVqdS)�
0123456789Nr!�r1r�r!r!r"r4�szurlsplit.<locals>.<genexpr>)r=r��bool�typer�getr��MAX_CACHE_SIZEr#r�r�rX�splitr�r�scheme_chars�anyrS)
rrr|r}r~�key�cachedr`rrqr��vr��restr!r!r"r�sj

��


��
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)r=r)�
componentsr|r`rrr�rrqr~r!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�r�r8r�rr^r�ro)r=�uses_netloc)r�r|r`rrrrqr~r!r!r"r�s� c	Cs�|s|S|s|St||�\}}}t|d|�\}}}}}}	t|||�\}
}}}
}}|
|ks`|
tkrh||�S|
tkr�|r�|t|
|||
||f��S|}|s�|
s�|}|}
|s�|}|t|
|||
||f��S|�d�}|ddkr�|d=|dd�dkr�|�d�}n(||�d�}td|dd��|dd�<g}|D]P}|dk�r\z|��Wntk
�rXYnXn|dk�rl�q(n
|�	|��q(|ddk�r�|�	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����Nr8�..�.)r�r�)r=r�
uses_relativer�rr��filter�pop�
IndexError�append�join)�baserrr}r~ZbschemeZbnetlocZbpathZbparamsZbqueryZ	bfragmentr|r`�pathr�rrqZ
base_partsZsegmentsZ
resolved_pathZsegr!r!r"rsp
�
�
�
�



��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.
    ror)r=rrr)	rrr~�sr��p�a�qZfragZdefragr!r!r"rGsZ0123456789ABCDEFabcdefc	Cs�|s|jdSt|t�r"|�d�}|�d�}t|�dkr<|S|dg}|j}tdkrbdd�tD�a|dd�D]R}z(|t|dd	��||d	d��Wqntk
r�|d�||�YqnXqnd�	|�S)
z,unquote_to_bytes('abc%20def') -> b'abc def'.��utf-8rPr8rNcSs.i|]&}tD]}||��t�||��qqSr!)�_hexdigr*�bytes�fromhex)r1r�r�r!r!r"�
<dictcomp>ms
�
z$unquote_to_bytes.<locals>.<dictcomp>r�)
r�r9r:r*r�r��
_hextobyter��KeyErrorr�)�string�bits�resr��itemr!r!r"rZs,



�z([-]+)r�r�cCs�t|t�rtd��d|kr$|j|S|dkr0d}|dkr<d}t�|�}|dg}|j}tdt|�d�D],}|t||��	||��|||d�qfd	�
|�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'.
    zExpected str, got bytesrONr�r�rr8r�r)r9r�r;r��_asciirer��ranger�rr/r�)r�r+r,r�r�r�r�r!r!r"rzs 



F�&c	CsNi}t|||||||d�}|D]*\}	}
|	|kr>||	�|
�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.
    )r+r,�max_num_fieldsrU)r
r�)�qs�keep_blank_values�strict_parsingr+r,r�rUZ
parsed_result�pairs�name�valuer!r!r"r	�s�cCs.t|�\}}t|�\}}|r*t|ttf�s2td��|dk	rXd|�|�}	||	krXtd��dd�|�|�D�}
g}|
D]�}|s�|s�qt|�dd�}
t|
�dkr�|r�td	|f��|rt|
�d
�nqtt|
d�s�|rt|
d�	dd
�}t
|||d�}||�}|
d�	dd
�}t
|||d�}||�}|�||f�qt|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.Nr8zMax number of fields exceededcSsg|]}|�qSr!r!)r1�s1r!r!r"�
<listcomp>�szparse_qsl.<locals>.<listcomp>�=r�zbad query field: %rrr�+� r3)r=r9r:r�rX�countr�r�r�r�r)r�r�r�r+r,r�rUr~rg�
num_fieldsr��rZ
name_valueZnvr�r�r!r!r"r
�s: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�r+r,r!r!r"rssBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~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)rAr�r!r!r"�__init__szQuoter.__init__cCsd|jjt|�fS)Nz<%s %r>)�	__class__rB�dictrLr!r!r"�__repr__szQuoter.__repr__cCs(||jkrt|�nd�|�}|||<|S)Nz%{:02X})r��chr�format)rAr�r�r!r!r"�__missing__#szQuoter.__missing__N)rBrCrDrEr�r�r�r!r!r!r"r�sr�r�cCsbt|t�r8|s|S|dkrd}|dkr*d}|�||�}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. 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)r9r:r*r;r
)r�r�r+r,r!r!r"r)s'
cCsdt|t�rd|ks$t|t�r2d|kr2t||||�St|t�rBd}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�)r9r:r�rr�)r�r�r+r,Zspacer!r!r"r_s��
cs�t|ttf�std��|sdSt|t�r6|�dd�}ntdd�|D��}|�t|�s^|��Szt	|�Wn&t
k
r�t|�jt	|<�YnXd�
�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�}sz$quote_from_bytes.<locals>.<listcomp>csg|]}�|��qSr!r!)r1�char�Zquoterr!r"r��s)r9r��	bytearrayr;r:r*�rstrip�_ALWAYS_SAFE_BYTESr/r r�r��__getitem__r�)Zbsr�r!r�r"r
ps
c	Cst|d�r|��}nPzt|�r0t|dt�s0t�Wn0tk
rbt��\}}}td��|��YnXg}	|s�|D]j\}
}t|
t	�r�||
|�}
n|t
|
�|||�}
t|t	�r�|||�}n|t
|�|||�}|	�|
d|�qp�n"|D�]\}
}t|
t	��r||
|�}
n|t
|
�|||�}
t|t	��rB|||�}|	�|
d|�q�t|t
��rp|||||�}|	�|
d|�q�zt|�}Wn:tk
�r�|t
|�|||�}|	�|
d|�Yq�X|D]B}
t|
t	��r�||
|�}
n|t
|
�|||�}
|	�|
d|
��q�q�d�|	�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�r�r9r5r;�sys�exc_info�with_tracebackr�r:r�r�)rZdoseqr�r+r,Z	quote_viaZtyZva�tb�l�kr�r2Zeltr!r!r"r�sR

�



cCstjdtdd�t|�S)Nz/urllib.parse.to_bytes() is deprecated as of 3.8r���
stacklevel)�warnings�warn�DeprecationWarning�	_to_bytes�rrr!r!r"�to_bytes�s
�r�cCsJt|t�rFz|�d���}Wn(tk
rDtdt|�d��YnX|S)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)r9r:r*r/�UnicodeError�reprr�r!r!r"r��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.
    Nr8�<r��>�zURL:)r:�stripr�r!r!r"�unwrap�s r�cCstjdtdd�t|�S)NzUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��
_splittyper�r!r!r"�	splittype�s
�rcCsDtdkrt�dtj�at�|�}|r<|��\}}|��|fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz
([^/:]+):(.*))�	_typeprog�re�compile�DOTALL�match�groupsrS)rrrr|�datar!r!r"rs
rcCstjdtdd�t|�S)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��
_splithostr�r!r!r"�	splithost
s
�r
cCsXtdkrt�dtj�at�|�}|rP|��\}}|rH|ddkrHd|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rr�)�	_hostprogrrrrr)rrrZ	host_portr�r!r!r"r	s
r	cCstjdtdd�t|�S)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��
_splituser��hostr!r!r"�	splituser$s
�rcCs |�d�\}}}|r|nd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r]N�ra)r�userr�r!r!r"r+srcCstjdtdd�t|�S)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��_splitpasswd)rr!r!r"�splitpasswd1s
�rcCs |�d�\}}}||r|ndfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.r^N�rR)rr�Zpasswdr!r!r"r8srcCstjdtdd�t|�S)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��
_splitportr
r!r!r"�	splitport>s
�rcCsDtdkrt�dtj�at�|�}|r<|��\}}|r<||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz
(.*):([0-9]*))�	_portprogrrr�	fullmatchr)rrrYr!r!r"rGs
rr�cCstjdtdd�t||�S)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��_splitnport)r�defportr!r!r"�
splitnportUs
�rcCsT|�d�\}}}|s|}n2|rLz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.r^N)rarWrX)rrr�rYZnportr!r!r"r\s
rcCstjdtdd�t|�S)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��_splitqueryr�r!r!r"�
splitqueryms
�rcCs$|�d�\}}}|r||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.r�Nr)rrr�r�rr!r!r"rtsrcCstjdtdd�t|�S)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��	_splittagr�r!r!r"�splittag|s
�rcCs$|�d�\}}}|r||fS|dfS)z)splittag('/path#tag') --> '/path', 'tag'.roNr)rrr�r��tagr!r!r"r�srcCstjdtdd�t|�S)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr�r�)r�r�r��
_splitattrr�r!r!r"�	splitattr�s
�r"cCs|�d�}|d|dd�fS)zksplitattr('/path;attr1=value1;attr2=value2;...') ->
        '/path', ['attr1=value1', 'attr2=value2', ...].ryrr8N)r�)rrZwordsr!r!r"r!�s
r!cCstjdtdd�t|�S)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadr�r�)r�r�r��_splitvalue)�attrr!r!r"�
splitvalue�s
�r%cCs |�d�\}}}||r|ndfS)z-splitvalue('attr=value') --> 'attr', 'value'.r�Nr)r$r�r�r!r!r"r#�sr#)rT)r)rT)T)r�r�)FFr�r�Nr�)FFr�r�Nr�)r�r�)r�NN)rNN)r�)r�)r�)hrErr��collectionsr��__all__r�r�rzZnon_hierarchicalZ
uses_queryZ
uses_fragmentr�r�r�rr#Z_implicit_encodingZ_implicit_errorsr(r-r7r=�objectr>rGrIr\rirnZ_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaserrrqr|r`r�rr�Z
ResultBaserrrrrrrxrr{r�r�r�rrrrrr�r�rrr�rr	r
r�	frozensetr�r�r�r �defaultdictr�rrr
rr�r�r�rrrr
rr	rrrrrrrrrrrrrr"r!r%r#r!r!r!r"�<module>s��������
�
�
%
��

	

;
E

�
*�
C
	
6

�
Q





ZeroDay Forums Mini