Edit File: specifiers.cpython-36.opt-1.pyc
3 )�]bym������������������@���s����d�dl�mZmZmZ�d�dlZd�dlZd�dlZd�dlZddlm Z m Z �ddlmZm Z mZ�G�dd��de�ZG�dd ��d e eje��ZG�d d��de�ZG�dd ��d e�Zdd��ZG�dd��de�Zejd�Zdd��Zdd��ZG�dd��de�ZdS�)�����)�absolute_import�division�print_functionN����)�string_types�with_metaclass)�Version� LegacyVersion�parsec���������������@���s���e�Zd�ZdZdS�)�InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)�__name__� __module__�__qualname__�__doc__��r���r���� /usr/lib/python3.6/specifiers.pyr������s���r���c���������������@���s����e�Zd�Zejdd���Zejdd���Zejdd���Zejdd���Zej d d ���Z e jdd ���Z ejdd d��Zejddd��Z dS�)� BaseSpecifierc�������������C���s���dS�)z� Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. Nr���)�selfr���r���r����__str__���s����zBaseSpecifier.__str__c�������������C���s���dS�)zF Returns a hash value for this Specifier like object. Nr���)r���r���r���r����__hash__���s����zBaseSpecifier.__hash__c�������������C���s���dS�)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr���)r����otherr���r���r����__eq__$���s����zBaseSpecifier.__eq__c�������������C���s���dS�)zu Returns a boolean representing whether or not the two Specifier like objects are not equal. Nr���)r���r���r���r���r����__ne__+���s����zBaseSpecifier.__ne__c�������������C���s���dS�)zg Returns whether or not pre-releases as a whole are allowed by this specifier. Nr���)r���r���r���r����prereleases2���s����zBaseSpecifier.prereleasesc�������������C���s���dS�)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr���)r����valuer���r���r���r���9���s����Nc�������������C���s���dS�)zR Determines if the given item is contained within this specifier. Nr���)r����itemr���r���r���r����contains@���s����zBaseSpecifier.containsc�������������C���s���dS�)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����iterabler���r���r���r����filterF���s����zBaseSpecifier.filter)N)N)r���r ���r����abc�abstractmethodr���r���r���r����abstractpropertyr����setterr���r���r���r���r���r���r������s���r���c���������������@���s����e�Zd�Zi�Zd dd�Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z dd��Zedd���Z edd���Zedd���Zejdd���Zdd��Zd!dd�Zd"dd�ZdS�)#�_IndividualSpecifier��Nc�������������C���sF���|�j�j|�}|stdj|���|jd�j��|jd�j��f|�_||�_d�S�)NzInvalid specifier: '{0}'�operator�version)�_regex�searchr����format�group�strip�_spec�_prereleases)r����specr����matchr���r���r����__init__R���s����z_IndividualSpecifier.__init__c�������������C���s0���|�j�d�k rdj|�j�nd}dj|�jjt|��|�S�)Nz, prereleases={0!r}r$���z<{0}({1!r}{2})>)r-���r)���r���� __class__r����str)r����prer���r���r����__repr___���s����z_IndividualSpecifier.__repr__c�������������C���s���dj�|�j��S�)Nz{0}{1})r)���r,���)r���r���r���r���r���l���s����z_IndividualSpecifier.__str__c�������������C���s ���t�|�j�S�)N)�hashr,���)r���r���r���r���r���o���s����z_IndividualSpecifier.__hash__c�������������C���sL���t�|t�r0y|�j|�}W�q@�tk r,���tS�X�nt�||�j�s@tS�|�j|jkS�)N)� isinstancer���r1���r����NotImplementedr,���)r���r���r���r���r���r���r���s���� z_IndividualSpecifier.__eq__c�������������C���sL���t�|t�r0y|�j|�}W�q@�tk r,���tS�X�nt�||�j�s@tS�|�j|jkS�)N)r6���r���r1���r���r7���r,���)r���r���r���r���r���r���}���s���� z_IndividualSpecifier.__ne__c�������������C���s���t�|�dj|�j|���S�)Nz_compare_{0})�getattrr)���� _operators)r����opr���r���r���� _get_operator����s����z"_IndividualSpecifier._get_operatorc�������������C���s���t�|ttf�st|�}|S�)N)r6���r ���r���r ���)r���r&���r���r���r����_coerce_version����s����z$_IndividualSpecifier._coerce_versionc�������������C���s ���|�j�d�S�)Nr���)r,���)r���r���r���r���r%�������s����z_IndividualSpecifier.operatorc�������������C���s ���|�j�d�S�)Nr���)r,���)r���r���r���r���r&�������s����z_IndividualSpecifier.versionc�������������C���s���|�j�S�)N)r-���)r���r���r���r���r�������s����z _IndividualSpecifier.prereleasesc�������������C���s ���||�_�d�S�)N)r-���)r���r���r���r���r���r�������s����c�������������C���s ���|�j�|�S�)N)r���)r���r���r���r���r����__contains__����s����z!_IndividualSpecifier.__contains__c�������������C���s<���|d�kr|�j�}|�j|�}|jr(|�r(dS�|�j|�j�||�j�S�)NF)r���r<���� is_prereleaser;���r%���r&���)r���r���r���r���r���r���r�������s���� z_IndividualSpecifier.containsc�������������c���s����d}g�}d|d�k r|ndi}xL|D�]D}|�j�|�}|�j|f|�r"|jr\|pL|�j�r\|j|��q"d}|V��q"W�|�r�|r�x|D�] }|V��qzW�d�S�)NFr���T)r<���r���r>���r����append)r���r���r���Zyielded�found_prereleases�kwr&����parsed_versionr���r���r���r�������s���� z_IndividualSpecifier.filter)r$���N)N)N)r���r ���r���r9���r0���r4���r���r���r���r���r;���r<����propertyr%���r&���r���r"���r=���r���r���r���r���r���r���r#���N���s ��� r#���c���������������@���sv���e�Zd�ZdZejde�d�ejejB��Zdddddd d �Z dd��Z d d��Zdd��Zdd��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*$�equal� not_equal�less_than_equal�greater_than_equal� less_than�greater_than)z==z!=z<=z>=�<�>c�������������C���s���t�|t�stt|��}|S�)N)r6���r ���r2���)r���r&���r���r���r���r<�������s���� zLegacySpecifier._coerce_versionc�������������C���s���||�j�|�kS�)N)r<���)r����prospectiver.���r���r���r����_compare_equal����s����zLegacySpecifier._compare_equalc�������������C���s���||�j�|�kS�)N)r<���)r���rM���r.���r���r���r����_compare_not_equal����s����z"LegacySpecifier._compare_not_equalc�������������C���s���||�j�|�kS�)N)r<���)r���rM���r.���r���r���r����_compare_less_than_equal����s����z(LegacySpecifier._compare_less_than_equalc�������������C���s���||�j�|�kS�)N)r<���)r���rM���r.���r���r���r����_compare_greater_than_equal���s����z+LegacySpecifier._compare_greater_than_equalc�������������C���s���||�j�|�k�S�)N)r<���)r���rM���r.���r���r���r����_compare_less_than��s����z"LegacySpecifier._compare_less_thanc�������������C���s���||�j�|�kS�)N)r<���)r���rM���r.���r���r���r����_compare_greater_than��s����z%LegacySpecifier._compare_greater_thanN)r���r ���r���� _regex_str�re�compile�VERBOSE� IGNORECASEr'���r9���r<���rN���rO���rP���rQ���rR���rS���r���r���r���r���rD�������s ��� rD���c����������������s���t�j�����fdd��}|S�)Nc����������������s���t�|t�sdS���|�||�S�)NF)r6���r���)r���rM���r.���)�fnr���r����wrapped��s���� z)_require_version_compare.<locals>.wrapped)� functools�wraps)rY���rZ���r���)rY���r����_require_version_compare ��s����r]���c������������ ���@���s����e�Zd�ZdZejde�d�ejejB��Zdddddd d dd�Z e d d���Ze dd���Ze dd���Z e dd���Ze dd���Ze dd���Ze dd���Zdd��Zedd���Zejdd���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 compatiblerE���rF���rG���rH���rI���rJ���Z arbitrary)z~=z==z!=z<=z>=rK���rL���z===c�������������C���sN���dj�ttjdd��t|���d�d���}|d7�}|�jd�||�oL|�jd�||�S�) N�.c�������������S���s���|�j�d��o|�j�d��S�)NZpostZdev)� startswith)�xr���r���r����<lambda>���s���z/Specifier._compare_compatible.<locals>.<lambda>r���z.*z>=z==���)�join�list� itertools� takewhile�_version_splitr;���)r���rM���r.����prefixr���r���r����_compare_compatible���s���� zSpecifier._compare_compatiblec�������������C���sp���|j�d�rPt|j�}t|d�d���}tt|��}|d�t|���}t||�\}}nt|�}|jsht|j�}||kS�)Nz.*�������)�endswithr���Zpublicrh���r2����len�_pad_version�local)r���rM���r.���r���r���r���rN������s���� zSpecifier._compare_equalc�������������C���s���|�j�||��S�)N)rN���)r���rM���r.���r���r���r���rO������s����zSpecifier._compare_not_equalc�������������C���s���|t�|�kS�)N)r���)r���rM���r.���r���r���r���rP������s����z"Specifier._compare_less_than_equalc�������������C���s���|t�|�kS�)N)r���)r���rM���r.���r���r���r���rQ������s����z%Specifier._compare_greater_than_equalc�������������C���s>���t�|�}||k�sdS�|j�r:|jr:t�|j�t�|j�kr:dS�dS�)NFT)r���r>����base_version)r���rM���r.���r���r���r���rR������s����zSpecifier._compare_less_thanc�������������C���s`���t�|�}||ksdS�|j�r:|jr:t�|j�t�|j�kr:dS�|jd�k r\t�|j�t�|j�kr\dS�dS�)NFT)r���Zis_postreleaserq���rp���)r���rM���r.���r���r���r���rS������s���� zSpecifier._compare_greater_thanc�������������C���s���t�|�j��t�|�j��kS�)N)r2����lower)r���rM���r.���r���r���r����_compare_arbitrary��s����zSpecifier._compare_arbitraryc�������������C���sR���|�j�d�k r|�j�S�|�j\}}|d krN|dkr@|jd�r@|d�d��}t|�jrNdS�d S�)N�==�>=�<=�~=�===z.*rk���TF)rt���ru���rv���rw���rx���rl���)r-���r,���rm���r ���r>���)r���r%���r&���r���r���r���r�����s���� zSpecifier.prereleasesc�������������C���s ���||�_�d�S�)N)r-���)r���r���r���r���r���r�����s����N)r���r ���r���rT���rU���rV���rW���rX���r'���r9���r]���rj���rN���rO���rP���rQ���rR���rS���rs���rC���r���r"���r���r���r���r���r^�����s*���^#r^���z^([0-9]+)((?:a|b|c|rc)[0-9]+)$c�������������C���sD���g�}x:|�j�d�D�],}tj|�}|r2|j|j����q|j|��qW�|S�)Nr_���)�split� _prefix_regexr(����extend�groupsr?���)r&����resultr���r/���r���r���r���rh���'��s���� rh���c���������� ���C���s����g�g��}}|j�ttjdd��|�����|j�ttjdd��|����|j�|�t|d��d�����|j�|t|d��d�����|jddgtdt|d��t|d�������|jddgtdt|d��t|d�������ttj|���ttj|���fS�)Nc�������������S���s���|�j���S�)N)�isdigit)ra���r���r���r���rb���6��s����z_pad_version.<locals>.<lambda>c�������������S���s���|�j���S�)N)r~���)ra���r���r���r���rb���7��s����r���r����0)r?���re���rf���rg���rn����insert�max�chain)�left�rightZ left_splitZright_splitr���r���r���ro���2��s���� &&ro���c���������������@���s����e�Zd�Zddd�Zdd��Zdd��Zd d ��Zdd��Zd d��Zdd��Z dd��Z dd��Zedd���Z e jdd���Z dd��Zddd�Zd dd�ZdS�)!�SpecifierSetr$���Nc�������������C���sr���dd��|j�d�D��}t��}xB|D�]:}y|jt|���W�q �tk rX���|jt|���Y�q X�q W�t|�|�_||�_d�S�)Nc�������������S���s���g�|�]}|j���r|j����qS�r���)r+���)�.0�sr���r���r���� <listcomp>R��s����z)SpecifierSet.__init__.<locals>.<listcomp>�,) ry����set�addr^���r���rD���� frozenset�_specsr-���)r���Z specifiersr���Zparsed� specifierr���r���r���r0���O��s���� zSpecifierSet.__init__c�������������C���s*���|�j�d�k rdj|�j�nd}djt|��|�S�)Nz, prereleases={0!r}r$���z<SpecifierSet({0!r}{1})>)r-���r)���r���r2���)r���r3���r���r���r���r4���d��s����zSpecifierSet.__repr__c�������������C���s���dj�tdd��|�jD����S�)Nr����c�������������s���s���|�]}t�|�V��qd�S�)N)r2���)r����r����r���r���r���� <genexpr>n��s����z'SpecifierSet.__str__.<locals>.<genexpr>)rd����sortedr����)r���r���r���r���r���m��s����zSpecifierSet.__str__c�������������C���s ���t�|�j�S�)N)r5���r����)r���r���r���r���r���p��s����zSpecifierSet.__hash__c�������������C���s����t�|t�rt|�}nt�|t�s"tS�t��}t|�j|jB��|_|�jd�krX|jd�k rX|j|_n<|�jd�k rv|jd�krv|�j|_n|�j|jkr�|�j|_ntd��|S�)NzFCannot combine SpecifierSets with True and False prerelease overrides.)r6���r���r����r7���r����r����r-���� ValueError)r���r���r����r���r���r����__and__s��s���� zSpecifierSet.__and__c�������������C���sF���t�|t�rt|�}n&t�|t�r,tt|��}nt�|t�s:tS�|�j|jkS�)N)r6���r���r����r#���r2���r7���r����)r���r���r���r���r���r������s���� zSpecifierSet.__eq__c�������������C���sF���t�|t�rt|�}n&t�|t�r,tt|��}nt�|t�s:tS�|�j|jkS�)N)r6���r���r����r#���r2���r7���r����)r���r���r���r���r���r������s���� zSpecifierSet.__ne__c�������������C���s ���t�|�j�S�)N)rn���r����)r���r���r���r����__len__���s����zSpecifierSet.__len__c�������������C���s ���t�|�j�S�)N)�iterr����)r���r���r���r����__iter__���s����zSpecifierSet.__iter__c�������������C���s.���|�j�d�k r|�j�S�|�jsd�S�tdd��|�jD���S�)Nc�������������s���s���|�]}|j�V��qd�S�)N)r���)r����r����r���r���r���r�������s����z+SpecifierSet.prereleases.<locals>.<genexpr>)r-���r�����any)r���r���r���r���r������s ���� zSpecifierSet.prereleasesc�������������C���s ���||�_�d�S�)N)r-���)r���r���r���r���r���r������s����c�������������C���s ���|�j�|�S�)N)r���)r���r���r���r���r���r=������s����zSpecifierSet.__contains__c����������������sN���t���ttf�st������d�kr$|�j���r4��jr4dS�t���fdd�|�jD���S�)NFc�������������3���s���|�]}|j����d��V��qdS�))r���N)r���)r����r����)r���r���r���r���r�������s���z(SpecifierSet.contains.<locals>.<genexpr>)r6���r ���r���r ���r���r>����allr����)r���r���r���r���)r���r���r���r������s����zSpecifierSet.containsc�������������C���s����|d�kr|�j�}|�jr:x |�jD�]}|j|t|�d�}qW�|S�g�}g�}xZ|D�]R}t|ttf�sdt|�}n|}t|t�rtqH|jr�|�r�|s�|j |��qH|j |��qHW�|�r�|r�|d�kr�|S�|S�d�S�)N)r���) r���r����r����boolr6���r ���r���r ���r>���r?���)r���r���r���r.���Zfilteredr@���r���rB���r���r���r���r������s*���� zSpecifierSet.filter)r$���N)N)N)r���r ���r���r0���r4���r���r���r����r���r���r����r����rC���r���r"���r=���r���r���r���r���r���r���r����M��s��� r����)Z __future__r���r���r���r���r[���rf���rU���Z_compatr���r���r&���r���r ���r ���r����r����ABCMeta�objectr���r#���rD���r]���r^���rV���rz���rh���ro���r����r���r���r���r����<module>���s&���9� 4 ��