AlkantarClanX12

Your IP : 3.136.22.204


Current Path : /opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/version.cpython-37.pyc

B

:��a�[�@sfdZddlZddlZddlmZddlmZdddd	d
ddd
gZe�e	�Z
Gdd�de�ZGdd�de
�ZGdd�de
�Ze�d�Zdd�ZeZGdd�de�Zdd�ZGdd�de�Ze�d�dfe�d�dfe�d�dfe�d�d fe�d!�d"fe�d#�d"fe�d$�d%fe�d&�d'fe�d(�d)fe�d*�d+ff
Ze�d,�dfe�d-�dfe�d.�d%fe�d$�d%fe�d/�dffZe�d0�Zd1d2�Zd3d4�Ze�d5ej�Zd6d6d7d6d8ddd9�Zd:d;�ZGd<d�de�Z Gd=d	�d	e�Z!e�d>ej�Z"d?d@�Z#dAdB�Z$GdCd
�d
e�Z%GdDd�de�Z&GdEdF�dFe
�Z'e'eee�e'ee!dGdH��e'e$e&e�dI�Z(e(dJe(dK<dLd
�Z)dS)Mz~
Implementation of a flexible versioning scheme providing support for PEP-440,
setuptools-compatible and semantic versioning.
�N�)�string_types)�parse_requirement�NormalizedVersion�NormalizedMatcher�
LegacyVersion�
LegacyMatcher�SemanticVersion�SemanticMatcher�UnsupportedVersionError�
get_schemec@seZdZdZdS)rzThis is an unsupported version.N)�__name__�
__module__�__qualname__�__doc__�rr�@/opt/alt/python37/lib/python3.7/site-packages/distlib/version.pyrsc@sxeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��ZdS)�VersioncCs@|��|_}|�|�|_}t|t�s,t�t|�dks<t�dS)Nr)�strip�_string�parse�_parts�
isinstance�tuple�AssertionError�len)�self�s�partsrrr�__init__szVersion.__init__cCstd��dS)Nzplease implement in a subclass)�NotImplementedError)rrrrrr%sz
Version.parsecCs$t|�t|�kr td||f��dS)Nzcannot compare %r and %r)�type�	TypeError)r�otherrrr�_check_compatible(szVersion._check_compatiblecCs|�|�|j|jkS)N)r$r)rr#rrr�__eq__,s
zVersion.__eq__cCs|�|�S)N)r%)rr#rrr�__ne__0szVersion.__ne__cCs|�|�|j|jkS)N)r$r)rr#rrr�__lt__3s
zVersion.__lt__cCs|�|�p|�|�S)N)r'r%)rr#rrr�__gt__7szVersion.__gt__cCs|�|�p|�|�S)N)r'r%)rr#rrr�__le__:szVersion.__le__cCs|�|�p|�|�S)N)r(r%)rr#rrr�__ge__=szVersion.__ge__cCs
t|j�S)N)�hashr)rrrr�__hash__AszVersion.__hash__cCsd|jj|jfS)Nz%s('%s'))�	__class__r
r)rrrr�__repr__DszVersion.__repr__cCs|jS)N)r)rrrr�__str__GszVersion.__str__cCstd��dS)NzPlease implement in subclasses.)r )rrrr�
is_prereleaseJszVersion.is_prereleaseN)r
rrrrr$r%r&r'r(r)r*r,r.r/�propertyr0rrrrrsrc	@s�eZdZdZdd�dd�dd�dd�dd�dd�d	d�d
d�d�Zdd
�Zdd�Zdd�Zedd��Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS) �MatcherNcCs||kS)Nr)�v�c�prrr�<lambda>T�zMatcher.<lambda>cCs||kS)Nr)r3r4r5rrrr6Ur7cCs||kp||kS)Nr)r3r4r5rrrr6Vr7cCs||kp||kS)Nr)r3r4r5rrrr6Wr7cCs||kS)Nr)r3r4r5rrrr6Xr7cCs||kS)Nr)r3r4r5rrrr6Yr7cCs||kp||kS)Nr)r3r4r5rrrr6[r7cCs||kS)Nr)r3r4r5rrrr6\r7)�<�>z<=z>=z==z===z~=z!=cCst|�S)N)r)rrrrrraszMatcher.parse_requirementcCs�|jdkrtd��|��|_}|�|�}|s:td|��|j|_|j��|_g}|jr�xn|jD]d\}}|�	d�r�|dkr�td|��|dd�d}}|�|�n|�|�d}}|�
|||f�q`Wt|�|_dS)	NzPlease specify a version classz
Not valid: %rz.*)z==z!=z#'.*' not allowed for %r constraints���TF)
�
version_class�
ValueErrorrrr�name�lower�keyZconstraints�endswith�appendrr)rr�rZclist�opZvn�prefixrrrrds(


zMatcher.__init__cCszt|t�r|�|�}x`|jD]V\}}}|j�|�}t|t�rFt||�}|sbd||jjf}t	|��||||�sdSqWdS)z�
        Check if the provided version matches the constraints.

        :param version: The version to match against this instance.
        :type version: String or :class:`Version` instance.
        z%r not implemented for %sFT)
rrr;r�
_operators�get�getattrr-r
r )r�version�operator�
constraintrD�f�msgrrr�match�s



z
Matcher.matchcCs6d}t|j�dkr2|jdddkr2|jdd}|S)Nrr)z==z===)rr)r�resultrrr�
exact_version�s zMatcher.exact_versioncCs0t|�t|�ks|j|jkr,td||f��dS)Nzcannot compare %s and %s)r!r=r")rr#rrrr$�szMatcher._check_compatiblecCs"|�|�|j|jko |j|jkS)N)r$r?r)rr#rrrr%�s
zMatcher.__eq__cCs|�|�S)N)r%)rr#rrrr&�szMatcher.__ne__cCst|j�t|j�S)N)r+r?r)rrrrr,�szMatcher.__hash__cCsd|jj|jfS)Nz%s(%r))r-r
r)rrrrr.�szMatcher.__repr__cCs|jS)N)r)rrrrr/�szMatcher.__str__)r
rrr;rErrrMr1rOr$r%r&r,r.r/rrrrr2Os&r2zk^v?(\d+!)?(\d+(\.\d+)*)((a|b|c|rc)(\d+))?(\.(post)(\d+))?(\.(dev)(\d+))?(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$cCs�|��}t�|�}|s"td|��|��}tdd�|d�d�D��}x(t|�dkrn|ddkrn|dd�}qHW|ds~d}nt|ddd��}|dd	�}|d
d�}|dd
�}|d}|dkr�d}n|dt|d�f}|dkr�d}n|dt|d�f}|dk�rd}n|dt|d�f}|dk�r6d}nLg}	x>|�d�D]0}
|
�	��rbdt|
�f}
nd|
f}
|	�
|
��qFWt|	�}|�s�|�s�|�r�d}nd}|�s�d}|�s�d}||||||fS)NzNot a valid version: %scss|]}t|�VqdS)N)�int)�.0r3rrr�	<genexpr>�sz_pep_440_key.<locals>.<genexpr>r�.���r����	�
��
)NNr)�arT)�z)�_)�final)r�PEP440_VERSION_RErMr�groupsr�splitrrP�isdigitrA)r�mraZnumsZepoch�preZpost�dev�localr�partrrr�_pep_440_key�sT



ric@s6eZdZdZdd�Zedddddg�Zed	d
��ZdS)raIA 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
    cCs<t|�}t�|�}|��}tdd�|d�d�D��|_|S)Ncss|]}t|�VqdS)N)rP)rQr3rrrrRsz*NormalizedVersion.parse.<locals>.<genexpr>rrS)�_normalized_keyr`rMrarrb�_release_clause)rrrNrdrarrrr
s

zNormalizedVersion.parser\�br4�rcrfcst�fdd��jD��S)Nc3s |]}|r|d�jkVqdS)rN)�PREREL_TAGS)rQ�t)rrrrRsz2NormalizedVersion.is_prerelease.<locals>.<genexpr>)�anyr)rr)rrr0szNormalizedVersion.is_prereleaseN)	r
rrrr�setrnr1r0rrrrr�scCs>t|�}t|�}||krdS|�|�s*dSt|�}||dkS)NTFrS)�str�
startswithr)�x�y�nrrr�
_match_prefixs
rwc	@sneZdZeZddddddddd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)r�_match_compatible�	_match_lt�	_match_gt�	_match_le�	_match_ge�	_match_eq�_match_arbitrary�	_match_ne)z~=r8r9z<=z>=z==z===z!=cCsV|rd|ko|jd}n|jdo,|jd}|rN|j�dd�d}|�|�}||fS)N�+rTrr)rrrbr;)rrHrJrDZstrip_localrrrr�
_adjust_local6s
zNormalizedMatcher._adjust_localcCsD|�|||�\}}||krdS|j}d�dd�|D��}t||�S)NFrScSsg|]}t|��qSr)rr)rQ�irrr�
<listcomp>Isz/NormalizedMatcher._match_lt.<locals>.<listcomp>)r�rk�joinrw)rrHrJrD�release_clause�pfxrrrryDszNormalizedMatcher._match_ltcCsD|�|||�\}}||krdS|j}d�dd�|D��}t||�S)NFrScSsg|]}t|��qSr)rr)rQr�rrrr�Qsz/NormalizedMatcher._match_gt.<locals>.<listcomp>)r�rkr�rw)rrHrJrDr�r�rrrrzLszNormalizedMatcher._match_gtcCs|�|||�\}}||kS)N)r�)rrHrJrDrrrr{TszNormalizedMatcher._match_lecCs|�|||�\}}||kS)N)r�)rrHrJrDrrrr|XszNormalizedMatcher._match_gecCs.|�|||�\}}|s ||k}n
t||�}|S)N)r�rw)rrHrJrDrNrrrr}\s


zNormalizedMatcher._match_eqcCst|�t|�kS)N)rr)rrHrJrDrrrr~dsz"NormalizedMatcher._match_arbitrarycCs0|�|||�\}}|s ||k}nt||�}|S)N)r�rw)rrHrJrDrNrrrrgs

zNormalizedMatcher._match_necCsf|�|||�\}}||krdS||kr*dS|j}t|�dkrH|dd�}d�dd�|D��}t||�S)NTFrrTrScSsg|]}t|��qSr)rr)rQr�rrrr�zsz7NormalizedMatcher._match_compatible.<locals>.<listcomp>)r�rkrr�rw)rrHrJrDr�r�rrrrxosz#NormalizedMatcher._match_compatibleN)r
rrrr;rEr�ryrzr{r|r}r~rrxrrrrr's$z[.+-]$�z^[.](\d)z0.\1z^[.-]z
^\((.*)\)$z\1z^v(ersion)?\s*(\d+)z\2z^r(ev)?\s*(\d+)z[.]{2,}rSz\b(alfa|apha)\b�alphaz\b(pre-alpha|prealpha)\bz	pre.alphaz	\(beta\)$�betaz
^[:~._+-]+z
[,*")([\]]z[~:+_ -]z\.$z
(\d+(\.\d+)*)cCsZ|����}xtD]\}}|�||�}qW|s2d}t�|�}|sJd}|}n�|��d�d�}dd�|D�}xt|�dkr�|�	d�qlWt|�dkr�||�
�d�}n8d�dd�|dd�D��||�
�d�}|dd�}d�d	d�|D��}|��}|�rxtD]\}}|�||�}�qW|�s*|}nd
|k�r8dnd}|||}t
|��sVd}|S)
z�
    Try to suggest a semantic form for a version for which
    _suggest_normalized_version couldn't come up with anything.
    z0.0.0rrScSsg|]}t|��qSr)rP)rQr�rrrr��sz-_suggest_semantic_version.<locals>.<listcomp>�NcSsg|]}t|��qSr)rr)rQr�rrrr��scSsg|]}t|��qSr)rr)rQr�rrrr��srf�-r�)rr>�
_REPLACEMENTS�sub�_NUMERIC_PREFIXrMrarbrrA�endr��_SUFFIX_REPLACEMENTS�	is_semver)rrN�pat�replrdrD�suffix�seprrr�_suggest_semantic_version�s:
,
r�cCsjyt|�|Stk
r YnX|��}xdD]\}}|�||�}q0Wt�dd|�}t�dd|�}t�dd|�}t�dd	|�}t�d
d|�}|�d�r�|d
d�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd |�}yt|�Wntk
�rdd}YnX|S)!a�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.
    ))z-alphar\)z-betarl)r�r\)r�rl)rmr4)z-finalr�)z-prer4)z-releaser�)z.releaser�)z-stabler�)r�rS)r^rS)� r�)z.finalr�)r_r�zpre$Zpre0zdev$Zdev0z([abc]|rc)[\-\.](\d+)$z\1\2z[\-\.](dev)[\-\.]?r?(\d+)$z.\1\2z[.~]?([abc])\.?z\1r3rNz\b0+(\d+)(?!\d)z(\d+[abc])$z\g<1>0z\.?(dev-r|dev\.r)\.?(\d+)$z.dev\2z-(a|b|c)(\d+)$z[\.\-](dev|devel)$z.dev0z(?![\.\-])dev$z(final|stable)$r�z\.?(r|-|-r)\.?(\d+)$z.post\2z\.?(dev|git|bzr)\.?(\d+)$z\.?(pre|preview|-c)(\d+)$zc\g<2>zp(\d+)$z.post\1)rjrr>�replace�rer�rs)rZrsZorigr�rrr�_suggest_normalized_version�s>
	
r�z([a-z]+|\d+|[\.-])r4zfinal-�@)reZpreviewr�rmrfr�rScCs~dd�}g}xh||�D]\}|�d�rh|dkrJx|rH|ddkrH|��q.Wx|rf|ddkrf|��qLW|�|�qWt|�S)NcSsxg}xdt�|���D]R}t�||�}|rd|dd�krDdkrTnn|�d�}nd|}|�|�qW|�d�|S)N�0r�9��*z*final)�
_VERSION_PARTrbr>�_VERSION_REPLACErF�zfillrA)rrNr5rrr�	get_partsCs 
z_legacy_key.<locals>.get_partsr�z*finalrTz*final-Z00000000)rs�poprAr)rr�rNr5rrr�_legacy_keyBs

r�c@s eZdZdd�Zedd��ZdS)rcCst|�S)N)r�)rrrrrr]szLegacyVersion.parsecCs:d}x0|jD]&}t|t�r|�d�r|dkrd}PqW|S)NFr�z*finalT)rrrrs)rrNrtrrrr0`szLegacyVersion.is_prereleaseN)r
rrrr1r0rrrrr\sc@s4eZdZeZeej�Zded<e�	d�Z
dd�ZdS)rrxz~=z^(\d+(\.\d+)*)cCs`||krdS|j�t|��}|s2t�d||�dS|��d}d|krV|�dd�d}t||�S)NFzACannot compute compatible match for version %s  and constraint %sTrrSr)�
numeric_rerMrr�logger�warningra�rsplitrw)rrHrJrDrdrrrrrxsszLegacyMatcher._match_compatibleN)r
rrrr;�dictr2rEr��compiler�rxrrrrrks


zN^(\d+)\.(\d+)\.(\d+)(-[a-z0-9]+(\.[a-z0-9-]+)*)?(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$cCs
t�|�S)N)�
_SEMVER_RErM)rrrrr��sr�c	Csndd�}t|�}|st|��|��}dd�|dd�D�\}}}||dd�||dd�}}|||f||fS)	NcSs8|dkr|f}n$|dd��d�}tdd�|D��}|S)NrrScSs"g|]}|��r|�d�n|�qS)r�)rcr�)rQr5rrrr��sz5_semantic_key.<locals>.make_tuple.<locals>.<listcomp>)rbr)rZabsentrNrrrr�
make_tuple�s
z!_semantic_key.<locals>.make_tuplecSsg|]}t|��qSr)rP)rQr�rrrr��sz!_semantic_key.<locals>.<listcomp>r��|�r�)r�rra)	rr�rdra�major�minorZpatchre�buildrrr�
_semantic_key�s
r�c@s eZdZdd�Zedd��ZdS)r	cCst|�S)N)r�)rrrrrr�szSemanticVersion.parsecCs|jdddkS)Nrrr�)r)rrrrr0�szSemanticVersion.is_prereleaseN)r
rrrr1r0rrrrr	�sc@seZdZeZdS)r
N)r
rrr	r;rrrrr
�sc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
VersionSchemeNcCs||_||_||_dS)N)r?�matcher�	suggester)rr?r�r�rrrr�szVersionScheme.__init__cCs2y|j�|�d}Wntk
r,d}YnX|S)NTF)r�r;r)rrrNrrr�is_valid_version�s
zVersionScheme.is_valid_versioncCs0y|�|�d}Wntk
r*d}YnX|S)NTF)r�r)rrrNrrr�is_valid_matcher�s

zVersionScheme.is_valid_matchercCs$|�d�r|dd�}|�d|�S)z:
        Used for processing some metadata fields
        �,NrTzdummy_name (%s))r@r�)rrrrr�is_valid_constraint_list�s
z&VersionScheme.is_valid_constraint_listcCs|jdkrd}n
|�|�}|S)N)r�)rrrNrrr�suggest�s

zVersionScheme.suggest)N)r
rrrr�r�r�r�rrrrr��s

	r�cCs|S)Nr)rrrrrr6�r7r6)�
normalizedZlegacyZsemanticr��defaultcCs|tkrtd|��t|S)Nzunknown scheme name: %r)�_SCHEMESr<)r=rrrr�s)*r�loggingr��compatr�utilr�__all__�	getLoggerr
r�r<r�objectrr2r�r`rirjrrwrr�r�r�r�r��Ir�r�r�rrr�r�r�r	r
r�r�rrrrr�<module>	s|
1d
=$W
.r	'