관리-도구
편집 파일: specifiers.cpython-39.pyc
a �������f�|����������������������@���sX��d�dl�mZmZmZ�d�dlZd�dlZd�dlZd�dlZddlm Z m Z �ddlmZ�ddl mZ�ddlmZmZmZ�er�d�dlmZmZmZmZmZmZmZmZmZ�eeef�Zeeeef�Zeeege f�Z!G�d d ��d e"�Z#G�dd��de ej$e%��Z&G�d d��de&�Z'G�dd��de'�Z(dd��Z)G�dd��de'�Z*e�+d�Z,dd��Z-dd��Z.G�dd��de&�Z/dS�)�����)�absolute_import�division�print_functionN����)�string_types�with_metaclass)� TYPE_CHECKING)�canonicalize_version)�Version� LegacyVersion�parse) �List�Dict�Union�Iterable�Iterator�Optional�Callable�Tuple� FrozenSetc�������������������@���s���e�Zd�ZdZdS�)�InvalidSpecifierzH An invalid specifier was found, users should refer to PEP 440. N)�__name__� __module__�__qualname__�__doc__��r���r����K/usr/lib/python3.9/site-packages/setuptools/_vendor/packaging/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__1���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__8���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����prereleasesH���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&���P���s����Nc�����������������C���s���dS�)zR Determines if the given item is contained within this specifier. Nr����r����itemr&���r���r���r����containsX���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����filter_���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��Zed d ���Zdd��Z d d��Z dd��Zdd��Zdd��Z edd���Zedd���Zedd���Zejdd���Zdd��Zd#dd�Zd$d d!�ZdS�)%�_IndividualSpecifier��Nc�����������������C���sF���|�j��|�}|std�|���|�d����|�d����f|�_||�_d�S�)NzInvalid specifier: '{0}'�operator�version)�_regex�searchr����format�group�strip�_spec�_prereleases)r����specr&����matchr���r���r����__init__l���s�����z_IndividualSpecifier.__init__c�����������������C���s0���|�j�d�urd�|�j�nd}d�|�jjt|��|�S�)N�, prereleases={0!r}r3���z<{0}({1!r}{2})>)r<���r8���r&���� __class__r����str�r���Zprer���r���r����__repr__z���s ������z_IndividualSpecifier.__repr__c�����������������C���s���dj�|�j��S�)Nz{0}{1})r8���r;���r���r���r���r���r �������s����z_IndividualSpecifier.__str__c�����������������C���s���|�j�d�t|�j�d��fS�)Nr���r���)r;���r ���r���r���r���r����_canonical_spec����s����z$_IndividualSpecifier._canonical_specc�����������������C���s ���t�|�j�S��N)�hashrE���r���r���r���r���r!�������s����z_IndividualSpecifier.__hash__c�����������������C���sR���t�|t�r6z|��t|��}W�qF�ty2���t�Y�S�0�nt�||�j�sFtS�|�j|jkS�rF���)� isinstancer���rA���rB���r����NotImplementedrE���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�rF���)rH���r���rA���rB���r���rI���r;���r"���r���r���r���r%�������s���� z_IndividualSpecifier.__ne__c�����������������C���s���t�|�d�|�j|���}|S�)Nz_compare_{0})�getattrr8���� _operators)r����op�operator_callabler���r���r���� _get_operator����s�����z"_IndividualSpecifier._get_operatorc�����������������C���s���t�|ttf�st|�}|S�rF���)rH���r���r ���r����r���r5���r���r���r����_coerce_version����s����z$_IndividualSpecifier._coerce_versionc�����������������C���s ���|�j�d�S�)Nr����r;���r���r���r���r���r4�������s����z_IndividualSpecifier.operatorc�����������������C���s ���|�j�d�S�)Nr���rQ���r���r���r���r���r5�������s����z_IndividualSpecifier.versionc�����������������C���s���|�j�S�rF����r<���r���r���r���r���r&�������s����z _IndividualSpecifier.prereleasesc�����������������C���s ���||�_�d�S�rF���rR���r'���r���r���r���r&�������s����c�����������������C���s ���|���|�S�rF����r+����r���r*���r���r���r����__contains__����s����z!_IndividualSpecifier.__contains__c�����������������C���s>���|d�u�r|�j�}|��|�}|jr&|s&dS�|��|�j�}|||�j�S��NF)r&���rP���� is_prereleaserN���r4���r5���)r���r*���r&���Znormalized_itemrM���r���r���r���r+�������s���� z_IndividualSpecifier.containsc�����������������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)rP���r+���rW���r&����append)r���r,���r&����yielded�found_prereleases�kwr5����parsed_versionr���r���r���r-�������s"���� ��z_IndividualSpecifier.filter)r3���N)N)N)r���r���r���rK���r?���rD���r ����propertyrE���r!���r$���r%���rN���rP���r4���r5���r&���r1���rU���r+���r-���r���r���r���r���r2���h���s,��� r2���c�������������������@���sv���e�Zd�ZdZe�de�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. ) �^\s*�\s*$�equal� not_equal�less_than_equal�greater_than_equal� less_than�greater_than)�==�!=�<=�>=�<�>c�����������������C���s���t�|t�stt|��}|S�rF���)rH���r���rB���rO���r���r���r���rP��� ��s���� zLegacySpecifier._coerce_versionc�����������������C���s���||���|�kS�rF����rP����r����prospectiver=���r���r���r����_compare_equal&��s����zLegacySpecifier._compare_equalc�����������������C���s���||���|�kS�rF���rm���rn���r���r���r����_compare_not_equal*��s����z"LegacySpecifier._compare_not_equalc�����������������C���s���||���|�kS�rF���rm���rn���r���r���r����_compare_less_than_equal.��s����z(LegacySpecifier._compare_less_than_equalc�����������������C���s���||���|�kS�rF���rm���rn���r���r���r����_compare_greater_than_equal2��s����z+LegacySpecifier._compare_greater_than_equalc�����������������C���s���||���|�k�S�rF���rm���rn���r���r���r����_compare_less_than6��s����z"LegacySpecifier._compare_less_thanc�����������������C���s���||���|�kS�rF���rm���rn���r���r���r����_compare_greater_than:��s����z%LegacySpecifier._compare_greater_thanN)r���r���r���� _regex_str�re�compile�VERBOSE� IGNORECASEr6���rK���rP���rp���rq���rr���rs���rt���ru���r���r���r���r���r^�����s ���� r^���c��������������������s���t�������fdd��}|S�)Nc��������������������s���t�|t�sdS���|�||�S�rV���)rH���r ���rn�����fnr���r����wrappedC��s���� z)_require_version_compare.<locals>.wrapped)� functools�wraps)r|���r}���r���r{���r����_require_version_compare?��s����r����c���������������� ���@���s����e�Zd�ZdZe�de�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 ) ) r_���r`���Z compatiblera���rb���rc���rd���re���rf���Z arbitrary)�~=rg���rh���ri���rj���rk���rl����===c�����������������C���sN���d��tt�dd��t|���d�d���}|d7�}|��d�||�oL|��d�||�S�)N�.c�����������������S���s���|���d��o|���d��S�)NZpost�dev)� startswith��xr���r���r����<lambda>��������z/Specifier._compare_compatible.<locals>.<lambda>����.*rj���rg���)�join�list� itertools� takewhile�_version_splitrN���)r���ro���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����rB����len�_pad_version�local) r���ro���r=���Z split_specZsplit_prospectiveZshortened_prospectiveZpadded_specZpadded_prospectiveZspec_versionr���r���r���rp������s���� � zSpecifier._compare_equalc�����������������C���s���|���||��S�rF���)rp���rn���r���r���r���rq������s����zSpecifier._compare_not_equalc�����������������C���s���t�|j�t�|�kS�rF����r ���r����rn���r���r���r���rr�����s����z"Specifier._compare_less_than_equalc�����������������C���s���t�|j�t�|�kS�rF���r����rn���r���r���r���rs��� ��s����z%Specifier._compare_greater_than_equalc�����������������C���s<���t�|�}||k�sdS�|js8|jr8t�|j�t�|j�kr8dS�dS��NFT)r ���rW����base_version�r���ro���Zspec_strr=���r���r���r���rt�����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���ru���1��s���� zSpecifier._compare_greater_thanc�����������������C���s���t�|����t�|����kS�rF���)rB����lowerrn���r���r���r����_compare_arbitraryR��s����zSpecifier._compare_arbitraryc�����������������C���sR���|�j�d�ur|�j�S�|�j\}}|dv�rN|dkr@|�d�r@|d�d��}t|�jrNdS�dS�)N)rg���rj���ri���r����r����rg���r����r����TF)r<���r;���r����r���rW���)r���r4���r5���r���r���r���r&���V��s���� zSpecifier.prereleasesc�����������������C���s ���||�_�d�S�rF���rR���r'���r���r���r���r&���p��s����N)r���r���r���rv���rw���rx���ry���rz���r6���rK���r����r����rp���rq���rr���rs���rt���ru���r����r]���r&���r1���r���r���r���r���r����M��s<���]� ( r����z^([0-9]+)((?:a|b|c|rc)[0-9]+)$c�����������������C���s@���g�}|���d�D�],}t�|�}|r0|�|�����q|�|��q|S�)Nr����)�split� _prefix_regexr7����extend�groupsrX���)r5����resultr*���r>���r���r���r���r����y��s���� r����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�rF�����isdigitr����r���r���r���r�������r����z_pad_version.<locals>.<lambda>c�����������������S���s���|�����S�rF���r����r����r���r���r���r�������r����r���r����0)rX���r����r����r����r�����insert�max�chain)�left�rightZ left_splitZright_splitr���r���r���r�������s���� ,,r����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�)!�SpecifierSetr3���Nc�������������� ���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���)r:�����.0�sr���r���r���� <listcomp>���r����z)SpecifierSet.__init__.<locals>.<listcomp>�,) r�����set�addr����r���r^���� frozenset�_specsr<���)r���Z specifiersr&���Zsplit_specifiers�parsed� specifierr���r���r���r?������s���� zSpecifierSet.__init__c�����������������C���s*���|�j�d�urd�|�j�nd}d�t|��|�S�)Nr@���r3���z<SpecifierSet({0!r}{1})>)r<���r8���r&���rB���rC���r���r���r���rD������s ������zSpecifierSet.__repr__c�����������������C���s���d��tdd��|�jD����S�)Nr����c�����������������s���s���|�]}t�|�V��qd�S�rF���)rB���r����r���r���r���� <genexpr>���r����z'SpecifierSet.__str__.<locals>.<genexpr>)r�����sortedr����r���r���r���r���r ������s����zSpecifierSet.__str__c�����������������C���s ���t�|�j�S�rF���)rG���r����r���r���r���r���r!������s����zSpecifierSet.__hash__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.)rH���r���r����rI���r����r����r<���� ValueError)r���r#���r����r���r���r����__and__���s ���� �zSpecifierSet.__and__c�����������������C���s6���t�|ttf�rtt|��}nt�|t�s*tS�|�j|jkS�rF����rH���r���r2���r����rB���rI���r����r"���r���r���r���r$������s ���� zSpecifierSet.__eq__c�����������������C���s6���t�|ttf�rtt|��}nt�|t�s*tS�|�j|jkS�rF���r����r"���r���r���r���r%������s ���� zSpecifierSet.__ne__c�����������������C���s ���t�|�j�S�rF���)r����r����r���r���r���r����__len__���s����zSpecifierSet.__len__c�����������������C���s ���t�|�j�S�rF���)�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�rF����r&���r����r���r���r���r������r����z+SpecifierSet.prereleases.<locals>.<genexpr>)r<���r�����anyr���r���r���r���r&������s ���� zSpecifierSet.prereleasesc�����������������C���s ���||�_�d�S�rF���rR���r'���r���r���r���r&�����s����c�����������������C���s ���|���|�S�rF���rS���rT���r���r���r���rU�����s����zSpecifierSet.__contains__c��������������������sL���t���ttf�st������d�u�r$|�j��s2��jr2dS�t���fdd�|�jD���S�)NFc�����������������3���s���|�]}|j����d��V��qdS�)r����NrS���r�����r*���r&���r���r���r����*��r����z(SpecifierSet.contains.<locals>.<genexpr>)rH���r���r ���r���r&���rW����allr����r)���r���r����r���r+�����s���� zSpecifierSet.containsc�����������������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����r-����boolrH���r���r ���r���rW���rX���)r���r,���r&���r=���ZfilteredrZ���r*���r\���r���r���r���r-���,��s*���� zSpecifierSet.filter)r3���N)N)N)r���r���r���r?���rD���r ���r!���r����r$���r%���r����r����r]���r&���r1���rU���r+���r-���r���r���r���r���r�������s"��� ��r����)0Z __future__r���r���r���r.���r~���r����rw���Z_compatr���r���Z_typingr���Zutilsr ���r5���r ���r���r����typingr ���r���r���r���r���r���r���r���r���Z ParsedVersionrB���ZUnparsedVersionr����ZCallableOperatorr����r����ABCMeta�objectr���r2���r^���r����r����rx���r����r����r����r����r���r���r���r����<module>���s4���,@� 8��+