AlkantarClanX12

Your IP : 3.21.247.78


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/urllib/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/urllib/__pycache__/parse.cpython-35.opt-1.pyc



��Yf!��@s�dZddlZddlZddlZddddddd	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
Zddddd d!d"dd$d%d2d3gZ	ddd1ddd6ddd d!d,dd#g
Z
d7Zd8ZiZ
d9d:�Zd;Zd<Zd=d>�Zeed?d@�ZeedAdB�ZdCdD�ZGdEdF�dFe�ZGdGdH�dHe�ZGdIdJ�dJe�ZGdKdL�dLee�ZGdMdN�dNee�ZddOlmZeddP�ZeddQ�ZeddR�ZeZGdSd�dee�Z GdTd�dee�Z!GdUd�dee�Z"GdVd�dee�Z#GdWd�dee�Z$GdXd�dee�Z%dYdZ�Z&e&�[&dd[d\d�Z'd]d^�Z(dd_d`�Z)dadb�Z*dd[dcd�Z+ddd�Z,ded�Z-d[dfd�Z.dgd�Z/dhZ0da1did�Z2ej3dj�Z4dkdldmd�Z5dndndkdldod
�Z6dndndkdldpd�Z7dkdldqd�Z8e9dr�Z:e;e:�Z<iZ=Gdsdt�dtej>�Z?dudddvd�Z@ddddwd
�ZAdudxd�ZBdndddeAdyd	�ZCdzd{�ZDd|d}�ZEdaFd~d�ZGdaHd�d��ZId�d��ZJd�d��ZKdaLd�d��ZMd�d�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRdS)�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+-.�cCstj�tj�dS)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear�
_safe_quoters�rr�1/opt/alt/python35/lib64/python3.5/urllib/parse.py�clear_cacheSs
r �ascii�strictcCs|S)Nr)�objrrr�_noopbsr$cCs|j||�S)N)�encode)r#�encoding�errorsrrr�_encode_resultesr(cs t��fdd�|D��S)Nc3s-|]#}|r!|j���ndVqdS)rN)�decode)�.0�x)r&r'rr�	<genexpr>ksz_decode_args.<locals>.<genexpr>)�tuple)�argsr&r'r)r&r'r�_decode_argsisr/cGswt|dt�}x?|dd�D]-}|r$t|t�|kr$td��q$W|rf|tfSt|�tfS)Nr�z$Cannot mix str and non-str arguments)�
isinstance�str�	TypeErrorr$r/r()r.Z	str_input�argrrr�_coerce_argsmsr5c@s.eZdZdZfZdddd�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'rrr,�sz)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart)�selfr&r'r)r&r'rr%�sz_ResultMixinStr.encodeN)�__name__�
__module__�__qualname__�__doc__�	__slots__r%rrrrr6~sr6c@s.eZdZdZfZdddd�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'rrr,�sz+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpart)r8r&r'r)r&r'rr)�sz_ResultMixinBytes.decodeN)r9r:r;r<r=r)rrrrr>�sr>c@sdeZdZdZfZedd��Zedd��Zedd��Zedd	��Z	d
S)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementcCs|jdS)Nr)�	_userinfo)r8rrr�username�sz_NetlocResultMixinBase.usernamecCs|jdS)Nr0)rA)r8rrr�password�sz_NetlocResultMixinBase.passwordcCs8|jd}|sd}n|dk	r4|j�}|S)Nr)�	_hostinfo�lower)r8�hostnamerrrrF�s
	z_NetlocResultMixinBase.hostnamecCsL|jd}|dk	rHt|d�}d|ko?dknsHdS|S)Nr0�
ri��)rD�int)r8�portrrrrI�s
z_NetlocResultMixinBase.portN)
r9r:r;r<r=�propertyrBrCrFrIrrrrr@�s	r@c@s:eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinStrcCsb|j}|jd�\}}}|rN|jd�\}}}|sXd}n
d}}||fS)N�@�:)�netloc�
rpartition�	partition)r8rN�userinfo�	have_info�hostinforB�
have_passwordrCrrrrA�s		
z_NetlocResultMixinStr._userinfocCs�|j}|jd�\}}}|jd�\}}}|rr|jd�\}}}|jd�\}}}n|jd�\}}}|s�d}||fS)NrL�[�]rM)rNrOrP)r8rN�_rS�have_open_br�	bracketedrFrIrrrrD�s	z_NetlocResultMixinStr._hostinfoN)r9r:r;r=rJrArDrrrrrK�srKc@s:eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinBytescCsb|j}|jd�\}}}|rN|jd�\}}}|sXd}n
d}}||fS)N�@�:)rNrOrP)r8rNrQrRrSrBrTrCrrrrA�s		
z!_NetlocResultMixinBytes._userinfocCs�|j}|jd�\}}}|jd�\}}}|rr|jd�\}}}|jd�\}}}n|jd�\}}}|s�d}||fS)Nr[�[�]r\)rNrOrP)r8rNrWrSrXrYrFrIrrrrD�s	z!_NetlocResultMixinBytes._hostinfoN)r9r:r;r=rJrArDrrrrrZ�srZ)�
namedtuplezurl fragmentz!scheme netloc path query fragmentz(scheme netloc path params query fragmentc@s"eZdZfZdd�ZdS)rcCs&|jr|jd|jS|jSdS)N�#)�fragment�url)r8rrr�geturl�s	zDefragResult.geturlN)r9r:r;r=rcrrrrr�sc@s"eZdZfZdd�ZdS)rcCs
t|�S)N)r)r8rrrrcszSplitResult.geturlN)r9r:r;r=rcrrrrr�sc@s"eZdZfZdd�ZdS)rcCs
t|�S)N)r)r8rrrrcszParseResult.geturlN)r9r:r;r=rcrrrrrsc@s"eZdZfZdd�ZdS)rcCs&|jr|jd|jS|jSdS)N�#)rarb)r8rrrrcs	zDefragResultBytes.geturlN)r9r:r;r=rcrrrrr	sc@s"eZdZfZdd�ZdS)rcCs
t|�S)N)r)r8rrrrcszSplitResultBytes.geturlN)r9r:r;r=rcrrrrrsc@s"eZdZfZdd�ZdS)rcCs
t|�S)N)r)r8rrrrcszParseResultBytes.geturlN)r9r:r;r=rcrrrrrscCsNttfttfttff}x&|D]\}}||_||_q(WdS)N)rrrrrrr7r?)Z
_result_pairsZ_decodedZ_encodedrrr�_fix_result_transcodings			reTc
Cs�t||�\}}}t|||�}|\}}}}}|tkrld|krlt|�\}}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)r5r�uses_params�_splitparamsr)
rb�scheme�allow_fragments�_coerce_resultZsplitresultrN�queryra�params�resultrrrr)scCsqd|kr@|jd|jd��}|dkrO|dfSn|jd�}|d|�||dd�fS)N�/rfrrr0)�find�rfind)rb�irrrrh9s
rhcCsht|�}x;dD]3}|j||�}|dkrt||�}qW|||�||d�fS)Nz/?#r)�lenrp�min)rb�start�delim�cZwdelimrrr�_splitnetlocBs
rxcCs�|s!tdd�|D��r%dSddl}|jdd�}|jdd�}|jdd�}|jdd�}|jd	|�}||kr�dSx2d
D]*}||kr�td|dd
��q�WdS)Ncss!|]}t|�dkVqdS)�N)�ord)r*rwrrrr,Ksz_checknetloc.<locals>.<genexpr>rrLrrMr`�?ZNFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�any�unicodedata�replaceZ	normalize�
ValueError)rNr}�nZnetloc2rwrrr�_checknetlocJs!
r�c
Cs8t||�\}}}t|�}|||t|�t|�f}tj|d�}|rg||�Stt�tkr�t�d}}}|jd�}	|	dkrM|d|	�dkr�|d|	�j	�}||	dd�}|dd�dkrPt
|d�\}}d	|kr,d
|ksDd
|krPd	|krPtd��|rzd|krz|jdd�\}}d
|kr�|jd
d�\}}t
|�t|||||�}
|
t|<||
�Sxv|d|	�D]}|tkr�Pq�W||	dd�}|s0tdd�|D��rM|d|	�j	�|}}|dd�dkr�t
|d�\}}d	|kr�d
|ks�d
|kr�d	|kr�td��|r�d|kr�|jdd�\}}d
|kr|j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.NrrMrrr0�z//rUrVzInvalid IPv6 URLr`r{css|]}|dkVqdS)�
0123456789Nr)r*rwrrrr,�szurlsplit.<locals>.<genexpr>)r5�bool�typer�getrs�MAX_CACHE_SIZEr rprErxr�splitr�r�scheme_charsr|)
rbrirjrk�key�cachedrNrlrarr�vrw�restrrrr\s\!



 

cCsVt|�\}}}}}}}|r7d||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)r5r)�
componentsrirNrbrmrlrarkrrrr�s!cCs�t|�\}}}}}}|sL|r�|tkr�|dd�dkr�|rr|dd�dkrrd|}d|p~d|}|r�|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//r0rorrMr{r`)r5�uses_netloc)r�rirNrbrlrarkrrrr�s.
cCsR|s
|S|s|St||�\}}}t|d|�\}}}}}}	t|||�\}
}}}
}}|
|ks�|
tkr�||�S|
tkr�|r�|t|
|||
||f��S|}|r|
r|}|}
|s�|}|t|
|||
||f��S|jd�}|ddkr>|d=|dd�dkrf|jd�}n6||jd�}td|dd	��|dd
�<g}x_|D]W}|dkr�y|j�Wqtk
r�YqXq�|dkr�q�q�|j	|�q�W|ddkr!|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.rror0N�..�.���r�r�r�r�)r�r�)r5r�
uses_relativer�rr��filter�pop�
IndexError�append�join)�baserbrjrkZbschemeZbnetlocZbpathZbparamsZbqueryZ	bfragmentrirN�pathrmrlraZ
base_partsZsegmentsZ
resolved_pathZsegrrrr�sT$$
#


c	Cs|t|�\}}d|kr]t|�\}}}}}}t|||||df�}nd}|}|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)r5rrr)	rbrk�sr��p�a�qZfragZdefragrrrr�s!Z0123456789ABCDEFabcdefcCs
|s|jdSt|t�r/|jd�}|jd�}t|�dkrT|S|dg}|j}tdkr�dd�tD�axq|dd�D]_}y0|t|dd	��||d	d��Wq�tk
r�|d�||�Yq�Xq�Wdj	|�S)
z,unquote_to_bytes('abc%20def') -> b'abc def'.�zutf-8�%r0rNcSsFi|]<}tD]/}tt||d�g�||j��qqS)�)�_hexdig�bytesrHr%)r*r��brrr�
<dictcomp>s	z$unquote_to_bytes.<locals>.<dictcomp>r�)
r�r1r2r%rsr��
_hextobyter��KeyErrorr�)�string�bits�resr��itemrrrrs*
		


z([-]+)zutf-8r~cCs�d|kr|j|S|dkr)d}|dkr;d}tj|�}|dg}|j}xRtdt|�d�D]8}|t||�j||��|||d�qyWdj|�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'.
    �%Nzutf-8r~rr0r�r)r��_asciirer��rangersrr)r�)r�r&r'r�r�r�rrrrrr,s

	 Fc	Csli}t|||d|d|�}xA|D]9\}}||krW||j|�q+|g||<q+W|S)anParse 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.

        Returns a dictionary.
    r&r')r
r�)	�qs�keep_blank_values�strict_parsingr&r'Z
parsed_result�pairs�name�valuerrrr	FscCsMt|�\}}dd�|jd�D�}g}x|D]
}|rR|rRq;|jdd�}	t|	�dkr�|r�td|f��|r;|	jd�nq;t|	d�s�|r;|	d	jd
d�}
t|
d|d
|�}
||
�}
|	djd
d�}t|d|d
|�}||�}|j|
|f�q;W|S)anParse 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.

        Returns a list, as G-d intended.
    cSs,g|]"}|jd�D]}|�qqS)rf)r�)r*�s1�s2rrr�
<listcomp>�s	zparse_qsl.<locals>.<listcomp>�&�=r0r�zbad query field: %rrr�+� r&r')r5r�rsrr�r~r)r�r�r�r&r'rkr��rZ
name_valueZnvr�r�rrrr
is,
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'rrrr�ssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-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)r8r�rrr�__init__�szQuoter.__init__cCsd|jjt|�fS)Nz<%s %r>)�	__class__r9�dict)r8rrr�__repr__�szQuoter.__repr__cCs8||jkrt|�ndj|�}|||<|S)Nz%{:02X})r��chr�format)r8r�r�rrr�__missing__�s*
zQuoter.__missing__N)r9r:r;r<r�r�r�rrrrr��sr�rocCs�t|t�rR|s|S|dkr+d}|dkr=d}|j||�}n0|dk	rjtd��|dk	r�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.

    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)r1r2r%r3r
)r�r�r&r'rrrr�scCs�t|t�rd|ks6t|t�rId|krIt||||�St|t�rad}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�)r1r2r�rr~)r�r�r&r'Zspacerrrr�s	cs�t|ttf�s!td��|s+dSt|t�rO|jdd�}ntdd�|D��}|jt|�s�|j�Syt	|�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!�ignorecSs"g|]}|dkr|�qS)�r)r*rwrrrr�	s	z$quote_from_bytes.<locals>.<listcomp>csg|]}�|��qSrr)r*�char)�quoterrrr�s	)r1r��	bytearrayr3r2r%�rstrip�_ALWAYS_SAFE_BYTESr)rr�r��__getitem__r�)Zbsr�r)r�rr
�s

cCs�t|d�r|j�}niy*t|�rGt|dt�rGt�Wn<tk
r�tj�\}}}td�j|��YnXg}	|s:x |D]�\}
}t|
t	�r�||
|�}
n|t
|
�|||�}
t|t	�r|||�}n|t
|�|||�}|	j|
d|�q�Wn|xy|D]q\}
}t|
t	�rn||
|�}
n|t
|
�|||�}
t|t	�r�|||�}|	j|
d|�qAt|t
�r�|||||�}|	j|
d|�qAyt|�}WnBtk
rO|t
|�|||�}|	j|
d|�YqAXx_|D]W}
t|
t	�r~||
|�}
n|t
|
�|||�}
|	j|
d|
�qWWqAWdj|	�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�rsr1r-r3�sys�exc_info�with_tracebackr�r2r�r�)rlZdoseqr�r&r'Z	quote_viaZtyZva�tb�l�kr�r+ZeltrrrrsP 



cCs[t|t�rWy|jd�j�}Wn,tk
rVtdt|�d��YnX|S)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)r1r2r%r)�UnicodeError�repr)rbrrr�to_bytesbs
r�cCs�t|�j�}|dd�dkrT|dd�dkrT|dd�j�}|dd�dkr�|dd�j�}|S)	z8unwrap('<URL:type://host/path>') --> 'type://host/path'.Nr0�<�>�zURL:r�r�)r2�strip)rbrrr�unwrapos,r�cCsbtdkr!tjdtj�atj|�}|rX|j�\}}|j�|fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz
([^/:]+):(.*))�	_typeprog�re�compile�DOTALL�match�groupsrE)rbr�ri�datarrr�	splittypexsr�cCs|tdkr!tjdtj�atj|�}|rr|j�\}}|rh|ddkrhd|}||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)rro)�	_hostprogr�r�r�r�r�)rbr�Z	host_portr�rrr�	splithost�s

r�cCs.|jd�\}}}|r$|nd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rLN)rO)�host�userrvrrr�	splituser�sr�cCs.|jd�\}}}||r'|ndfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rMN)rP)r�rvZpasswdrrr�splitpasswd�sr�cCsbtdkr!tjdtj�atj|�}|rX|j�\}}|rX||fS|dfS)z*splitport('host:port') --> 'host', 'port'.Nz(.*):([0-9]*)$)�	_portprogr�r�r�r�r�)r�r�rIrrr�	splitport�s
r�r0cCsl|jd�\}}}|s'|}n;|rbyt|�}Wntk
rWd}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.rMN)rOrHr)r�ZdefportrvrIZnportrrr�
splitnport�s	

r�cCs2|jd�\}}}|r(||fS|dfS)z/splitquery('/path?query') --> '/path', 'query'.r{N)rO)rbr�rvrlrrr�
splitquery�s
r�cCs2|jd�\}}}|r(||fS|dfS)z)splittag('/path#tag') --> '/path', 'tag'.r`N)rO)rbr�rv�tagrrr�splittag�s
r�cCs'|jd�}|d|dd�fS)zksplitattr('/path;attr1=value1;attr2=value2;...') ->
        '/path', ['attr1=value1', 'attr2=value2', ...].rfrr0N)r�)rbZwordsrrr�	splitattr�sr�cCs.|jd�\}}}||r'|ndfS)z-splitvalue('attr=value') --> 'attr', 'value'.r�N)rP)�attrrvr�rrr�
splitvalue�sr�r�)Sr<r�r��collections�__all__r�r�rgZnon_hierarchicalZ
uses_queryZ
uses_fragmentr�r�rr Z_implicit_encodingZ_implicit_errorsr$r(r/r5�objectr6r>r@rKrZr_Z_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaseZ
ResultBaserrrrrrrerrhrxr�rrrrrr�r�rr�r�rr	r
r�	frozensetr�r�r�r�defaultdictr�rrr
rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s�		 
	:E"/	,O