관리-도구
편집 파일: specifiers.cpython-39.pyc
a ����[��f�x����������������������@���s���d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlmZmZmZm Z m Z mZmZm Z mZmZmZ�ddlmZ�ddlmZmZmZ�eeef�Zeeeef�Zeded�Zeeegef�ZG�dd ��d e�ZG�d d��de�jd�Z G�d d��de �Z!G�dd��de!�Z"edeegef�edeegef�d�dd�Z#G�dd��de!�Z$e�%d�Z&ee e�d�dd�Z'eed�dd�Z(e e�e e�ee e�e e�f�d�dd�Z)G�d d!��d!e �Z*dS�)"�����N)�Callable�Dict�Iterable�Iterator�List�Optional�Pattern�Set�Tuple�TypeVar�Union����)�canonicalize_version)� LegacyVersion�Version�parse�VersionTypeVar)�boundc�������������������@���s���e�Zd�ZdZdS�)�InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)�__name__� __module__�__qualname__�__doc__��r���r����D/usr/lib/python3.9/site-packages/pip/_vendor/packaging/specifiers.pyr���!���s���r���c�������������������@���s����e�Zd�Zejed�dd��Zejed�dd��Zeje e d�dd��Zeje e d�d d ��Zej ee �d�dd��Zeje d d�dd��Zejdeee �e d�dd��Zejdee�ee �ee�d�dd��Zd S�)� BaseSpecifier��returnc�����������������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__��otherr���c�����������������C���s���dS�)zq Returns a boolean representing whether or not the two Specifier like objects are equal. Nr����r���r#���r���r���r����__eq__5���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����__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����prereleasesC���s����zBaseSpecifier.prereleasesN��valuer���c�����������������C���s���dS�)zd Sets whether or not pre-releases as a whole are allowed by this specifier. Nr����r���r)���r���r���r���r'���J���s������itemr'���r���c�����������������C���s���dS�)zR Determines if the given item is contained within this specifier. Nr����r���r,���r'���r���r���r����containsQ���s����zBaseSpecifier.contains��iterabler'���r���c�����������������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���r0���r'���r���r���r����filterW���s����zBaseSpecifier.filter)N)N)r���r���r����abc�abstractmethod�strr ����intr!����object�boolr%���r&����abstractpropertyr���r'����setterr.���r���r���r1���r���r���r���r���r���'���s(������r���)� metaclassc�������������������@���sb��e�Zd�ZU�i�Zeeef�ed<�ee�ed<�d-eee �dd�dd�Z ed�d d �Zed�dd�Ze eeef�d�d d��Zed�dd�Zee d�dd�Zee d�dd�Zeed�dd�Zeed�dd�Ze ed�dd��Ze ed�dd��Ze ee �d�d d!��Zeje dd"�d#d!��Zee d$�d%d&�Zd.eee �e d'�d(d)�Zd/e e!�ee �e e!�d*�d+d,�Z"dS�)0�_IndividualSpecifier� _operators�_regex��N��specr'���r���c�����������������C���sH���|�j��|�}|s td|��d���|�d����|�d����f|�_||�_d�S�)NzInvalid specifier: '�'�operator�version)r=����searchr����group�strip�_spec�_prereleases)r���r@���r'����matchr���r���r����__init__f���s�����z_IndividualSpecifier.__init__r���c�����������������C���s0���|�j�d�urd|�j��nd}d�|�jjt|��|�S�)N�, prereleases=r>���z<{}({!r}{})>)rH���r'����format� __class__r���r4����r���Zprer���r���r����__repr__s���s ������z_IndividualSpecifier.__repr__c�����������������C���s���dj�|�j��S�)Nz{}{})rL���rG���r���r���r���r���r ���|���s����z_IndividualSpecifier.__str__c�����������������C���s���|�j�d�t|�j�d��fS�)Nr���r ���)rG���r���r���r���r���r����_canonical_spec���s����z$_IndividualSpecifier._canonical_specc�����������������C���s ���t�|�j�S��N)�hashrP���r���r���r���r���r!�������s����z_IndividualSpecifier.__hash__r"���c�����������������C���sR���t�|t�r6z|��t|��}W�qF�ty2���t�Y�S�0�nt�||�j�sFtS�|�j|jkS�rQ���)� isinstancer4���rM���r����NotImplementedrP���r$���r���r���r���r%�������s���� z_IndividualSpecifier.__eq__c�����������������C���sR���t�|t�r6z|��t|��}W�qF�ty2���t�Y�S�0�nt�||�j�sFtS�|�j|jkS�rQ���)rS���r4���rM���r���rT���rG���r$���r���r���r���r&�������s���� z_IndividualSpecifier.__ne__)�opr���c�����������������C���s���t�|�d|�j|�����}|S�)NZ _compare_)�getattrr<���)r���rU����operator_callabler���r���r���� _get_operator����s�����z"_IndividualSpecifier._get_operator�rC���r���c�����������������C���s���t�|ttf�st|�}|S�rQ���)rS���r���r���r����r���rC���r���r���r����_coerce_version����s����z$_IndividualSpecifier._coerce_versionc�����������������C���s ���|�j�d�S�)Nr����rG���r���r���r���r���rB�������s����z_IndividualSpecifier.operatorc�����������������C���s ���|�j�d�S�)Nr ���r\���r���r���r���r���rC�������s����z_IndividualSpecifier.versionc�����������������C���s���|�j�S�rQ����rH���r���r���r���r���r'�������s����z _IndividualSpecifier.prereleasesr(���c�����������������C���s ���||�_�d�S�rQ���r]���r*���r���r���r���r'�������s�����r,���r���c�����������������C���s ���|���|�S�rQ����r.����r���r,���r���r���r����__contains__����s����z!_IndividualSpecifier.__contains__r+���c�����������������C���s>���|d�u�r|�j�}|��|�}|jr&|s&dS�|��|�j�}|||�j�S��NF)r'���r[���� is_prereleaserX���rB���rC���)r���r,���r'���Znormalized_itemrW���r���r���r���r.�������s���� z_IndividualSpecifier.containsr/���c�����������������c���s����d}g�}d|d�ur|ndi}|D�]F}|���|�}|�j|fi�|��r |jr\|s\|�js\|�|��q d}|V��q |s�|r�|D�] }|V��qtd�S�)NFr'���T)r[���r.���rc���r'����append)r���r0���r'����yielded�found_prereleases�kwrC����parsed_versionr���r���r���r1�������s"���� ��z_IndividualSpecifier.filter)r>���N)N)N)#r���r���r���r<���r���r4����__annotations__r���r���r7���rJ���rO���r ����propertyr ���rP���r5���r!���r6���r%���r&����CallableOperatorrX����UnparsedVersion� ParsedVersionr[���rB���rC���r'���r9���ra���r.���r���r���r1���r���r���r���r���r;���a���s>��� ������r;���c�����������������������s����e�Zd�ZdZe�de�d�ejejB��Zdddddd d �Z d e ee�dd ���fdd� Z eed�dd�Zee ed�dd�Zee ed�dd�Zee ed�dd�Zee ed�dd�Zee ed�dd�Zee ed�dd�Z���ZS�)!�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. ) �^\s*�\s*$�equal� not_equal�less_than_equal�greater_than_equal� less_than�greater_than)�==�!=�<=�>=�<�>r>���Nr?���c��������������������s���t����||��t�dt��d�S�)NzZCreating a LegacyVersion has been deprecated and will be removed in the next major release)�superrJ����warnings�warn�DeprecationWarning)r���r@���r'����rM���r���r���rJ�����s �����zLegacySpecifier.__init__rY���c�����������������C���s���t�|t�stt|��}|S�rQ���)rS���r���r4���rZ���r���r���r���r[�����s���� zLegacySpecifier._coerce_version��prospectiver@���r���c�����������������C���s���||���|�kS�rQ����r[����r���r����r@���r���r���r����_compare_equal��s����zLegacySpecifier._compare_equalc�����������������C���s���||���|�kS�rQ���r����r����r���r���r����_compare_not_equal��s����z"LegacySpecifier._compare_not_equalc�����������������C���s���||���|�kS�rQ���r����r����r���r���r����_compare_less_than_equal"��s����z(LegacySpecifier._compare_less_than_equalc�����������������C���s���||���|�kS�rQ���r����r����r���r���r����_compare_greater_than_equal%��s����z+LegacySpecifier._compare_greater_than_equalc�����������������C���s���||���|�k�S�rQ���r����r����r���r���r����_compare_less_than*��s����z"LegacySpecifier._compare_less_thanc�����������������C���s���||���|�kS�rQ���r����r����r���r���r����_compare_greater_than-��s����z%LegacySpecifier._compare_greater_than)r>���N)r���r���r���� _regex_str�re�compile�VERBOSE� IGNORECASEr=���r<���r4���r���r7���rJ���rl���r���r[���r����r����r����r����r����r����� __classcell__r���r���r����r���rn�������s&���� �rn���� Specifier)�fnr���c��������������������s&���t�����dtttd���fdd��}|S�)Nr����)r���r����r@���r���c��������������������s���t�|t�sdS���|�||�S�rb���)rS���r���r�����r����r���r����wrapped4��s���� z)_require_version_compare.<locals>.wrapped)� functools�wrapsrm���r4���r7���)r����r����r���r����r����_require_version_compare1��s����r����c���������������� ���@���s��e�Zd�ZdZe�de�d�ejejB��Zdddddd d dd�Z e eee d �dd��Ze eee d �dd��Ze eee d �dd��Ze eee d �dd��Ze eee d �dd��Ze eee d�dd��Ze eee d�dd��Zeee d �dd�Zee d�d d!��Zeje d"d#�d$d!��Zd"S�)%r����a�� (?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 ) ) ro���rp���Z compatiblerq���rr���rs���rt���ru���rv���Z arbitrary)�~=rw���rx���ry���rz���r{���r|����===r����c�����������������C���sJ���d��tt�tt|���d�d���}|d7�}|��d�||�oH|��d�||�S�)N�.����.*rz���rw���)�join�list� itertools� takewhile�_is_not_suffix�_version_splitrX���)r���r����r@����prefixr���r���r����_compare_compatible���s������zSpecifier._compare_compatiblec����������� ������C���sz���|��d�rVt|j�}t|d�d���}tt|��}|d�t|���}t||�\}}||kS�t|�}|jsnt|j�}||kS�d�S�)Nr�������)�endswithr����publicr����r4����len�_pad_version�local) r���r����r@���Z split_specZsplit_prospectiveZshortened_prospectiveZpadded_specZpadded_prospectiveZspec_versionr���r���r���r�������s���� � zSpecifier._compare_equalc�����������������C���s���|���||��S�rQ���)r����r����r���r���r���r�������s����zSpecifier._compare_not_equalc�����������������C���s���t�|j�t�|�kS�rQ����r���r����r����r���r���r���r�������s����z"Specifier._compare_less_than_equalc�����������������C���s���t�|j�t�|�kS�rQ���r����r����r���r���r���r�������s����z%Specifier._compare_greater_than_equal)r�����spec_strr���c�����������������C���s<���t�|�}||k�sdS�|js8|jr8t�|j�t�|j�kr8dS�dS��NFT)r���rc����base_version�r���r����r����r@���r���r���r���r�������s����zSpecifier._compare_less_thanc�����������������C���s^���t�|�}||ksdS�|js8|jr8t�|j�t�|j�kr8dS�|jd�urZt�|j�t�|j�krZdS�dS�r����)r���Zis_postreleaser����r����r����r���r���r���r������s���� zSpecifier._compare_greater_thanc�����������������C���s���t�|����t�|����kS�rQ���)r4����lowerr����r���r���r����_compare_arbitrary7��s����zSpecifier._compare_arbitraryr���c�����������������C���sR���|�j�d�ur|�j�S�|�j\}}|dv�rN|dkr@|�d�r@|d�d��}t|�jrNdS�dS�)N)rw���rz���ry���r����r����rw���r����r����TF)rH���rG���r����r���rc���)r���rB���rC���r���r���r���r'���:��s���� zSpecifier.prereleasesNr(���c�����������������C���s ���||�_�d�S�rQ���r]���r*���r���r���r���r'���S��s����)r���r���r���r����r����r����r����r����r=���r<���r����rm���r4���r7���r����r����r����r����r����r����r����r���r����rj���r'���r9���r���r���r���r���r����=��s@���]�'� z^([0-9]+)((?:a|b|c|rc)[0-9]+)$rY���c�����������������C���s@���g�}|���d�D�],}t�|�}|r0|�|�����q|�|��q|S�)Nr����)�split� _prefix_regexrD����extend�groupsrd���)rC����resultr,���rI���r���r���r���r����[��s���� r����)�segmentr���c��������������������s���t���fdd�dD����S�)Nc�����������������3���s���|�]}����|�V��qd�S�rQ���)� startswith)�.0r�����r����r���r���� <genexpr>g��s���z!_is_not_suffix.<locals>.<genexpr>)�dev�a�b�rcZpost)�anyr����r���r����r���r����f��s�����r����)�left�rightr���c�������������� ���C���s����g�g��}}|��tt�dd��|�����|��tt�dd��|����|��|�t|d��d�����|��|t|d��d�����|�ddgtdt|d��t|d�������|�ddgtdt|d��t|d�������ttj|���ttj|���fS�)Nc�����������������S���s���|�����S�rQ�����isdigit��xr���r���r����<lambda>p�������z_pad_version.<locals>.<lambda>c�����������������S���s���|�����S�rQ���r����r����r���r���r���r����q��r����r���r ����0)rd���r����r����r����r�����insert�max�chain)r����r����Z left_splitZright_splitr���r���r���r����l��s���� ,,r����c�������������������@���s��e�Zd�Zd%eee�dd�dd�Zed�dd�Zed�d d �Ze d�dd�Z ed�ef�d�d �dd�Ze ed �dd�Ze ed �dd�Ze d�dd�Zee�d�dd�Zeee�d�dd��Zejedd�dd��Zeed�dd�Zd&eee�ed�d d!�Zd'ee�ee�ee�d"�d#d$�ZdS�)(�SpecifierSetr>���N)� specifiersr'���r���c�������������� ���C���sl���dd��|��d�D��}t��}|D�]8}z|�t|���W�q�tyT���|�t|���Y�q0�qt|�|�_||�_d�S�)Nc�����������������S���s���g�|�]}|����r|�����qS�r���)rF����r�����sr���r���r���� <listcomp>���r����z)SpecifierSet.__init__.<locals>.<listcomp>�,) r�����set�addr����r���rn���� frozenset�_specsrH���)r���r����r'���Zsplit_specifiers�parsed� specifierr���r���r���rJ�����s���� zSpecifierSet.__init__r���c�����������������C���s*���|�j�d�urd|�j��nd}d�t|��|�S�)NrK���r>���z<SpecifierSet({!r}{})>)rH���r'���rL���r4���rN���r���r���r���rO������s ������zSpecifierSet.__repr__c�����������������C���s���d��tdd��|�jD����S�)Nr����c�����������������s���s���|�]}t�|�V��qd�S�rQ���)r4���r����r���r���r���r�������r����z'SpecifierSet.__str__.<locals>.<genexpr>)r�����sortedr����r���r���r���r���r ������s����zSpecifierSet.__str__c�����������������C���s ���t�|�j�S�rQ���)rR���r����r���r���r���r���r!������s����zSpecifierSet.__hash__r"���c�����������������C���s����t�|t�rt|�}nt�|t�s"tS�t��}t|�j|jB��|_|�jd�u�rX|jd�urX|j|_n<|�jd�urv|jd�u�rv|�j|_n|�j|jkr�|�j|_ntd��|S�)NzFCannot combine SpecifierSets with True and False prerelease overrides.)rS���r4���r����rT���r����r����rH���� ValueError)r���r#���r����r���r���r����__and__���s ���� �zSpecifierSet.__and__c�����������������C���s6���t�|ttf�rtt|��}nt�|t�s*tS�|�j|jkS�rQ����rS���r4���r;���r����rT���r����r$���r���r���r���r%������s ���� zSpecifierSet.__eq__c�����������������C���s6���t�|ttf�rtt|��}nt�|t�s*tS�|�j|jkS�rQ���r����r$���r���r���r���r&������s ���� zSpecifierSet.__ne__c�����������������C���s ���t�|�j�S�rQ���)r����r����r���r���r���r����__len__���s����zSpecifierSet.__len__c�����������������C���s ���t�|�j�S�rQ���)�iterr����r���r���r���r����__iter__���s����zSpecifierSet.__iter__c�����������������C���s.���|�j�d�ur|�j�S�|�jsd�S�tdd��|�jD���S�)Nc�����������������s���s���|�]}|j�V��qd�S�rQ����r'���r����r���r���r���r�������r����z+SpecifierSet.prereleases.<locals>.<genexpr>)rH���r����r����r���r���r���r���r'������s ���� zSpecifierSet.prereleasesr(���c�����������������C���s ���||�_�d�S�rQ���r]���r*���r���r���r���r'������s����r^���c�����������������C���s ���|���|�S�rQ���r_���r`���r���r���r���ra������s����zSpecifierSet.__contains__r+���c��������������������sL���t���ttf�st������d�u�r$|�j��s2��jr2dS�t���fdd�|�jD���S�)NFc�����������������3���s���|�]}|j����d��V��qdS�)r����Nr_���r�����r,���r'���r���r���r������r����z(SpecifierSet.contains.<locals>.<genexpr>)rS���r���r���r���r'���rc����allr����r-���r���r����r���r.������s���� zSpecifierSet.containsr/���c�����������������C���s����|d�u�r|�j�}|�jr6|�jD�]}|j|t|�d�}q|S�g�}g�}|D�]P}t|ttf�s^t|�}n|}t|t�rnqB|jr�|s�|s�|� |��qB|� |��qB|s�|r�|d�u�r�|S�|S�d�S�)Nr����) r'���r����r1���r7���rS���r���r���r���rc���rd���)r���r0���r'���r@���Zfilteredrf���r,���rh���r���r���r���r1��� ��s*���� zSpecifierSet.filter)r>���N)N)N)r���r���r���r4���r���r7���rJ���rO���r ���r5���r!���r���r����r6���r%���r&���r����r���r;���r����rj���r'���r9���rl���ra���r.���r���r���r1���r���r���r���r���r����~��s8������ ������r����)+r2���r����r����r����r~����typingr���r���r���r���r���r���r���r ���r ���r���r���Zutilsr���rC���r���r���r���rm���r4���rl���r���r7���rk���r����r����ABCMetar���r;���rn���r����r����r����r����r����r����r����r����r���r���r���r����<module>���s6���4:�=��� *