Your IP : 3.15.18.118


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/urlparse.pyc

�
�mec@s�dZddlZddddddd	d
gZddd
ddddddddddddddgZddd
ddddddddddddddddddd d!gZdd"dddddddd#d$dddd%gZd
d"d&d'ddddd#d$g
Zddddddd
ddd#d$dgZdd"dd
d'ddddddddg
Zd(Z	d)Z
d*d+d,gZd-ZiZ
d.�Zd/efd0��YZdd1lmZd2ed2d3�efd4��YZd5ed5d6�efd7��YZded8�Zd9�Zd:d;�Zd<�Zd=�Zded>�Zd?�Zd@�ZedA�ZdB�Zye Wne!k
r�dC�Z"n
XdD�Z"dEZ#e$dF�e#D��Z%ej&dG�Z'dH�Z(d:d:dI�Z)d:d:dJ�Z*dS(Ks3Parse (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. Zwinski, 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.

i����Nturlparset
urlunparseturljoint	urldefragturlsplitt
urlunsplittparse_qst	parse_qsltftpthttptgophertnntptimaptwaistfilethttpstshttptmmstprosperotrtsptrtsputtsftptsvnssvn+sshttelnettsnewstrsynctnfstgitsgit+sshthdltsiptsipstteltmailtotnewssAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.t!	

 s	s
s
icCstj�dS(sClear the parse cache.N(t_parse_cachetclear(((s /usr/lib64/python2.7/urlparse.pytclear_cacheOstResultMixincBsJeZdZed��Zed��Zed��Zed��ZRS(s-Shared methods for the parsed result objects.cCsX|j}d|krT|jdd�d}d|krP|jdd�d}n|SdS(Nt@iit:(tnetloctrsplittsplittNone(tselfR*tuserinfo((s /usr/lib64/python2.7/urlparse.pytusernameWs	cCsR|j}d|krN|jdd�d}d|krN|jdd�dSndS(NR(iiR)(R*R+R,R-(R.R*R/((s /usr/lib64/python2.7/urlparse.pytpasswordas	cCs�|jjd�d}d|krId|krI|jd�ddj�Sd|krl|jd�dj�S|dkr|dS|j�SdS(	NR(i����t[t]iiR)R(R*R,tlowerR-(R.R*((s /usr/lib64/python2.7/urlparse.pythostnamejscCsx|jjd�djd�d}d|krt|jd�d}t|d�}d|kohdknrt|SndS(	NR(i����R3R)ii
ii��(R*R,tintR-(R.R*tport((s /usr/lib64/python2.7/urlparse.pyR7vs#(t__name__t
__module__t__doc__tpropertyR0R1R5R7(((s /usr/lib64/python2.7/urlparse.pyR'Ts

	(t
namedtupletSplitResults!scheme netloc path query fragmentcBseZdZd�ZRS(cCs
t|�S(N(R(R.((s /usr/lib64/python2.7/urlparse.pytgeturl�s((R8R9t	__slots__R>(((s /usr/lib64/python2.7/urlparse.pyR=�stParseResults(scheme netloc path params query fragmentcBseZdZd�ZRS(cCs
t|�S(N(R(R.((s /usr/lib64/python2.7/urlparse.pyR>�s((R8R9R?R>(((s /usr/lib64/python2.7/urlparse.pyR@�scCsst|||�}|\}}}}}|tkrTd|krTt|�\}}nd}t||||||�S(s#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.t;R(Rtuses_paramst_splitparamsR@(turltschemetallow_fragmentsttupleR*tquerytfragmenttparams((s /usr/lib64/python2.7/urlparse.pyR�scCsed|kr@|jd|jd��}|dkrO|dfSn|jd�}|| ||dfS(Nt/RAiRi(tfindtrfind(RDti((s /usr/lib64/python2.7/urlparse.pyRC�s
icCsbt|�}x>dD]6}|j||�}|dkrt||�}qqW|||!||fS(Ns/?#i(tlenRLtmin(RDtstarttdelimtctwdelim((s /usr/lib64/python2.7/urlparse.pyt_splitnetloc�s
cCs�|st|t�rdSddl}|jdd�}|jdd�}|jdd�}|jdd�}|jd|�}||kr�dSx-dD]%}||kr�td	|��q�q�WdS(
Ni����u@uu:u#u?tNFKCs/?#@:s>netloc %r contains invalid characters under NFKC normalization(t
isinstancetunicodetunicodedatatreplacet	normalizet
ValueError(R*RYtntnetloc2RS((s /usr/lib64/python2.7/urlparse.pyt_checknetloc�s
cCs'x tD]}|j|d�}qW|S(NR(t_UNSAFE_URL_BYTES_TO_REMOVERZ(RDtb((s /usr/lib64/python2.7/urlparse.pyt_remove_unsafe_bytes_from_url�s
cCs5t|�}t|�}|jt�}|jt�}t|�}|||t|�t|�f}tj|d�}|r|St	t�t
kr�t�nd}}}|jd�}|dkrJ|| dkr�|| j
�}||d}|d dkrYt|d�\}}d|kr/d	|ksGd	|krYd|krYtd
��qYn|r�d|kr�|jdd�\}}nd|kr�|jdd�\}}nt|�t|||||�}	|	t|<|	Sxj|| D]}
|
tkr�Pq�q�W||d}|s-td
�|D��rJ|| j
�|}}qJn|d dkr�t|d�\}}d|kr�d	|ks�d	|kr�d|kr�td
��q�n|r�d|kr�|jdd�\}}nd|kr|jdd�\}}nt|�t|||||�}	|	t|<|	S(sParse 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.RR)iR	iis//R2R3sInvalid IPv6 URLt#t?css|]}|dkVqdS(t
0123456789N((t.0RS((s /usr/lib64/python2.7/urlparse.pys	<genexpr>�sN(Rbtlstript_WHATWG_C0_CONTROL_OR_SPACEtstriptboolttypeR$tgetR-ROtMAX_CACHE_SIZER&RLR4RUR\R,R_R=tscheme_charstany(RDRERFtkeytcachedR*RHRIRNtvRStrest((s /usr/lib64/python2.7/urlparse.pyR�sb!




cCsJ|\}}}}}}|r1d||f}nt|||||f�S(s�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).s%s;%s(R(tdataRER*RDRJRHRI((s /usr/lib64/python2.7/urlparse.pyRscCs�|\}}}}}|s=|rw|tkrw|d dkrw|r`|d dkr`d|}nd|pld|}n|r�|d|}n|r�|d|}n|r�|d|}n|S(	skCombine 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).is//iRKRR)RdRc(tuses_netloc(RtRER*RDRHRI((s /usr/lib64/python2.7/urlparse.pyRs(
c
Csg|s
|S|s|St|d|�\}}}}}}t|||�\}	}
}}}
}|	|kst|	tkrx|S|	tkr�|
r�t|	|
|||
|f�S|}
n|d dkr�t|	|
|||
|f�S|r |r |}|}|
s|}
nt|	|
|||
|f�S|jd�d |jd�}|ddkr]d|d<nxd|kr||jd�q`Wxqd}t|�d}xU||kr�||dkr�||dd	kr�||d|d5Pn|d}q�WPq�|ddgkrd|d<n2t|�dkrB|ddkrBdg|d)nt|	|
dj|�||
|f�S(
saJoin a base URL and a possibly relative URL to form an absolute
    interpretation of the latter.RiRKi����t.s..ii����(Rs..(Rt
uses_relativeRuRR,tremoveROtjoin(tbaseRDRFtbschemetbnetloctbpathtbparamstbqueryt	bfragmentRER*tpathRJRHRItsegmentsRNR]((s /usr/lib64/python2.7/urlparse.pyR#sX$$		 

"cCs`d|krRt|�\}}}}}}t|||||df�}||fS|dfSdS(s�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.
    RcRN(RR(RDtsR]tptatqtfragtdefrag((s /usr/lib64/python2.7/urlparse.pyRWs

cCsdS(Ni((tx((s /usr/lib64/python2.7/urlparse.pyt_is_unicodehscCs
t|t�S(N(RWRX(R�((s /usr/lib64/python2.7/urlparse.pyR�kst0123456789ABCDEFabcdefccs?|]5}tD](}||tt||d��fVq
qdS(iN(t_hexdigtchrR6(RfR�Ra((s /usr/lib64/python2.7/urlparse.pys	<genexpr>tss([-]+)cCsOt|�r�d|kr|Stj|�}|dg}|j}xUtdt|�d�D];}|tt||��jd��|||d�qZWdj	|�S|jd�}t|�dkr�|S|dg}|j}x^|dD]R}y$|t
|d �||d�Wq�tk
r=|d�||�q�Xq�Wdj	|�S(s"unquote('abc%20def') -> 'abc def'.t%iiitlatin1R(R�t_asciireR,tappendtrangeROtunquotetstrtdecodeRyt	_hextochrtKeyError(R�tbitstresR�RNtitem((s /usr/lib64/python2.7/urlparse.pyR�xs.
	#

	

cCsZi}xMt|||�D]9\}}||krE||j|�q|g||<qW|S(s�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.
    (RR�(tqstkeep_blank_valueststrict_parsingtdicttnametvalue((s /usr/lib64/python2.7/urlparse.pyR�scCs$g|jd�D]"}|jd�D]}|^q#q}g}x�|D]�}|r_|r_qEn|jdd�}t|�dkr�|r�td|f�n|rE|jd�q�qEnt|d�s�|rEt|djd	d
��}	t|djd	d
��}
|j|	|
f�qEqEW|S(s�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.

    Returns a list, as G-d intended.
    t&RAt=iisbad query field: %rRit+t (R,ROR\R�R�RZ(R�R�R�ts1ts2tpairstrt
name_valuetnvR�R�((s /usr/lib64/python2.7/urlparse.pyR�s"8
(+R:tret__all__RwRuRBtnon_hierarchicalt
uses_queryt
uses_fragmentRnRhR`RmR$R&tobjectR'tcollectionsR<R=R@tTrueRRCRUR_RbRRRRRRXt	NameErrorR�R�R�R�tcompileR�R�RR(((s /usr/lib64/python2.7/urlparse.pyt<module>!sj	-""				=	
	4