Your IP : 13.59.236.101


Current Path : /usr/lib/python2.7/site-packages/pip/_vendor/distlib/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyo

�
��abc@srdZddlZddlZddlmZddddd	d
ddgZeje�Zde	fd
��YZ
defd��YZdefd��YZ
ejd�Zd�ZeZdefd��YZd�Zde
fd��YZejd�dfejd�dfejd�dfejd�dfejd�dfejd �dfejd!�d"fejd#�d$fejd%�d&fejd'�d(ff
Zejd)�dfejd*�dfejd+�d"fejd!�d"fejd,�dffZejd-�Zd.�Zd/�Zejd0ej�Zid1d26d1d36d4d56d1d66d7d86dd6dd"6Zd9�Zdefd:��YZde
fd;��YZ ejd<ej�Z!d=�Z"d>�Z#d	efd?��YZ$d
e
fd@��YZ%dAefdB��YZ&ie&eee�dC6e&ee dD��dE6e&e#e%e�dF6Z'e'dCe'dG<dH�Z(dS(Is~
Implementation of a flexible versioning scheme providing support for PEP-440,
setuptools-compatible and semantic versioning.
i����Ni(tstring_typestNormalizedVersiontNormalizedMatchert
LegacyVersiont
LegacyMatchertSemanticVersiontSemanticMatchertUnsupportedVersionErrort
get_schemecBseZdZRS(sThis is an unsupported version.(t__name__t
__module__t__doc__(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRstVersioncBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
ed��ZRS(
cCs-|j�|_}|j|�|_}dS(N(tstript_stringtparset_parts(tselftstparts((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__init__scCstd��dS(Nsplease implement in a subclass(tNotImplementedError(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR$scCs5t|�t|�kr1td||f��ndS(Nscannot compare %r and %r(ttypet	TypeError(Rtother((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_check_compatible'scCs|j|�|j|jkS(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__eq__+s
cCs|j|�S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__ne__/scCs|j|�|j|jkS(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__lt__2s
cCs|j|�p|j|�S(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__gt__6scCs|j|�p|j|�S(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__le__9scCs|j|�p|j|�S(N(RR(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__ge__<scCs
t|j�S(N(thashR(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__hash__@scCsd|jj|jfS(Ns%s('%s')(t	__class__R	R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__repr__CscCs|jS(N(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt__str__FscCstd��dS(NsPlease implement in subclasses.(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
is_prereleaseIs(R	R
RRRRRRRRRR!R#R$tpropertyR%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs												tMatchercBs�eZdZejd�Zejd�Zejd�Zid�d6d�d6d�d6d	�d
6d�d6d
�d6d�d6d�d6Z	d�Z
d�Zed��Z
d�Zd�Zd�Zd�Zd�Zd�ZRS(s^(\w[\s\w'.-]*)(\((.*)\))?s'^(<=|>=|<|>|!=|={2,3}|~=)?\s*([^\s,]+)$s
^\d+(\.\d+)*$cCs
||kS(N((tvtctp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt<lambda>Wtt<cCs
||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+XR,t>cCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+YR,s<=cCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+ZR,s>=cCs
||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+[R,s==cCs
||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+\R,s===cCs||kp||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+^R,s~=cCs
||kS(N((R(R)R*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+_R,s!=c
Cs�|jdkrtd��n|j�|_}|jj|�}|s\td|��n|jd�}|dj�|_|jj	�|_
g}|dr�g|djd�D]}|j�^q�}x�|D]�}|jj|�}|s
td||f��n|j�}|dp#d}|d	}|j
d
�r�|dkr^td
|��n|d t}}	|jj|�s�|j|�q�n|j|�t}}	|j|||	f�q�Wnt|�|_dS(NsPlease specify a version classs
Not valid: %rR,iit,sInvalid %r in %rs~=is.*s==s!=s#'.*' not allowed for %r constraintsi����(s==s!=(t
version_classtNonet
ValueErrorR
Rtdist_retmatchtgroupstnametlowertkeytsplittcomp_retendswithtTruetnum_retFalsetappendttupleR(
RRtmR5tclistR)tconstraintstoptvntprefix((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs:
,


cCs�t|t�r!|j|�}nx�|jD]�\}}}|jj|�}t|t�rmt||�}n|s�d||jjf}t	|��n||||�s+t
Sq+WtS(s�
        Check if the provided version matches the constraints.

        :param version: The version to match against this instance.
        :type version: String or :class:`Version` instance.
        s%r not implemented for %s(t
isinstanceRR0Rt
_operatorstgettgetattrR"R	RR>R<(Rtversiontoperatort
constraintRFtftmsg((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR4�scCsJd}t|j�dkrF|jdddkrF|jdd}n|S(Niis==s===(s==s===(R1tlenR(Rtresult((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
exact_version�s,cCsGt|�t|�ks*|j|jkrCtd||f��ndS(Nscannot compare %s and %s(RR6R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s*cCs/|j|�|j|jko.|j|jkS(N(RR8R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s
cCs|j|�S(N(R(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�scCst|j�t|j�S(N(R R8R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR!�scCsd|jj|jfS(Ns%s(%r)(R"R	R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR#�scCs|jS(N(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR$�sN(R	R
R1R0tretcompileR3R:R=RHRR4R&RRRRRR!R#R$(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR'Ns,







	%						sk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$cCsK|j�}tj|�}|s4td|��n|j�}td�|djd�D��}x0t|�dkr�|ddkr�|d }qfW|ds�d}nt|d�}|dd!}|d	d
!}|dd!}|d
}|dkr�d}n|dt|d�f}|dkr.d}n|dt|d�f}|dkr]d}n|dt|d�f}|dkr�d}nfg}	xQ|jd�D]@}
|
j
�r�dt|
�f}
nd|
f}
|	j|
�q�Wt|	�}|s|r|rd}qd}n|s&d}n|s5d}n||||||fS(NsNot a valid version: %scss|]}t|�VqdS(N(tint(t.0R(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys	<genexpr>�sit.i����iiiii	i
ii
tatzt_tfinal(NN((NN((NN(((RXi����(RY(RZ(R[(R
tPEP440_VERSION_RER4RR5R@R9RPRUR1tisdigitR?(RRAR5tnumstepochtpretposttdevtlocalRtpart((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_pep_440_key�sT#%
	



				
				cBsAeZdZd�Zedddddg�Zed��ZRS(sIA rational version.

    Good:
        1.2         # equivalent to "1.2.0"
        1.2.0
        1.2a1
        1.2.3a2
        1.2.3b1
        1.2.3c1
        1.2.3.4
        TODO: fill this out

    Bad:
        1           # minimum two numbers
        1.2a        # release level must have a release serial
        1.2.3b
    cCsQt|�}tj|�}|j�}td�|djd�D��|_|S(Ncss|]}t|�VqdS(N(RU(RVR(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys	<genexpr>siRW(t_normalized_keyR\R4R5R@R9t_release_clause(RRRQRAR5((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRs
&RXtbR)trcRbcst�fd��jD��S(Nc3s(|]}|r|d�jkVqdS(iN(tPREREL_TAGS(RVtt(R(s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pys	<genexpr>s(tanyR(R((Rs?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%s(R	R
RRtsetRjR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s	cCsUt|�}t|�}||kr(tS|j|�s;tSt|�}||dkS(NRW(tstrR<t
startswithR>RP(txtytn((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
_match_prefix"scBs�eZeZidd6dd6dd6dd6dd	6d
d6dd
6dd6Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
RS(t_match_compatibles~=t	_match_ltR-t	_match_gtR.t	_match_les<=t	_match_ges>=t	_match_eqs==t_match_arbitrarys===t	_match_nes!=cCsx|r"d|ko|jd}n|jdo:|jd}|rn|jjdd�d}|j|�}n||fS(Nt+i����ii(RRR9R0(RRKRMRFtstrip_localR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
_adjust_local<scCsj|j|||�\}}||kr+tS|j}djg|D]}t|�^qA�}t||�S(NRW(R~R>RgtjoinRnRs(RRKRMRFtrelease_clausetitpfx((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRuJs	(cCsj|j|||�\}}||kr+tS|j}djg|D]}t|�^qA�}t||�S(NRW(R~R>RgRRnRs(RRKRMRFR�R�R�((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRvRs	(cCs%|j|||�\}}||kS(N(R~(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRwZscCs%|j|||�\}}||kS(N(R~(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRx^scCsC|j|||�\}}|s0||k}nt||�}|S(N(R~Rs(RRKRMRFRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRybs
cCst|�t|�kS(N(Rn(RRKRMRF((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRzjscCsD|j|||�\}}|s0||k}nt||�}|S(N(R~Rs(RRKRMRFRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR{ms
cCs�|j|||�\}}||kr+tS||kr;tS|j}t|�dkrc|d }ndjg|D]}t|�^qp�}t||�S(Nii����RW(R~R<R>RgRPRRnRs(RRKRMRFR�R�R�((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRtus	
((R	R
RR0RHR~RuRvRwRxRyRzR{Rt(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR-s&
								s[.+-]$R,s^[.](\d)s0.\1s^[.-]s
^\((.*)\)$s\1s^v(ersion)?\s*(\d+)s\2s^r(ev)?\s*(\d+)s[.]{2,}RWs\b(alfa|apha)\btalphas\b(pre-alpha|prealpha)\bs	pre.alphas	\(beta\)$tbetas
^[:~._+-]+s
[,*")([\]]s[~:+_ -]s\.$s
(\d+(\.\d+)*)c	Cs�|j�j�}x&tD]\}}|j||�}qW|sJd}ntj|�}|snd}|}n�|j�djd�}g|D]}t|�^q�}x#t	|�dkr�|j
d�q�Wt	|�dkr�||j�}nDdjg|dD]}t
|�^q�||j�}|d }djg|D]}t
|�^qB�}|j�}|r�x)tD]\}}|j||�}qvWn|s�|}n&d|kr�dnd}|||}t|�s�d}n|S(	s�
    Try to suggest a semantic form for a version for which
    _suggest_normalized_version couldn't come up with anything.
    s0.0.0iRWiRbt-R|N(R
R7t
_REPLACEMENTStsubt_NUMERIC_PREFIXR4R5R9RURPR?tendRRnt_SUFFIX_REPLACEMENTSt	is_semverR1(	RRQtpattreplRARFtsuffixR�tsep((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_semantic_version�s:		:
(		cCs yt|�|SWntk
r%nX|j�}xSd2d3d4d5d6d7d8d9d:d;d<d=d>d?d@fD]\}}|j||�}qfWtjdd|�}tjdd|�}tjdd|�}tjdd|�}tjdd|�}|jd�r
|d }ntjd!d|�}tjd"d#|�}tjd$d%|�}tjd&d|�}tjd'd(|�}tjd)d(|�}tjd*d
|�}tjd+d,|�}tjd-d%|�}tjd.d/|�}tjd0d1|�}yt|�Wntk
rdA}nX|S(Bs�Suggest a normalized version close to the given version string.

    If you have a version string that isn't rational (i.e. NormalizedVersion
    doesn't like it) then you might be able to get an equivalent (or close)
    rational version from this function.

    This does a number of simple normalizations to the given string, based
    on observation of versions currently in use on PyPI. Given a dump of
    those version during PyCon 2009, 4287 of them:
    - 2312 (53.93%) match NormalizedVersion without change
      with the automatic suggestion
    - 3474 (81.04%) match when using this suggestion method

    @param s {str} An irrational version string.
    @returns A rational version string, or None, if couldn't determine one.
    s-alphaRXs-betaRhR�R�RiR)s-finalR,s-pres-releases.releases-stableR|RWRZt s.finalR[spre$tpre0sdev$tdev0s([abc]|rc)[\-\.](\d+)$s\1\2s[\-\.](dev)[\-\.]?r?(\d+)$s.\1\2s[.~]?([abc])\.?s\1R(is\b0+(\d+)(?!\d)s(\d+[abc])$s\g<1>0s\.?(dev-r|dev\.r)\.?(\d+)$s.dev\2s-(a|b|c)(\d+)$s[\.\-](dev|devel)$s.dev0s(?![\.\-])dev$s(final|stable)$s\.?(r|-|-r)\.?(\d+)$s.post\2s\.?(dev|git|bzr)\.?(\d+)$s\.?(pre|preview|-c)(\d+)$sc\g<2>sp(\d+)$s.post\1(s-alphaRX(s-betaRh(R�RX(R�Rh(RiR)(s-finalR,(s-preR)(s-releaseR,(s.releaseR,(s-stableR,(R|RW(RZRW(R�R,(s.finalR,(R[R,N(RfRR7treplaceRSR�RoR1(RtrstorigR�((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_suggest_normalized_version�sH

		
	

s([a-z]+|\d+|[\.-])R)R`tpreviewsfinal-R�Rit@RbcCs�d�}g}x�||�D]�}|jd�r�|dkrgx'|rc|ddkrc|j�q@Wnx'|r�|ddkr�|j�qjWn|j|�qWt|�S(NcSs�g}x�tj|j��D]j}tj||�}|rd|d koUdknrl|jd�}n
d|}|j|�qqW|jd�|S(Nt0it9it*s*final(t
_VERSION_PARTR9R7t_VERSION_REPLACERItzfillR?(RRQR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt	get_partsIs 

R�s*finali����s*final-t00000000(RotpopR?R@(RR�RQR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt_legacy_keyHs	
cBs eZd�Zed��ZRS(cCs
t|�S(N(R�(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRcscCsRt}xE|jD]:}t|t�r|jd�r|dkrt}PqqW|S(NR�s*final(R>RRGRRoR<(RRQRp((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%fs(R	R
RR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRbs	cBs?eZeZeej�Zded<ejd�Z	d�Z
RS(Rts~=s^(\d+(\.\d+)*)cCs�||krtS|jjt|��}|sEtjd||�tS|j�d}d|krz|jdd�d}nt	||�S(NsACannot compute compatible match for version %s  and constraint %siRWi(
R>t
numeric_reR4RntloggertwarningR<R5trsplitRs(RRKRMRFRAR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRtys	
(R	R
RR0tdictR'RHRSRTR�Rt(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyRqs

sN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$cCs
tj|�S(N(t
_SEMVER_RER4(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR��sc
Cs�d�}t|�}|s*t|��n|j�}g|d D]}t|�^qA\}}}||dd�||dd�}}	|||f||	fS(NcSsi|dkr|f}nM|djd�}tg|D]'}|j�rV|jd�n|^q5�}|S(NiRWi(R1R9R@R]R�(RtabsentRQRR*((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
make_tuple�s
:it|iR�(R�RR5RU(
RR�RAR5R�tmajortminortpatchR`tbuild((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt
_semantic_key�s	
,'cBs eZd�Zed��ZRS(cCs
t|�S(N(R�(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�scCs|jdddkS(NiiR�(R(R((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR%�s(R	R
RR&R%(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s	cBseZeZRS((R	R
RR0(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�st
VersionSchemecBs8eZdd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_||_dS(N(R8tmatchert	suggester(RR8R�R�((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s		cCs8y|jj|�t}Wntk
r3t}nX|S(N(R�R0R<RR>(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_version�s


cCs5y|j|�t}Wntk
r0t}nX|S(N(R�R<RR>(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_matcher�s



cCs|jd|�S(s:
        Used for processing some metadata fields
        sdummy_name (%s)(R�(RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytis_valid_constraint_list�scCs+|jdkrd}n|j|�}|S(N(R�R1(RRRQ((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pytsuggest�s	N(R	R
R1RR�R�R�R�(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR��s
			t
normalizedcCs|S(N((RR((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR+�R,tlegacytsemantictdefaultcCs'|tkrtd|��nt|S(Nsunknown scheme name: %r(t_SCHEMESR2(R6((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyR�s()RtloggingRStcompatRt__all__t	getLoggerR	R�R2RtobjectRR'RTR\ReRfRRsRR�R�R�R�R�tIR�R1R�R�RRR�R�R�RRR�R�R(((s?/usr/lib/python2.7/site-packages/pip/_vendor/distlib/version.pyt<module>	s~1k	=$	W	.	r
					#	
	


?>