ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/urllib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/urllib/__pycache__/parse.cpython-34.pyo

�
e fX��@s�dZddlZddlZddlZddddddd	d
ddd
ddddgZddddddddddddddd d!d"gZddddd#ddddddd$dddd%dd!d"d d&d'd(gZdd)dddddddd*d+ddd d,gZdd)d-d.d#ddd$d*d+g
Zdddddddddd*d+dgZ	dd)ddd.ddddd$dddg
Z
d/Zd0ZiZ
d1d2�Zd3Zd4Zd5d6�Zeed7d8�Zeed9d:�Zd;d<�ZGd=d>�d>e�ZGd?d@�d@e�ZGdAdB�dBe�ZGdCdD�dDee�ZGdEdF�dFee�ZddGlmZedHdI�ZedJdK�ZedLdM�ZeZGdNdH�dHee�Z GdOdJ�dJee�Z!GdPdL�dLee�Z"GdQdR�dRee�Z#GdSdT�dTee�Z$GdUdV�dVee�Z%dWdX�Z&e&�[&ddYdZd�Z'd[d\�Z(dd]d^�Z)d_d`�Z*ddYdad�Z+dbd�Z,dcd�Z-dYddd�Z.ded�Z/dfZ0da1dgd�Z2ej3dh�Z4didjdkd�Z5dldldidjdmd
�Z6dldldidjdnd�Z7didjdod�Z8e9dp�Z:e;e:�Z<iZ=Gdqdr�drej>�Z?dsdddtd�Z@ddddud
�ZAdsdvd�ZBdlddddwd	�ZCdxdy�ZDdzd{�ZEdaFd|d}�ZGdaHd~d�ZIdaJd�d��ZKdaLd�d��ZMdaNd�d��ZOdaPd�d�d��ZQdaRd�d��ZSdaTd�d��ZUd�d��ZVdaWd�d��ZXdS)�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_bytesZftp�httpZgopherZnntpZimapZwais�fileZhttpsZshttpZmmsZprosperoZrtspZrtspu�ZsftpZsvnzsvn+sshZtelnetZsnewsZrsyncZnfsZgitzgit+sshZhdlZsipZsipsZtelZmailtoZnewszAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.�cCstj�tj�dS)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear�
_safe_quoters�rr�1/opt/alt/python34/lib64/python3.4/urllib/parse.py�clear_cacheHs
r�ascii�strictcCs|S)Nr)�objrrr�_noopWsrcCs|j||�S)N)�encode)r�encoding�errorsrrr�_encode_resultZsr"cs t��fdd�|D��S)Nc3s-|]#}|r!|j���ndVqdS)rN)�decode)�.0�x)r r!rr�	<genexpr>`sz_decode_args.<locals>.<genexpr>)�tuple)�argsr r!r)r r!r�_decode_args^sr)cGszt|dt�}xB|dd�D]0}|r$t|t�|kr$td��q$q$W|ri|tfSt|�tfS)Nr�z$Cannot mix str and non-str arguments)�
isinstance�str�	TypeErrorrr)r")r(Z	str_input�argrrr�_coerce_argsbsr/c@s.eZdZdZfZdddd�ZdS)�_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesrrcs#|j��fdd�|D��S)Nc3s!|]}|j���VqdS)N)r)r$r%)r r!rrr&xsz)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart)�selfr r!r)r r!rrwsz_ResultMixinStr.encodeN)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrr0ssr0c@s.eZdZdZfZdddd�ZdS)�_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strrrcs#|j��fdd�|D��S)Nc3s!|]}|j���VqdS)N)r#)r$r%)r r!rrr&�sz+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpart)r2r r!r)r r!rr#sz_ResultMixinBytes.decodeN)r3r4r5r6r7r#rrrrr8{sr8c@sdeZdZdZfZedd��Zedd��Zedd��Zedd	��Z	d
S)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementcCs|jdS)Nr)�	_userinfo)r2rrr�username�sz_NetlocResultMixinBase.usernamecCs|jdS)Nr*)r;)r2rrr�password�sz_NetlocResultMixinBase.passwordcCs;|jd}|sd}n|dk	r7|j�}n|S)Nr)�	_hostinfo�lower)r2�hostnamerrrr@�s
	z_NetlocResultMixinBase.hostnamecCsO|jd}|dk	rKt|d�}d|ko?dknsKdSn|S)Nr*�
ri��)r>�int)r2�portrrrrC�s
z_NetlocResultMixinBase.portN)
r3r4r5r6r7�propertyr<r=r@rCrrrrr:�s	r:c@s:eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinStrcCse|j}|jd�\}}}|rQ|jd�\}}}|s[d}q[n
d}}||fS)N�@�:)�netloc�
rpartition�	partition)r2rH�userinfo�	have_info�hostinfor<�
have_passwordr=rrrr;�s	
z_NetlocResultMixinStr._userinfocCs�|j}|jd�\}}}|jd�\}}}|rr|jd�\}}}|jd�\}}}n|jd�\}}}|s�d}n||fS)NrF�[�]rG)rHrIrJ)r2rH�_rM�have_open_br�	bracketedr@rCrrrr>�s		z_NetlocResultMixinStr._hostinfoN)r3r4r5r7rDr;r>rrrrrE�srEc@s:eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinBytescCse|j}|jd�\}}}|rQ|jd�\}}}|s[d}q[n
d}}||fS)N�@�:)rHrIrJ)r2rHrKrLrMr<rNr=rrrr;�s	
z!_NetlocResultMixinBytes._userinfocCs�|j}|jd�\}}}|jd�\}}}|rr|jd�\}}}|jd�\}}}n|jd�\}}}|s�d}n||fS)NrU�[�]rV)rHrIrJ)r2rHrQrMrRrSr@rCrrrr>�s		z!_NetlocResultMixinBytes._hostinfoN)r3r4r5r7rDr;r>rrrrrT�srT)�
namedtuple�DefragResultzurl fragment�SplitResultz!scheme netloc path query fragment�ParseResultz(scheme netloc path params query fragmentc@s"eZdZfZdd�ZdS)rZcCs&|jr|jd|jS|jSdS)N�#)�fragment�url)r2rrr�geturl�s	zDefragResult.geturlN)r3r4r5r7r`rrrrrZ�sc@s"eZdZfZdd�ZdS)r[cCs
t|�S)N)r)r2rrrr`�szSplitResult.geturlN)r3r4r5r7r`rrrrr[�sc@s"eZdZfZdd�ZdS)r\cCs
t|�S)N)r)r2rrrr`�szParseResult.geturlN)r3r4r5r7r`rrrrr\�sc@s"eZdZfZdd�ZdS)�DefragResultBytescCs&|jr|jd|jS|jSdS)N�#)r^r_)r2rrrr`s	zDefragResultBytes.geturlN)r3r4r5r7r`rrrrra�srac@s"eZdZfZdd�ZdS)�SplitResultBytescCs
t|�S)N)r)r2rrrr`szSplitResultBytes.geturlN)r3r4r5r7r`rrrrrcsrcc@s"eZdZfZdd�ZdS)�ParseResultBytescCs
t|�S)N)r)r2rrrr`
szParseResultBytes.geturlN)r3r4r5r7r`rrrrrdsrdcCsNttfttfttff}x&|D]\}}||_||_q(WdS)N)rZrar[rcr\rdr1r9)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)r/r�uses_params�_splitparamsr\)
r_�scheme�allow_fragments�_coerce_resultZsplitresultrH�queryr^�params�resultrrrrscCsqd|kr@|jd|jd��}|dkrO|dfSn|jd�}|d|�||dd�fS)N�/rfrrr*)�find�rfind)r_�irrrrh.s
rhcCskt|�}x>dD]6}|j||�}|dkrt||�}qqW|||�||d�fS)Nz/?#r)�lenrp�min)r_�startZdelim�cZwdelimrrr�_splitnetloc7s
rwcCs�|s!tdd�|D��r%dSddl}|jd|�}||krSdS|jd�\}}}x5dD]-}||krrtd|dd	��qrqrWdS)
Ncss!|]}t|�dkVqdS)�N)�ord)r$rvrrrr&@sz_checknetloc.<locals>.<genexpr>rZNFKCrFz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�any�unicodedataZ	normalizerI�
ValueError)rHr{Znetloc2rQrvrrr�_checknetloc?s!
r}c
Cs\t||�\}}}t|�}|||t|�t|�f}tj|d�}|rg||�Stt�tkr�t�nd}}}|jd�}	|	dkre|d|	�dkr�|d|	�j	�}||	dd�}|dd�dkrYt
|d�\}}d	|kr/d
|ksGd
|krYd	|krYtd��qYn|r�d|kr�|jdd�\}}nd
|kr�|jd
d�\}}nt
|�t|||||�}
|
t|<||
�Sx|d|	�D]}|tkr�Pq�q�W||	dd�}|sBtdd�|D��re|d|	�j	�|}}qen|dd�dkr�t
|d�\}}d	|kr�d
|ks�d
|kr�d	|kr�td��q�n|r�d|kr�|jdd�\}}nd
|kr&|jd
d�\}}nt
|�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.NrrGrrr*�z//rOrPzInvalid IPv6 URLr]�?css|]}|dkVqdS)�
0123456789Nr)r$rvrrrr&vszurlsplit.<locals>.<genexpr>)r/�bool�typer�getrs�MAX_CACHE_SIZErrpr?rwr|�splitr}r[�scheme_charsrz)
r_rirjrk�key�cachedrHrlr^rr�vrv�restrrrrNs\!




 #

cCsYt|�\}}}}}}}|r:d||f}n|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)�
componentsrirHr_rmrlr^rkrrrr�s!cCs�t|�\}}}}}}|sL|r�|tkr�|dd�dkr�|ru|dd�dkrud|}nd|p�d|}n|r�|d|}n|r�|d|}n|r�|d	|}n||�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//r*rorrGrr])r/�uses_netloc)r�rirHr_rlr^rkrrrr�s.
cCs�|s
|S|s|St||�\}}}t|d|�\}}}}}}	t|||�\}
}}}
}}|
|ks�|
tkr�||�S|
tkr�|r�|t|
|||
||f��S|}n|dd�dkr|t|
|||
||f��S|rV|
rV|}|}
|s4|}n|t|
|||
||f��S|jd�dd�|jd�}|d	dkr�d|d
<nxd|kr�|jd�q�Wxud}t|�d}xX||kr+||dkr||ddkr||d|d�=Pn|d}q�WPq�W|ddgkrPd|d<n8t|�dkr�|d
dkr�dg|dd�<n|t|
|dj|�|
||f��S)zaJoin a base URL and a possibly relative URL to form an absolute
    interpretation of the latter.rNr*ro�.�..r~���r�r�)rr�r�r����)	r/r�
uses_relativer�rr��removers�join)�baser_rjrkZbschemeZbnetlocZbpathZbparamsZbqueryZ	bfragmentrirH�pathrmrlr^Zsegmentsrr�nrrrr�sZ$$
		&

"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)r/rrrZ)	r_rk�sr��p�a�qZfragZdefragrrrr�s!Z0123456789ABCDEFabcdefcCs|s|jdSt|t�r2|jd�}n|jd�}t|�dkrW|S|dg}|j}tdkr�dd�tD�anxq|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�%r*rNcSsFi|]<}tD]/}tt||d�g�||j��qqS)�)�_hexdig�bytesrBr)r$r��brrr�
<dictcomp>s	z$unquote_to_bytes.<locals>.<dictcomp>r~)
r�r+r,rrs�append�
_hextobyter��KeyErrorr�)�string�bits�resr��itemrrrr�s*
		


z([-]+)zutf-8�replacecCs�d|kr|j|S|dkr,d}n|dkrAd}ntj|�}|dg}|j}xRtdt|�d�D]8}|t||�j||��|||d�qWdj|�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�rr*r~r)r��_asciirer��rangersrr#r�)r�r r!r�r�r�rrrrrrs
		
	 Fc	Csli}t|||d|d|�}xA|D]9\}}||krW||j|�q+|g||<q+W|S)aOParse 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.
    r r!)r
r�)	�qs�keep_blank_values�strict_parsingr r!Z
parsed_result�pairs�name�valuerrrr	'scCsYt|�\}}dd�|jd�D�}g}x|D]}|rU|rUq;n|jdd�}	t|	�dkr�|r�td|f��n|r;|	jd�q�q;nt|	d�s�|r;|	d	jd
d�}
t|
d|d
|�}
||
�}
|	djd
d�}t|d|d
|�}||�}|j|
|f�q;q;W|S)a;Parse 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>�&�=r*r~zbad query field: %rrr�+� r r!)r/r�rsr|r�r�r)r�r�r�r r!rkr��rZ
name_valueZnvr�r�rrrr
Gs,
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!rrrrwssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-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)r2r�rrr�__init__�szQuoter.__init__cCsdt|�S)Nz<Quoter %r>)�dict)r2rrr�__repr__�szQuoter.__repr__cCs8||jkrt|�ndj|�}|||<|S)Nz%{:02X})r��chr�format)r2r�r�rrr�__missing__�s*
zQuoter.__missing__N)r3r4r5r6r�r�r�rrrrr��sr�rocCs�t|t�rX|s|S|dkr.d}n|dkrCd}n|j||�}n6|dk	rstd��n|dk	r�td��nt||�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-8rz,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r+r,rr-r
)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�)r+r,r�rr�)r�r�r r!Zspacerrrr�s	cs�t|ttf�s$td��n|s.dSt|t�rR|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$rvrrrr��s	z$quote_from_bytes.<locals>.<listcomp>csg|]}�|��qSrr)r$�char)�quoterrrr��s	)r+r��	bytearrayr-r,r�rstrip�_ALWAYS_SAFE_BYTESr#rr�r��__getitem__r�)Zbsr�r)r�rr
�s

c
Cs�t|d�r|j�}nly-t|�rJt|dt�rJt�nWn<tk
r�tj�\}}}td�j|��YnXg}|s=x |D]�\}	}
t|	t	�r�t
|	|�}	nt
t|	�|||�}	t|
t	�rt
|
|�}
nt
t|
�|||�}
|j|	d|
�q�Wn|xy|D]q\}	}
t|	t	�rqt
|	|�}	nt
t|	�|||�}	t|
t	�r�t
|
|�}
|j|	d|
�qDt|
t�r�t
|
|||�}
|j|	d|
�qDyt|
�}WnBtk
rRt
t|
�|||�}
|j|	d|
�YqDXx_|
D]W}t|t	�r�t
||�}nt
t|�|||�}|j|	d|�qZWqDWdj
|�S)aGEncode 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 quote_plus()
    (encoding and errors only if a component is a str).
    �itemsrz1not a valid non-string sequence or mapping objectr�r�)�hasattrr�rsr+r'r-�sys�exc_info�with_tracebackr�rr,r�r�)
rlZdoseqr�r r!ZtyZva�tb�l�kr�r%Zeltrrrr�sP 



cCs^t|t�rZy|jd�j�}WqZtk
rVtdt|�d��YqZXn|S)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)r+r,rr#�UnicodeError�repr)r_rrr�to_bytesNs
r�cCs�t|�j�}|dd�dkrW|dd�dkrW|dd�j�}n|dd�dkr�|dd�j�}n|S)	z8unwrap('<URL:type://host/path>') --> 'type://host/path'.Nr*�<�>�zURL:r�r�)r,�strip)r_rrr�unwrap[s,r�cCsptdkrtjd�antj|�}|rf|jd�}|j�|t|�dd�fSd|fS)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz
^([^/:]+):r*)�	_typeprog�re�compile�match�groupr?rs)r_r�rirrr�	splittypeds$r�cCs�tdkr$tjdtj�antj|�}|r�|jd�}|jd�}|rz|jd�rzd|}n||fSd|fS)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)r*r~ro)�	_hostprogr�r��DOTALLr�r��
startswith)r_r�Z	host_portr�rrr�	splithostqs

r�cCsMtdkrtjd�antj|�}|rC|jdd�Sd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nz^(.*)@(.*)$r*r~)�	_userprogr�r�r�r�)�hostr�rrr�	splituser�sr�cCsStdkr$tjdtj�antj|�}|rI|jdd�S|dfS)z/splitpasswd('user:passwd') -> 'user', 'passwd'.Nz^([^:]*):(.*)$r*r~)�_passwdprogr�r��Sr�r�)�userr�rrr�splitpasswd�sr�cCsbtdkrtjd�antj|�}|rX|j�\}}|rX||fSn|dfS)z*splitport('host:port') --> 'host', 'port'.Nz^(.*):([0-9]*)$)�	_portprogr�r�r��groups)r�r�rCrrr�	splitport�s
r�r*cCs�tdkrtjd�antj|�}|r�|jdd�\}}|r�yt|�}Wntk
r{d}YnX||fSn||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.Nz^(.*):(.*)$r*r~)�
_nportprogr�r�r�r�rBr|)r�Zdefportr�rCZnportrrr�
splitnport�s

r�cCsMtdkrtjd�antj|�}|rC|jdd�S|dfS)z/splitquery('/path?query') --> '/path', 'query'.Nz^(.*)\?([^?]*)$r*r~)�
_queryprogr�r�r�r�)r_r�rrr�
splitquery�sr�cCsMtdkrtjd�antj|�}|rC|jdd�S|dfS)z)splittag('/path#tag') --> '/path', 'tag'.Nz^(.*)#([^#]*)$r*r~)�_tagprogr�r�r�r�)r_r�rrr�splittag�sr�cCs'|jd�}|d|dd�fS)zksplitattr('/path;attr1=value1;attr2=value2;...') ->
        '/path', ['attr1=value1', 'attr2=value2', ...].rfrr*N)r�)r_Zwordsrrr�	splitattr�sr�cCsMtdkrtjd�antj|�}|rC|jdd�S|dfS)z-splitvalue('attr=value') --> 'attr', 'value'.Nz^([^=]*)=(.*)$r*r~)�
_valueprogr�r�r�r�)�attrr�rrr�
splitvalue�sr�r�)Yr6r�r��collections�__all__r�r�rgZnon_hierarchicalZ
uses_queryZ
uses_fragmentr�r�rrZ_implicit_encodingZ_implicit_errorsrr"r)r/�objectr0r8r:rErTrYZ_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaseZ
ResultBaserZr[r\rarcrdrerrhrwr}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�r�r�r�r�r�r�rrrr�<module>s� 
	:5/	,^






Zerion Mini Shell 1.0