Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/lazr/uri/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyc


Oc@sdZeZddddddgZddlZyeWnek
rQeZnXi*d	d
6dd6d
d6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d6d86d9d:6d;d<6d=d>6d?d@6dAdB6dAdC6dDdE6dDdF6dGdH6dDdI6ddJ6dKdL6dMdN6dKdO6dKdP6dQdR6dKdS6ZdTZ	dUZ
dVZdWZdXe
eefZ
dYZdZZd[Zd\eZd]Zd^e
eeeefZd_e
eeeefZd`ZdaZdbe	eeefZdceeefZejeejZejeejZddZdeZdfZde fdgYZ!dfdhYZ"diidjdk6Z#eje#ejej$BZ%ejdlZ&dmZ'dS(ns/Functions for working with generic syntax URIs.tURItInvalidURIErrortfind_uris_in_texttpossible_uri_retmergetremove_dot_segmentsiNt674tacapt80tdavt2628tdictt53tdnst21tftpt1096tgot70tgophert1720th323thttpt443thttpst143timapt631tippt702s	iris.beept389tldapt1038tmtqpt3905tmupdatet2049tnfst119tnntpt110tpopt554trtspt5060tsipt5061tsipst161tsnmpt605s	soap.beeps
soap.beepst23ttelnett69ttftpt3372ttipt575tvemmit602sxmlrpc.beepsxmlrpc.beepst210sz39.50rsz39.50st1525tprosperotwaissbzr+httpt22sbzr+ssht6667tirctsftptssht3690tsvnssvn+sshs(?P<scheme>[a-z][-a-z0-9+.]*)s9(?P<userinfo>(?:[-a-z0-9._~!$&\'()*+,;=:]|%[0-9a-f]{2})*)ss(?P<host>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|(?:[-a-z0-9._~!$&\'()*+,;=]|%[0-9a-f]{2})*|\[[0-9a-z:.]+\])s(?P<port>[0-9]*)s!(?P<authority>(?:%s@)?%s(?::%s)?)s2(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*s](?:[-a-z0-9._~!$&\'()*+,;=@]|%[0-9a-f]{2})+(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*s^(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})+(?:/(?:[-a-z0-9._~!$&\'()*+,;=:@]|%[0-9a-f]{2})*)*s/(?:%s)?ts(?P<hierpart>//%s%s|%s|%s|%s)s!(?P<relativepart>//%s%s|%s|%s|%s)s=(?P<query>(?:[-a-z0-9._~!$&\'()*+,;=:@/?\[\]]|%[0-9a-f]{2})*)s<(?P<fragment>(?:[-a-z0-9._~!$&\'()*+,;=:@/?]|%[0-9a-f]{2})*)s%s:%s(?:\?%s)?(?:#%s)?$s%s(?:\?%s)?(?:#%s)?$cCs9|r|dkrd|S|jd}||d |S(s/Merge two URI path components into a single path component.

    Follows rules specified in Section 5.2.3 of RFC 3986.

    The algorithm in the RFC treats the empty basepath edge case
    differently for URIs with and without an authority section, which
    is why the third argument is necessary.
    RGt/i(trfind(tbasepathtrelpatht
has_authoritytslash((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRs	cCsJg}x4|r<|jdr+|d}q	|jdrG|d}q	|jdsb|dkrsd|d}q	|jds|d	krd|d
}t|dkr9|d=q9q	|dkrd}q	|jdr|jdd}n|jd}|dkrt|}n|j|| ||}q	Wdj|S(sqRemove '.' and '..' segments from a URI path.

    Follows the rules specified in Section 5.2.4 of RFC 3986.
    s../is./is/./s/.RHs/../s/..iiit.s..RGi(RNs..(t
startswithtlentfindtappendtjoin(tpathtoutputRM((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRs,	


	cCs|jd}d}xt|D]\}}|dkr@q"nyt|d d}Wntk
rmq"nXt||krt||d||<q"d||df||<q"Wdj|S(sReturn a version of 's' where no unreserved characters are encoded.

    Unreserved characters are defined in Section 2.3 of RFC 3986.

    Percent encoded sequences are normalised to upper case.
    t%sBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~iiis%%%02X%sRG(tsplitt	enumeratetintt
ValueErrortchrRS(tstringtresultt
unreservedtindextitemtch((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pytnormalise_unreserveds
cBseZdZRS(sInvalid URI(t__name__t
__module__t__doc__(((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRsc	BseZdZdddddddddZdZedZedZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZRS(sA class that represents a URI.

    This class can represent arbitrary URIs that conform to the
    generic syntax described in RFC 3986.
    c	Cs|dk	r`|dkr`|dkr`|dkr`|dkr`|dkr`|dkr`|dksx|dksxtd|dk	rt|try|jdWqtk
rtdqXntj|}	|	dkrtd|n|	j	d|_
|	j	d|_|	j	d|_|	j	d|_
|	j	d	}
|	j	d
}|dkrs|
|_n|
dt||_|	j	d|_|	j	d
|_n|dkrtdn|dkr|dk	s|dk	rtdn|dkrtdn||_
||_||_||_
||_||_||_|j|j
d kr|jrtd|j
ndS(!sCreate a URI instance.

        Can be called with either a string URI or the component parts
        of the URI as keyword arguments.

        In either case, all arguments are expected to be appropriately
        URI encoded.
        seURI() must be called with a single string argument or with URI components given as keyword arguments.tASCIIs%URIs must consist of ASCII characterss"%s" is not a valid URItschemetuserinfothosttportthierpartt	authorityitquerytfragmentsURIs must have a schemes*host must be given if userinfo or port aresURIs must have a pathRRRRR4RtmmsR+RFssvn+sshtbzrsbzr+httpsbzr+sshs%s URIs must have a host nameN(
RRRRR4RRoR+RFssvn+sshRpsbzr+httpsbzr+ssh(tNonetAssertionErrort
isinstancetunicodetencodetUnicodeEncodeErrorRturi_pattmatchtgroupRgRhRiRjRTRPRmRnt
_normalise(tselfturiRgRhRiRjRTRmRnRxRkRl((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt__init__s\
$$'	
$							
	
cCsB|jj|_|jdk	r6t|j|_n|jdk	r`t|jj|_n|jdkr{d|_n9|jdk	r|jtj|jkrd|_qn|jdk	r|j	dkrd|_	ntt
|j	|_	|jdk	rt|j|_n|jdk	r>t|j|_ndS(s(Perform normalisation of URI components.RGRHN(
RgtlowerRhRqRbRiRjt
_default_porttgetRTRRmRn(R{((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRzs"cCsj|jdkrdS|j}|jdk	rAd|j|f}n|jdk	rfd||jf}n|S(sThe authority part of the URIs%s@%ss%s:%sN(RiRqRhRj(R{Rl((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRl3s	cCs1|j}|dkr|jSd||jfSdS(s The hierarchical part of the URIs//%s%sN(RlRqRT(R{Rl((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt	hier_part?s	cCs`d|j|jf}|jdk	r9|d|j7}n|jdk	r\|d|j7}n|S(Ns%s:%ss?%ss#%s(RgRRmRqRn(R{R|((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt__str__HscCsd|jjt|fS(Ns%s(%r)(t	__class__Rctstr(R{((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt__repr__PscCsrt||jrj|j|jkoi|j|jkoi|j|jkoi|j|jkoi|j|jkStSdS(N(RsRRgRlRTRmRntNotImplemented(R{tother((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt__eq__SscCs(|j|}|tkrtS|SdS(N(RR(R{Rtequal((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt__ne__]scKsl|s
|Std|jd|jd|jd|jd|jd|jd|j}|j||j	|S(s;Replace one or more parts of the URI, returning the result.RgRhRiRjRTRmRn(
RRgRhRiRjRTRmRntupdateR(R{tpartst	baseparts((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pytreplaceds						
cCsy|j|SWntk
r$nXtj|}|dkrOtdntd|j}|jd}|dk	r|jd|d<|jd|d<|jd|d<t|jddt	||d	<|jd
|d
<n|jd}|jd
}|dkrR|j
|d	<|dk	rB||d
<q|j|d
<ne|jdrtt||d	<n9t
|j
|d
|jdk	|d	<t|d	|d	<||d
<|j|d<|j|d<|j|d<|jd|d<|j|S(sResolve the given URI reference relative to this URI.

        Uses the rules from Section 5.2 of RFC 3986 to resolve the new
        URI.
        sInvalid relative referenceRgRlRhRiRjtrelativepartiRTRmRGRHRLRnN(RRtrelative_ref_patRxRqRRgRyRRPRTRmRORRiRhRj(R{t	referenceRxRRlRTRm((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pytresolvessD
$





cCs)|jdst|jj|S(sAppend the given path to this URI.

        The path must not start with a slash, but a slash is added to
        base URI (before appending the path), in case it doesn't end
        with a slash.
        RH(RORrtensureSlashR(R{RT((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRRscCs|j|jks$|j|jkr(tS|j|jkr>tS|j}|jdsc|d7}n|j}|jds|d7}n|j|S(s9Returns True if the URI 'other' is contained by this one.RH(RgRltFalseRTtTruetendswithRO(R{RRJt	otherpath((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pytcontainss	
	
cCsLt|dkrtS|jjd}|jd}|t||kS(s@Return True if the given domain name a parent of the URL's host.iRN(RPRRiRW(R{tdomaintour_segmentstdomain_segments((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pytunderDomains
cCs1|jjdr|S|jd|jdSdS(s:Return a URI with the path normalised to end with a slash.RHRTN(RTRR(R{((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRscCs6|jjdr.|jd|jjdS|SdS(s>Return a URI with the path normalised to not end with a slash.RHRTN(RTRRtrstrip(R{((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt
ensureNoSlashsN(RcRdReRqR}RztpropertyRlRRRRRRRRRRRRR(((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyRs"@					
			2	
			s
\b
(?:about|gopher|http|https|sftp|news|ftp|mailto|file|irc|jabber|xmpp)
:
(?:
  (?:
    # "//" authority path-abempty
    //
    (?: # userinfo
      [%(unreserved)s:]*
      @
    )?
    (?: # host
      \d+\.\d+\.\d+\.\d+ |
      [%(unreserved)s]*
    )
    (?: # port
      : \d*
    )?
    (?: / [%(unreserved)s:@]* )*
  ) | (?:
    # path-absolute
    /
    (?: [%(unreserved)s:@]+
        (?: / [%(unreserved)s:@]* )* )?
  ) | (?:
    # path-rootless
    [%(unreserved)s@]
    [%(unreserved)s:@]*
    (?: / [%(unreserved)s:@]* )*
  )
)
(?: # query
  \?
  [%(unreserved)s:@/\?\[\]]*
)?
(?: # fragment
  \#
  [%(unreserved)s:@/\?]*
)?
s-a-zA-Z0-9._~%!$&'()*+,;=R^s
([,.?:);>]+)$ccshxatj|D]P}|j}tjd|}yt|}Wntk
rZqnX|VqWdS(s8Scan a block of text for URIs, and yield the ones found.RGN(tpossible_uri_pattfinditerRyturi_trailers_pattsubRR(ttextRxt
uri_stringR|((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyR=s
((Rettypet
__metaclass__t__all__treRtt	NameErrorRRt	scheme_retuserinfo_rethost_retport_retauthority_retpath_abempty_retpath_noscheme_retpath_rootless_retpath_absolute_ret
path_empty_rethier_part_retrelative_part_retquery_retfragment_returi_retrelative_ref_retcompilet
IGNORECASERwRRRRbt	ExceptionRRRtVERBOSERRR(((s1/usr/lib/python2.7/dist-packages/lazr/uri/_uri.pyt<module>s	





			d