Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/packaging/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/packaging/__pycache__/specifiers.cpython-35.pyc



N�Xym�@sEddlmZmZmZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
mZGdd�de�ZGdd	�d	e
eje��ZGd
d�de�ZGdd
�d
e�Zdd�ZGdd�de�Zejd�Zdd�Zdd�ZGdd�de�ZdS)�)�absolute_import�division�print_functionN�)�string_types�with_metaclass)�Version�
LegacyVersion�parsec@seZdZdZdS)�InvalidSpecifierzH
    An invalid specifier was found, users should refer to PEP 440.
    N)�__name__�
__module__�__qualname__�__doc__�rr�E/opt/alt/python35/lib/python3.5/site-packages/packaging/specifiers.pyrsrc@s�eZdZejdd��Zejdd��Zejdd��Zejdd��Zej	d	d
��Z
e
jdd
��Z
ejdd
d��Zejddd��Z
dS)�
BaseSpecifiercCsdS)z�
        Returns the str representation of this Specifier like object. This
        should be representative of the Specifier itself.
        Nr)�selfrrr�__str__szBaseSpecifier.__str__cCsdS)zF
        Returns a hash value for this Specifier like object.
        Nr)rrrr�__hash__szBaseSpecifier.__hash__cCsdS)zq
        Returns a boolean representing whether or not the two Specifier like
        objects are equal.
        Nr)r�otherrrr�__eq__$szBaseSpecifier.__eq__cCsdS)zu
        Returns a boolean representing whether or not the two Specifier like
        objects are not equal.
        Nr)rrrrr�__ne__+szBaseSpecifier.__ne__cCsdS)zg
        Returns whether or not pre-releases as a whole are allowed by this
        specifier.
        Nr)rrrr�prereleases2szBaseSpecifier.prereleasescCsdS)zd
        Sets whether or not pre-releases as a whole are allowed by this
        specifier.
        Nr)r�valuerrrr9sNcCsdS)zR
        Determines if the given item is contained within this specifier.
        Nr)r�itemrrrr�contains@szBaseSpecifier.containscCsdS)z�
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        Nr)r�iterablerrrr�filterFszBaseSpecifier.filter)rr
r�abc�abstractmethodrrrr�abstractpropertyr�setterrrrrrrrsrc@s�eZdZiZdddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zedd��Z
edd��Zedd��Zejdd��Zdd�Zddd�Zddd�ZdS) �_IndividualSpecifier�NcCsg|jj|�}|s-tdj|���|jd�j�|jd�j�f|_||_dS)NzInvalid specifier: '{0}'�operator�version)�_regex�searchr�format�group�strip�_spec�_prereleases)r�specr�matchrrr�__init__Rsz_IndividualSpecifier.__init__cCsF|jdk	r!dj|j�nd}dj|jjt|�|�S)Nz, prereleases={0!r}r$z<{0}({1!r}{2})>)r-r)r�	__class__r�str)r�prerrr�__repr___s!		z_IndividualSpecifier.__repr__cCsdj|j�S)Nz{0}{1})r)r,)rrrrrlsz_IndividualSpecifier.__str__cCs
t|j�S)N)�hashr,)rrrrrosz_IndividualSpecifier.__hash__cCsdt|t�r>y|j|�}WqTtk
r:tSYqTXnt||j�sTtS|j|jkS)N)�
isinstancerr1r�NotImplementedr,)rrrrrrrs
z_IndividualSpecifier.__eq__cCsdt|t�r>y|j|�}WqTtk
r:tSYqTXnt||j�sTtS|j|jkS)N)r6rr1rr7r,)rrrrrr}s
z_IndividualSpecifier.__ne__cCst|dj|j|��S)Nz_compare_{0})�getattrr)�
_operators)r�oprrr�
_get_operator�sz"_IndividualSpecifier._get_operatorcCs%t|ttf�s!t|�}|S)N)r6r	rr
)rr&rrr�_coerce_version�sz$_IndividualSpecifier._coerce_versioncCs|jdS)Nr)r,)rrrrr%�sz_IndividualSpecifier.operatorcCs|jdS)Nr)r,)rrrrr&�sz_IndividualSpecifier.versioncCs|jS)N)r-)rrrrr�sz _IndividualSpecifier.prereleasescCs
||_dS)N)r-)rrrrrr�scCs
|j|�S)N)r)rrrrr�__contains__�sz!_IndividualSpecifier.__contains__cCsT|dkr|j}|j|�}|jr8|r8dS|j|j�||j�S)NF)rr<�
is_prereleaser;r%r&)rrrrrrr�s	z_IndividualSpecifier.containsccs�d}g}d|dk	r!|ndi}xc|D][}|j|�}|j||�r1|jr�|pm|jr�|j|�q1d}|Vq1W|r�|r�x|D]}|Vq�WdS)NFrT)r<rr>r�append)rrr�yielded�found_prereleases�kwr&�parsed_versionrrrr�s
		

z_IndividualSpecifier.filter)rr
rr9r0r4rrrrr;r<�propertyr%r&rr"r=rrrrrrr#Ns 

r#c@s�eZdZdZejdedejejB�Zdddddd	d
ddd
ddiZ	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�LegacySpecifiera�
        (?P<operator>(==|!=|<=|>=|<|>))
        \s*
        (?P<version>
            [^,;\s)]* # Since this is a "legacy" specifier, and the version
                      # string can be just about anything, we match everything
                      # except for whitespace, a semi-colon for marker support,
                      # a closing paren since versions can be enclosed in
                      # them, and a comma since it's a version separator.
        )
        z^\s*z\s*$z==�equalz!=�	not_equalz<=�less_than_equalz>=�greater_than_equal�<�	less_than�>�greater_thancCs%t|t�s!tt|��}|S)N)r6r	r2)rr&rrrr<�szLegacySpecifier._coerce_versioncCs||j|�kS)N)r<)r�prospectiver.rrr�_compare_equal�szLegacySpecifier._compare_equalcCs||j|�kS)N)r<)rrNr.rrr�_compare_not_equal�sz"LegacySpecifier._compare_not_equalcCs||j|�kS)N)r<)rrNr.rrr�_compare_less_than_equal�sz(LegacySpecifier._compare_less_than_equalcCs||j|�kS)N)r<)rrNr.rrr�_compare_greater_than_equalsz+LegacySpecifier._compare_greater_than_equalcCs||j|�kS)N)r<)rrNr.rrr�_compare_less_thansz"LegacySpecifier._compare_less_thancCs||j|�kS)N)r<)rrNr.rrr�_compare_greater_thansz%LegacySpecifier._compare_greater_thanN)rr
r�
_regex_str�re�compile�VERBOSE�
IGNORECASEr'r9r<rOrPrQrRrSrTrrrrrE�s 
rEcs%tj���fdd��}|S)Ncs#t|t�sdS�|||�S)NF)r6r)rrNr.)�fnrr�wrappedsz)_require_version_compare.<locals>.wrapped)�	functools�wraps)rZr[r)rZr�_require_version_compare
s!r^c@s!eZdZdZejdedejejB�Zdddddd	d
ddd
ddddddiZ	e
dd��Ze
dd��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��Ze
d d!��Zd"d#�Zed$d%��Zejd&d%��Zd'S)(�	Specifiera
        (?P<operator>(~=|==|!=|<=|>=|<|>|===))
        (?P<version>
            (?:
                # The identity operators allow for an escape hatch that will
                # do an exact string match of the version you wish to install.
                # This will not be parsed by PEP 440 and we cannot determine
                # any semantic meaning from it. This operator is discouraged
                # but included entirely as an escape hatch.
                (?<====)  # Only match for the identity operator
                \s*
                [^\s]*    # We just match everything, except for whitespace
                          # since we are only testing for strict identity.
            )
            |
            (?:
                # The (non)equality operators allow for wild card and local
                # versions to be specified so we have to define these two
                # operators separately to enable that.
                (?<===|!=)            # Only match for equals and not equals

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?:                   # pre release
                    [-_\.]?
                    (a|b|c|rc|alpha|beta|pre|preview)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?

                # You cannot use a wild card and a dev or local version
                # together so group them with a | and make them optional.
                (?:
                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
                    |
                    \.\*  # Wild card syntax of .*
                )?
            )
            |
            (?:
                # The compatible operator requires at least two digits in the
                # release segment.
                (?<=~=)               # Only match for the compatible operator

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
                (?:                   # pre release
                    [-_\.]?
                    (a|b|c|rc|alpha|beta|pre|preview)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
            |
            (?:
                # All other operators only allow a sub set of what the
                # (non)equality operators do. Specifically they do not allow
                # local versions to be specified nor do they allow the prefix
                # matching wild cards.
                (?<!==|!=|~=)         # We have special cases for these
                                      # operators so we want to make sure they
                                      # don't match here.

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?:                   # pre release
                    [-_\.]?
                    (a|b|c|rc|alpha|beta|pre|preview)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
        )
        z^\s*z\s*$z~=�
compatiblez==rFz!=rGz<=rHz>=rIrJrKrLrMz===�	arbitrarycCsodjttjdd�t|���dd��}|d7}|jd�||�on|jd�||�S)	N�.cSs|jd�o|jd�S)N�post�dev)�
startswith)�xrrr�<lambda>�sz/Specifier._compare_compatible.<locals>.<lambda>rz.*z>=z==���)�join�list�	itertools�	takewhile�_version_splitr;)rrNr.�prefixrrr�_compare_compatible�s	

zSpecifier._compare_compatiblecCs�|jd�rtt|j�}t|dd��}tt|��}|dt|��}t||�\}}n$t|�}|js�t|j�}||kS)Nz.*����)�endswithr�publicrmr2�len�_pad_version�local)rrNr.rrrrO�s	zSpecifier._compare_equalcCs|j||�S)N)rO)rrNr.rrrrP�szSpecifier._compare_not_equalcCs|t|�kS)N)r)rrNr.rrrrQ�sz"Specifier._compare_less_than_equalcCs|t|�kS)N)r)rrNr.rrrrR�sz%Specifier._compare_greater_than_equalcCsUt|�}||ksdS|jrQ|jrQt|j�t|j�krQdSdS)NFT)rr>�base_version)rrNr.rrrrS�szSpecifier._compare_less_thancCs�t|�}||ksdS|jrQ|jrQt|j�t|j�krQdS|jdk	r�t|j�t|j�kr�dSdS)NFT)r�is_postreleaserwrv)rrNr.rrrrT�szSpecifier._compare_greater_thancCs"t|�j�t|�j�kS)N)r2�lower)rrNr.rrr�_compare_arbitraryszSpecifier._compare_arbitrarycCss|jdk	r|jS|j\}}|d
kro|dkr\|jd�r\|dd�}t|�jrodSd	S)N�==�>=�<=�~=�===z.*rpTF)r{r|r}r~rrq)r-r,rrr
r>)rr%r&rrrrszSpecifier.prereleasescCs
||_dS)N)r-)rrrrrrsN)rr
rrUrVrWrXrYr'r9r^rorOrPrQrRrSrTrzrDrr"rrrrr_s*^#r_z^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCs\g}xO|jd�D]>}tj|�}|rG|j|j��q|j|�qW|S)Nrb)�split�
_prefix_regexr(�extend�groupsr?)r&�resultrr/rrrrm'srmc	Cs1gg}}|jttjdd�|���|jttjdd�|���|j|t|d�d��|j|t|d�d��|jddgtdt|d�t|d���|jddgtdt|d�t|d���ttj|��ttj|��fS)NcSs
|j�S)N)�isdigit)rfrrrrg6sz_pad_version.<locals>.<lambda>cSs
|j�S)N)r�)rfrrrrg7srr�0)r?rjrkrlrt�insert�max�chain)�left�right�
left_split�right_splitrrrru2s
%%!!//ruc@s�eZdZdddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zedd��Z
e
jdd��Z
dd�Zddd�Zddd�ZdS)�SpecifierSetr$NcCs�dd�|jd�D�}t�}xM|D]E}y|jt|��Wq,tk
rp|jt|��Yq,Xq,Wt|�|_||_dS)NcSs(g|]}|j�r|j��qSr)r+)�.0�srrr�
<listcomp>Rs	z)SpecifierSet.__init__.<locals>.<listcomp>�,)	r��set�addr_rrE�	frozenset�_specsr-)r�
specifiersr�parsed�	specifierrrrr0Os	

zSpecifierSet.__init__cCs=|jdk	r!dj|j�nd}djt|�|�S)Nz, prereleases={0!r}r$z<SpecifierSet({0!r}{1})>)r-r)rr2)rr3rrrr4ds!zSpecifierSet.__repr__cCs#djtdd�|jD���S)Nr�css|]}t|�VqdS)N)r2)r�r�rrr�	<genexpr>nsz'SpecifierSet.__str__.<locals>.<genexpr>)ri�sortedr�)rrrrrmszSpecifierSet.__str__cCs
t|j�S)N)r5r�)rrrrrpszSpecifierSet.__hash__cCs�t|t�rt|�}nt|t�s1tSt�}t|j|jB�|_|jdkr�|jdk	r�|j|_nZ|jdk	r�|jdkr�|j|_n-|j|jkr�|j|_ntd��|S)NzFCannot combine SpecifierSets with True and False prerelease overrides.)r6rr�r7r�r�r-�
ValueError)rrr�rrr�__and__ss		zSpecifierSet.__and__cCset|t�rt|�}n7t|t�rBtt|��}nt|t�sUtS|j|jkS)N)r6rr�r#r2r7r�)rrrrrr�szSpecifierSet.__eq__cCset|t�rt|�}n7t|t�rBtt|��}nt|t�sUtS|j|jkS)N)r6rr�r#r2r7r�)rrrrrr�szSpecifierSet.__ne__cCs
t|j�S)N)rtr�)rrrr�__len__�szSpecifierSet.__len__cCs
t|j�S)N)�iterr�)rrrr�__iter__�szSpecifierSet.__iter__cCs=|jdk	r|jS|js#dStdd�|jD��S)Ncss|]}|jVqdS)N)r)r�r�rrrr��sz+SpecifierSet.prereleases.<locals>.<genexpr>)r-r��any)rrrrr�s
	zSpecifierSet.prereleasescCs
||_dS)N)r-)rrrrrr�scCs
|j|�S)N)r)rrrrrr=�szSpecifierSet.__contains__csmt�ttf�s!t����dkr6|j��rJ�jrJdSt��fdd�|jD��S)NFc3s$|]}|j�d��VqdS)rN)r)r�r�)rrrrr��sz(SpecifierSet.contains.<locals>.<genexpr>)r6r	rr
rr>�allr�)rrrr)rrrr�s	zSpecifierSet.containscCs|dkr|j}|jrQx,|jD]!}|j|dt|��}q(W|Sg}g}x}|D]u}t|ttf�s�t|�}n|}t|t�r�qd|jr�|r�|s�|j	|�qd|j	|�qdW|r�|r�|dkr�|S|SdS)Nr)
rr�r�boolr6r	rr
r>r?)rrrr.�filteredrArrCrrrr�s*		
zSpecifierSet.filter)rr
rr0r4rrr�rrr�r�rDrr"r=rrrrrrr�Ms	

r�)�
__future__rrrrr\rkrV�_compatrrr&rr	r
r�r�ABCMeta�objectrr#rEr^r_rWr�rmrur�rrrr�<module>s""9�4	�