HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux srvntsweb01 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64
User: admntserv (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //snap/certbot/5370/lib/python3.12/site-packages/packaging/__pycache__/specifiers.cpython-312.pyc
�

���i]���f�dZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZddl
mZddlmZmZeeefZede�	�ZeeegefZdd
�Zdd�Zdd�ZGd
�de�ZGd�dej8��ZGd�de�Zej>d�Z dd�Z!dd�Z"dd�Z#d d�Z$Gd�de�Z%y)!z�
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
�)�annotationsN)�Callable�Final�Iterable�Iterator�TypeVar�Union�)�canonicalize_version)�InvalidVersion�Version�UnparsedVersionVar)�boundc�`�t|t�s	t|�}|S|S#t$rYywxYw�N)�
isinstancer
r��versions ��/build/snapcraft-certbot-817459ae66b3942307a8b35b87e7f45e/parts/certbot/install/lib/python3.12/site-packages/packaging/specifiers.py�_coerce_versionrs:���g�w�'�	��g�&�G��N�7�N���	��	�s�!�	-�-c�&�|jd��S)N)�local��__replace__rs r�_public_versionr#s�����T��*�*�c�,�|jdddd��S)N)�pre�post�devrrrs r�
_base_versionr!'s�����4�d��D��I�Irc��eZdZdZy)�InvalidSpecifiera
    Raised when attempting to create a :class:`Specifier` with a specifier
    string that is invalid.

    >>> Specifier("lolwat")
    Traceback (most recent call last):
        ...
    packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat'
    N)�__name__�
__module__�__qualname__�__doc__�rrr#r#+s��rr#c�J�eZdZdZdZedd��Zejdd��Z	ejd
d��Z
ejdd��Zeejdd���Zejdd��Zejddd
��Zej	d					dd��Zy	)�
BaseSpecifierr()�_strc��t|�S)z Internal property for match_args��str��selfs rr+zBaseSpecifier._str;s���4�y�rc��y)z�
        Returns the str representation of this Specifier-like object. This
        should be representative of the Specifier itself.
        Nr(r/s r�__str__zBaseSpecifier.__str__@��rc��y)zF
        Returns a hash value for this Specifier-like object.
        Nr(r/s r�__hash__zBaseSpecifier.__hash__Gr3rc��y)z�
        Returns a boolean representing whether or not the two Specifier-like
        objects are equal.

        :param other: The other object to check against.
        Nr(�r0�others  r�__eq__zBaseSpecifier.__eq__Mr3rc��y)z�Whether or not pre-releases as a whole are allowed.

        This can be set to either ``True`` or ``False`` to explicitly enable or disable
        prereleases or it can be set to ``None`` (the default) to use default semantics.
        Nr(r/s r�prereleaseszBaseSpecifier.prereleasesVr3rc��y)zQSetter for :attr:`prereleases`.

        :param value: The value to set.
        Nr(�r0�values  rr;zBaseSpecifier.prereleases_r3rNc��y)zR
        Determines if the given item is contained within this specifier.
        Nr(�r0�itemr;s   r�containszBaseSpecifier.containsfr3rc��y)z�
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        Nr()r0�iterabler;s   r�filterzBaseSpecifier.filterlr3r��returnr.�rG�int�r8�objectrG�bool�rG�bool | None)r>rLrG�Noner)rAr.r;rNrGrL�rDzIterable[UnparsedVersionVar]r;rNrGzIterator[UnparsedVersionVar])r$r%r&�	__slots__�__match_args__�propertyr+�abc�abstractmethodr2r5r9r;�setterrBrEr(rrr*r*7s����I��N�
����	������	������
	��������������������	������
	���QU��4��CN��	%���rr*)�	metaclassc	��eZdZUdZdZdZdZejdezezdzejejz�Zdddd	d
ddd
d�Zde
d<d*d+d�Zd,d�Zd-d�Zed.d��Zej&d/d��Zed0d��Zed0d��Zd0d�Zd0d�Zed1d��Zd2d�Zd3d�Zd4d�Zd5d�Zd5d �Zd5d!�Zd5d"�Zd5d#�Z d6d$�Z!d6d%�Z"d7d&�Z#d8d'�Z$d9d:d(�Z%	d9					d;d)�Z&y)<�	Specifiera?This class abstracts handling of version specifiers.

    .. tip::

        It is generally not required to instantiate this manually. You should instead
        prefer to work with :class:`SpecifierSet` instead, which can parse
        comma-separated version specifiers (which is what package metadata contains).
    )�_prereleases�_spec�
_spec_versionz8
        (?P<operator>(~=|==|!=|<=|>=|<|>|===))
        a�
        (?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;)]*  # The arbitrary version can be just about anything,
                          # we match everything except for whitespace, a
                          # semi-colon for marker support, and a closing paren
                          # since versions can be enclosed in them.
            )
            |
            (?:
                # 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

                # You cannot use a wild card and a pre-release, post-release, a dev or
                # local version together so group them with a | and make them optional.
                (?:
                    \.\*  # Wild card syntax of .*
                    |
                    (?:                                  # pre release
                        [-_\.]?
                        (alpha|beta|preview|pre|a|b|c|rc)
                        [-_\.]?
                        [0-9]*
                    )?
                    (?:                                  # post release
                        (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                    )?
                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
                )?
            )
            |
            (?:
                # 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
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [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
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
        )
        z\s*�
compatible�equal�	not_equal�less_than_equal�greater_than_equal�	less_than�greater_than�	arbitrary)�~=�==�!=z<=�>=�<�>�===r�
_operatorsNc��|jj|�}|std|����|jd�j	�|jd�j	�f|_||_d|_y)a�Initialize a Specifier instance.

        :param spec:
            The string representation of a specifier which will be parsed and
            normalized before use.
        :param prereleases:
            This tells the specifier if it should accept prerelease versions if
            applicable or not. The default of ``None`` will autodetect it from the
            given specifiers.
        :raises InvalidSpecifier:
            If the given specifier is invalid (i.e. bad syntax).
        zInvalid specifier: �operatorrN)�_regex�	fullmatchr#�group�stripr[rZr\)r0�specr;�matchs    r�__init__zSpecifier.__init__�sw�����%�%�d�+���"�%8���#A�B�B�
�K�K�
�#�)�)�+��K�K�	�"�(�(�*�'
��
�(���:>��rc��|j�!|jd|k(r|jdSt|�}|�y||f|_|S)zDOne element cache, as only one spec Version is needed per Specifier.Nrr
)r\r)r0r�version_specifiers   r�_get_spec_versionzSpecifier._get_spec_versionsY�����)�d�.@�.@��.C�w�.N��%�%�a�(�(�+�G�4���$��%�'8�9��� � rc�0�|j|�}|�J�|S)z�Get spec version, asserting it's valid (not for === operator).

        This method should only be called for operators where version
        strings are guaranteed to be valid PEP 440 versions (not ===).
        )rx)r0r�spec_versions   r�_require_spec_versionzSpecifier._require_spec_versions&���-�-�g�6���'�'�'��rc���|j�|jS|j\}}|dk7r8|dk(r|jd�ry|j|�}|�y|jryy)Nrgrf�.*FT)rZr[�endswithrx�
is_prerelease)r0rn�version_strrs    rr;zSpecifier.prereleases%sy�����(��$�$�$�!%�
�
���+��t���4��K�$8�$8��$>���,�,�[�9�G�����$�$��rc��||_yr�rZr=s  rr;zSpecifier.prereleasesB�
��!��rc� �|jdS)z`The operator of this specifier.

        >>> Specifier("==1.2.3").operator
        '=='
        r�r[r/s rrnzSpecifier.operatorF����z�z�!�}�rc� �|jdS)zaThe version of this specifier.

        >>> Specifier("==1.2.3").version
        '1.2.3'
        r
r�r/s rrzSpecifier.versionOr�rc��|j�d|j��nd}d|jj�dt	|��|�d�S)aTA representation of the Specifier that shows all internal state.

        >>> Specifier('>=1.0.0')
        <Specifier('>=1.0.0')>
        >>> Specifier('>=1.0.0', prereleases=False)
        <Specifier('>=1.0.0', prereleases=False)>
        >>> Specifier('>=1.0.0', prereleases=True)
        <Specifier('>=1.0.0', prereleases=True)>
        �, prereleases=�ri�(�)>)rZr;�	__class__r$r.�r0rs  r�__repr__zSpecifier.__repr__XsU��� � �,��T�-�-�0�1��	��4�>�>�*�*�+�1�S��Y�M�#��b�A�Arc�4�dj|j�S)z�A string representation of the Specifier that can be round-tripped.

        >>> str(Specifier('>=1.0.0'))
        '>=1.0.0'
        >>> str(Specifier('>=1.0.0', prereleases=False))
        '>=1.0.0'
        z{}{})�formatr[r/s rr2zSpecifier.__str__js���v�}�}�d�j�j�)�)rc��|j\}}|dk(s|jd�r||fS|j|�}t||dk7��}||fS)Nrkr}re��strip_trailing_zero)r[r~r{r)r0rnrrz�canonical_versions     r�_canonical_speczSpecifier._canonical_spectsc�� �J�J���'��u��� 0� 0�� 6��W�$�$��1�1�'�:��0��x�4�/?�
���*�*�*rc�,�t|j�Sr)�hashr�r/s rr5zSpecifier.__hash__�s���D�(�(�)�)rc���t|t�r	|jt|��}nt||j�stS|j
|j
k(S#t$r	tcYSwxYw)a>Whether or not the two Specifier-like objects are equal.

        :param other: The other object to check against.

        The value of :attr:`prereleases` is ignored.

        >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0")
        True
        >>> (Specifier("==1.2.3", prereleases=False) ==
        ...  Specifier("==1.2.3", prereleases=True))
        True
        >>> Specifier("==1.2.3") == "==1.2.3"
        True
        >>> Specifier("==1.2.3") == Specifier("==1.2.4")
        False
        >>> Specifier("==1.2.3") == Specifier("~=1.2.3")
        False
        )rr.r�r#�NotImplementedr�r7s  rr9zSpecifier.__eq__�si��&�e�S�!�
&����s�5�z�2���E�4�>�>�2�!�!��#�#�u�'<�'<�<�<��$�
&�%�%�
&�s�A"�"A4�3A4c�>�t|d|j|���}|S)N�	_compare_)�getattrrl)r0�op�operator_callables   r�
_get_operatorzSpecifier._get_operator�s+��.5��I�d�o�o�b�1�2�3�/
��!� rc
���tttjtt|���dd�}|dz
}|j
d�||�xr|j
d�||�S)N���r}rhrf)�
_version_join�list�	itertools�	takewhile�_is_not_suffix�_version_splitr�)r0�prospectivers�prefixs    r�_compare_compatiblezSpecifier._compare_compatible�sw�����$�$�^�^�D�5I�J�K�C�R�P�
��
	�$���'�t�!�!�$�'��T�:�
�?W�t�?Q�?Q�RV�?W���@
�	
rc�:�|jd�r^tt|�d��}t|ddd��}t|�}t|�}t	||�\}}|dt|�}	|	|k(S|j
|�}
|
jst|�}||
k(S)Nr}Fr����)r~rrr��_pad_version�lenr{r)r0r�rs�normalized_prospective�normalized_spec�
split_spec�split_prospective�padded_prospective�_�shortened_prospectiverzs           r�_compare_equalzSpecifier._compare_equal�s����=�=���%9���,�%�&�"�3�4���9�RW�X�O�(��8�J�
!/�/E� F��%1�1B�J�$O�!���
%7�7H��Z��$I�!�(�J�6�6� �5�5�d�;�L�
 �%�%�-�k�:���,�.�.rc�(�|j||�Sr)r��r0r�rss   r�_compare_not_equalzSpecifier._compare_not_equal�s���&�&�{�D�9�9�9rc�<�t|�|j|�kSr�rr{r�s   r�_compare_less_than_equalz"Specifier._compare_less_than_equal�����{�+�t�/I�/I�$�/O�O�Orc�<�t|�|j|�k\Srr�r�s   r�_compare_greater_than_equalz%Specifier._compare_greater_than_equal�r�rc��|j|�}||ksy|js$|jrt|�t|�k(ryy�NFT)r{rr!�r0r��spec_strrss    r�_compare_less_thanzSpecifier._compare_less_than�sO���)�)�(�3��
�T�!���"�"��)�)��k�*�m�D�.A�A��
rc���|j|�}||kDsy|js$|jrt|�t|�k(ry|j�t|�t|�k(ryyr�)r{�is_postreleaser!rr�s    r�_compare_greater_thanzSpecifier._compare_greater_thansy���)�)�(�3��
�T�!���#�#��*�*��k�*�m�D�.A�A�����(�]��.
�
�4�
 �.!��
rc�h�t|�j�t|�j�k(Sr)r.�lowerr�s   r�_compare_arbitraryzSpecifier._compare_arbitrary0s&���;��%�%�'�3�t�9�?�?�+<�<�<rc�$�|j|�S)a:Return whether or not the item is contained in this specifier.

        :param item: The item to check for.

        This is used for the ``in`` operator and behaves the same as
        :meth:`contains` with no ``prereleases`` argument passed.

        >>> "1.2.3" in Specifier(">=1.2.3")
        True
        >>> Version("1.2.3") in Specifier(">=1.2.3")
        True
        >>> "1.0.0" in Specifier(">=1.2.3")
        False
        >>> "1.3.0a1" in Specifier(">=1.2.3")
        True
        >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
        True
        �rB�r0rAs  r�__contains__zSpecifier.__contains__3���&�}�}�T�"�"rc�N�tt|j|g|����S)asReturn whether or not the item is contained in this specifier.

        :param item:
            The item to check for, which can be a version string or a
            :class:`Version` instance.
        :param prereleases:
            Whether or not to match prereleases with this Specifier. If set to
            ``None`` (the default), it will follow the recommendation from
            :pep:`440` and match prereleases, as there are no other versions.

        >>> Specifier(">=1.2.3").contains("1.2.3")
        True
        >>> Specifier(">=1.2.3").contains(Version("1.2.3"))
        True
        >>> Specifier(">=1.2.3").contains("1.0.0")
        False
        >>> Specifier(">=1.2.3").contains("1.3.0a1")
        True
        >>> Specifier(">=1.2.3", prereleases=False).contains("1.3.0a1")
        False
        >>> Specifier(">=1.2.3").contains("1.3.0a1")
        True
        �r;)rLr�rEr@s   rrBzSpecifier.containsHs#��2�D����d�V���E�F�G�Grc#��K�g}d}|�|n|j}|j|j�}|D]�}t|�}|�2|jdk(s� |j	||j
�s�=|���B|||j
�s�V|jr|rd}|���k|��n|jdus�}|j|���|s|�|jdur|Ed{���yyyy7��w)aFilter items in the given iterable, that match the specifier.

        :param iterable:
            An iterable that can contain version strings and :class:`Version` instances.
            The items in the iterable will be filtered according to the specifier.
        :param prereleases:
            Whether or not to allow prereleases in the returned iterator. If set to
            ``None`` (the default), it will follow the recommendation from :pep:`440`
            and match prereleases if there are no other versions.

        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
        ['1.3']
        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")]))
        ['1.2.3', '1.3', <Version('1.4')>]
        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"]))
        ['1.5a1']
        >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
        ['1.3', '1.5a1']
        >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
        ['1.3', '1.5a1']
        FNrkT)	r;r�rnrr�rrrZ�append)	r0rDr;�prereleases_versions�found_non_prereleases�include_prereleasesr�r�parsed_versions	         rrEzSpecifier.filtercs����0 "�� %��'�2�K��8H�8H�	�
!�.�.�t�}�}�=�� �	9�G�,�W�5�N��%��=�=�E�)�d�.E�.E��T�\�\�/�"�M�"�>�4�<�<�@�%�3�3�7J�,0�)�!�M� �(�T�->�->�e�-K�(�/�/��8�	9�(&��#��!�!��.�+�+�+�/�$�&�
,�s0�AC&�C&�1C&�
C&�"C&�1*C&�C$�	C&�r�N)rsr.r;rNrGrO)rr.rG�Version | None)rr.rGr
rM�r>rNrGrOrF)rGztuple[str, str]rHrJ)r�r.rG�CallableOperator)r�r
rsr.rGrL)r�r
r�r.rGrL)r�z
Version | strrsr.rGrL)rAz
str | VersionrGrLr)rA�UnparsedVersionr;rNrGrLrP)'r$r%r&r'rQ�_operator_regex_str�_version_regex_str�re�compile�VERBOSE�
IGNORECASErorl�__annotations__rurxr{rSr;rVrnrr�r2r�r5r9r�r�r�r�r�r�r�r�r�r�rBrEr(rrrYrYvsl���;�I���\��|�R�Z�Z��$�$�'9�9�F�B�
�
�
�R�]�]�"��F�����"�
�
��	�J��	�>�8
!������8���"��"���������B�$*��+��+�*�=�:!�
�(&/�P:�P�P��6 �D=�#�*H�8RV�<,�4�<,�CN�<,�	%�<,rrYz([0-9]+)((?:a|b|c|rc)[0-9]+)c��g}|jd�\}}}|j|xsd�|jd�D]J}tj	|�}|r |j|j
���:|j|��L|S)aSplit version into components.

    The split components are intended for version comparison. The logic does
    not attempt to retain the original version string, so joining the
    components back with :func:`_version_join` may not produce the original
    version string.
    �!�0�.)�
rpartitionr��split�
_prefix_regexrp�extend�groups)r�result�epochr��restrArts       rr�r��s~���F��'�'��,�N�E�1�d�
�M�M�%�,�3���
�
�3�� ���'�'��-����M�M�%�,�,�.�)��M�M�$�� ��Mrc�6�|^}}|�ddj|���S)z�Join split version components into a version string.

    This function assumes the input came from :func:`_version_split`, where the
    first component must be the epoch (either empty or numeric), and all other
    components numeric.
    r�r�)�join)�
componentsr�r�s   rr�r��s'���L�E�D��W�A�c�h�h�t�n�%�&�&rc�.��t�fd�dD��S)Nc3�@�K�|]}�j|����y�wr)�
startswith)�.0r��segments  �r�	<genexpr>z!_is_not_suffix.<locals>.<genexpr>�s!������'-����6�"��s�)r �a�b�rcr)�any)r�s`rr�r��s"�����1P����rc���gg}}|jttjd�|���|jttjd�|���|j|t	|d�d�|j|t	|d�d�|jddgt
dt	|d�t	|d�z
�z�|jddgt
dt	|d�t	|d�z
�z�ttjj|��ttjj|��fS)Nc�"�|j�Sr��isdigit��xs r�<lambda>z_pad_version.<locals>.<lambda>�s������rc�"�|j�Srrrs rrz_pad_version.<locals>.<lambda>�s��!�)�)�+�rrr
r�)	r�r�r�r�r��insert�max�chain�
from_iterable)�left�right�
left_split�right_splits    rr�r��s5�� �"��J����d�9�.�.�/D�d�K�L�M����t�I�/�/�0E�u�M�N�O����d�3�z�!�}�-�/�0�1����u�S��Q��0�2�3�4����a�#���Q��K��N�(;�c�*�Q�-�>P�(P�!Q�Q�R����q�3�%�#�a��Z��]�);�c�+�a�.�>Q�)Q�"R�R�S�	
�Y�_�_�
*�
*�:�
6�7��Y�_�_�
*�
*�;�
7�8��rc���eZdZdZdZ		d					dd�Zedd��Zejdd��Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zdd
�Zdd�Z		d							dd�Z	d					dd�Zy)�SpecifierSetz�This class abstracts handling of a set of version specifiers.

    It can be passed a single specifier (``>=3.0``), a comma-separated list of
    specifiers (``>=3.0,!=3.1``), or no specifier at all.
    )rZ�_specsNc�"�t|t�rc|jd�D�cgc]#}|j�s�|j���%}}t	tt|��|_||_yt	|�|_||_ycc}w)a�Initialize a SpecifierSet instance.

        :param specifiers:
            The string representation of a specifier or a comma-separated list of
            specifiers which will be parsed and normalized before use.
            May also be an iterable of ``Specifier`` instances, which will be used
            as is.
        :param prereleases:
            This tells the SpecifierSet if it should accept prerelease versions if
            applicable or not. The default of ``None`` will autodetect it from the
            given specifiers.

        :raises InvalidSpecifier:
            If the given ``specifiers`` are not parseable than this exception will be
            raised.
        �,N)	rr.r�rr�	frozenset�maprYrrZ)r0�
specifiersr;�s�split_specifierss     rruzSpecifierSet.__init__�s{��,�j�#�&�4>�3C�3C�C�3H�V�a�A�G�G�I����	�V��V�$�C�	�3C�$D�E�D�K�(���	$�J�/�D�K�(���� Ws
�B�Bc��|j�|jS|jsytd�|jD��ryy)Nc3�4K�|]}|j���y�wrr��r�rs  rr�z+SpecifierSet.prereleases.<locals>.<genexpr>s����2��q�}�}�2�s�T)rZrr�r/s rr;zSpecifierSet.prereleasessB�����(��$�$�$�
�{�{���2�d�k�k�2�2��rc��||_yrr�r=s  rr;zSpecifierSet.prereleases$r�rc�^�|j�d|j��nd}dt|��|�d�S)aA representation of the specifier set that shows all internal state.

        Note that the ordering of the individual specifiers within the set may not
        match the input string.

        >>> SpecifierSet('>=1.0.0,!=2.0.0')
        <SpecifierSet('!=2.0.0,>=1.0.0')>
        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False)
        <SpecifierSet('!=2.0.0,>=1.0.0', prereleases=False)>
        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True)
        <SpecifierSet('!=2.0.0,>=1.0.0', prereleases=True)>
        r�r�z<SpecifierSet(r�)rZr;r.r�s  rr�zSpecifierSet.__repr__(sD��� � �,��T�-�-�0�1��	� ��D�	�}�S�E��4�4rc�X�djtd�|jD���S)anA string representation of the specifier set that can be round-tripped.

        Note that the ordering of the individual specifiers within the set may not
        match the input string.

        >>> str(SpecifierSet(">=1.0.0,!=1.0.1"))
        '!=1.0.1,>=1.0.0'
        >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False))
        '!=1.0.1,>=1.0.0'
        rc3�2K�|]}t|����y�wrr-rs  rr�z'SpecifierSet.__str__.<locals>.<genexpr>Hs����;�!�s�1�v�;�s�)r��sortedrr/s rr2zSpecifierSet.__str__=s"���x�x��;�t�{�{�;�;�<�<rc�,�t|j�Sr)r�rr/s rr5zSpecifierSet.__hash__Js���D�K�K� � rc��t|t�rt|�}nt|t�stSt�}t	|j
|j
z�|_|j�|j�|j|_|S|j�|j�|j|jk(r|j|_|Std��)a�Return a SpecifierSet which is a combination of the two sets.

        :param other: The other object to combine with.

        >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1'
        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>
        >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1')
        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>
        zFCannot combine SpecifierSets with True and False prerelease overrides.)rr.rr�rrrZ�
ValueError)r0r8�	specifiers   r�__and__zSpecifierSet.__and__Ms����e�S�!� ��'�E��E�<�0�!�!� �N�	�$�T�[�[�5�<�<�%?�@�	�����$��);�);�)G�%*�%7�%7�I�"���
���)�e�.@�.@�.H�
�
�
�%�"4�"4�
4�%)�%6�%6�I�"���	�X��
rc��t|ttf�rtt|��}nt|t�stS|j
|j
k(S)a�Whether or not the two SpecifierSet-like objects are equal.

        :param other: The other object to check against.

        The value of :attr:`prereleases` is ignored.

        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1")
        True
        >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) ==
        ...  SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True))
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1"
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2")
        False
        )rr.rYrr�rr7s  rr9zSpecifierSet.__eq__lsD��&�e�c�9�-�.� ��U��,�E��E�<�0�!�!��{�{�e�l�l�*�*rc�,�t|j�S)z7Returns the number of specifiers in this specifier set.)r�rr/s r�__len__zSpecifierSet.__len__�s���4�;�;��rc�,�t|j�S)z�
        Returns an iterator over all the underlying :class:`Specifier` instances
        in this specifier set.

        >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str)
        [<Specifier('!=1.0.1')>, <Specifier('>=1.0.0')>]
        )�iterrr/s r�__iter__zSpecifierSet.__iter__�s���D�K�K� � rc�$�|j|�S)aqReturn whether or not the item is contained in this specifier.

        :param item: The item to check for.

        This is used for the ``in`` operator and behaves the same as
        :meth:`contains` with no ``prereleases`` argument passed.

        >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1")
        True
        >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1")
        True
        >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1")
        False
        >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1")
        True
        >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)
        True
        r�r�s  rr�zSpecifierSet.__contains__�r�rc��t|�}|�|r|jrd}|�|n|}tt|j	|g|����S)a�Return whether or not the item is contained in this SpecifierSet.

        :param item:
            The item to check for, which can be a version string or a
            :class:`Version` instance.
        :param prereleases:
            Whether or not to match prereleases with this SpecifierSet. If set to
            ``None`` (the default), it will follow the recommendation from :pep:`440`
            and match prereleases, as there are no other versions.
        :param installed:
            Whether or not the item is installed. If set to ``True``, it will
            accept prerelease versions even if the specifier does not allow them.

        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3")
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3"))
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1")
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False).contains("1.3.0a1")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True)
        True
        Tr�)rrrLr�rE)r0rAr;�	installedr�
check_items      rrBzSpecifierSet.contains�sN��@"�$�'����9��1F�1F��K�$�_�T�'�
��D����j�\�{��K�L�M�Mrc��	�|�|j�|j}|jr5|jD]}|j||�dn|��}�|�)t|�S|durt|�S|dur�	fd�|D�Sg}g}d}|D]c}t	|�}|�#|j|�|j|��3|jr|j|��Q|j|�d}�et|r|�S|�S)a�Filter items in the given iterable, that match the specifiers in this set.

        :param iterable:
            An iterable that can contain version strings and :class:`Version` instances.
            The items in the iterable will be filtered according to the specifier.
        :param prereleases:
            Whether or not to allow prereleases in the returned iterator. If set to
            ``None`` (the default), it will follow the recommendation from :pep:`440`
            and match prereleases if there are no other versions.

        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
        ['1.3']
        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")]))
        ['1.3', <Version('1.4')>]
        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"]))
        ['1.5a1']
        >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
        ['1.3', '1.5a1']
        >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
        ['1.3', '1.5a1']

        An "empty" SpecifierSet will filter items based on the presence of prerelease
        versions in the set.

        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"]))
        ['1.3']
        >>> list(SpecifierSet("").filter(["1.5a1"]))
        ['1.5a1']
        >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"]))
        ['1.3', '1.5a1']
        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True))
        ['1.3', '1.5a1']
        Tr�Fc3�T�K�|]}t|�x���js|���!y�wr)rr)r�rArs  �rr�z&SpecifierSet.filter.<locals>.<genexpr>s2�������#2�4�#8�8��A�"�0�0���s�%()r;rrEr)rr�r)
r0rDr;rs�filtered_items�found_prereleases�found_final_releaserAr�rs
         @rrEzSpecifierSet.filter�s5���N��4�#3�#3�#?��*�*�K�
�;�;����
���;�;��+�2E�$�;�'���
�
�&��H�~�%��d�"��H�~�%��e�#�� (���46��68��#���	+�D�,�T�2�N��%��%�%�d�+�!�(�(��.��-�-�!�(�(��.��%�%�d�+�&*�#�	+��&9�N�Q�Q�?P�Q�Qrr�)rzstr | Iterable[Specifier]r;rNrGrOrMr�rFrH)r8zSpecifierSet | strrGrrJ)rGzIterator[Specifier])rAr�rGrL)NN)rAr�r;rNr-rNrGrLrrP)r$r%r&r'rQrurSr;rVr�r2r5r$r9r'r*r�rBrEr(rrrr�s����+�I�13�#'�$(�-�$(�!�$(�
�	$(�L����&���"��"�5�*=�!��>+�4 �!�#�0$(�!%�	&N��&N�!�&N��	&N�

�&N�RRV�[R�4�[R�CN�[R�	%�[Rrr)rr�rGr�)rr
rGr
)rr.rG�	list[str])r�r4rGr.)r�r.rGrL)r
r4rr4rGztuple[list[str], list[str]])&r'�
__future__rrTr�r��typingrrrrrr	�utilsrrrr
r.r�rrLr�rrr!r"r#�ABCMetar*rYr�r�r�r�r�r�rr(rr�<module>r9s����#�
��	�F�F�'�,�����%���1��I���W�c�N�D�0�1���+�J�	�z�	�<�c�k�k�<�~i,�
�i,�X��
�
�:�;�
��,'���*KR�=�KRr