HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/packaging/__pycache__/specifiers.cpython-310.pyc
o

;jh��	@sTdZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZddl
mZddlmZeeefZeded�ZeeegefZd	ed
efdd�ZGd
d�de�ZGdd�dejd�ZGdd�de�Ze�d�Zd	ed
eefdd�Zdeed
efdd�Zded
efdd�Z deedeed
e
eeeeffdd �Z!Gd!d"�d"e�Z"dS)#z�
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
�N)�Callable�Iterable�Iterator�List�Optional�Tuple�TypeVar�Union�)�canonicalize_version)�Version�UnparsedVersionVar)�bound�version�returncCst|t�s	t|�}|S�N)�
isinstancer)r�r�H/opt/saltstack/salt/lib/python3.10/site-packages/packaging/specifiers.py�_coerce_versions
rc@seZdZdZdS)�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__rrrrrsrc	@s�eZdZejdefdd��Zejdefdd��Zejde	de
fdd��Zeejde
e
fd	d
���Zejde
ddfd
d
��Zejddede
e
de
fdd��Zej	ddeede
e
deefdd��ZdS)�
BaseSpecifierrcC�dS)z�
        Returns the str representation of this Specifier-like object. This
        should be representative of the Specifier itself.
        Nr��selfrrr�__str__+�zBaseSpecifier.__str__cCr)zF
        Returns a hash value for this Specifier-like object.
        Nrrrrr�__hash__2r zBaseSpecifier.__hash__�othercCr)z�
        Returns a boolean representing whether or not the two Specifier-like
        objects are equal.

        :param other: The other object to check against.
        Nr�rr"rrr�__eq__8r zBaseSpecifier.__eq__cCr)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.
        Nrrrrr�prereleasesAr zBaseSpecifier.prereleases�valueNcCr)zQSetter for :attr:`prereleases`.

        :param value: The value to set.
        Nr�rr&rrrr%Jr �itemr%cCr)zR
        Determines if the given item is contained within this specifier.
        Nr)rr(r%rrr�containsQr zBaseSpecifier.contains�iterablecCr)z�
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        Nr)rr*r%rrr�filterWr zBaseSpecifier.filterr)rrr�abc�abstractmethod�strr�intr!�object�boolr$�propertyrr%�setterr)rr
rr+rrrrr*s.����r)�	metaclassc	@s.eZdZdZdZdZe�deedejej	B�Z
dddd	d
ddd
d�ZdFdede
eddfdd�Zedefdd��Zejdeddfdd��Zedefdd��Zedefdd��Zdefdd�Zdefd d!�Zedeeeffd"d#��Zdefd$d%�Zd&edefd'd(�Zd)edefd*d+�Zd,ededefd-d.�Z d,ededefd/d0�Z!d,ededefd1d2�Z"d,ededefd3d4�Z#d,ededefd5d6�Z$d,ed7edefd8d9�Z%d,ed7edefd:d;�Z&d,ededefd<d=�Z'd>e(eefdefd?d@�Z)	dGd>e*de
edefdAdB�Z+	dGdCe,e-de
ede.e-fdDdE�Z/dS)H�	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).
    z8
        (?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*z\s*$Z
compatibleZequalZ	not_equalZless_than_equalZgreater_than_equalZ	less_thanZgreater_thanZ	arbitrary)�~=�==z!=�<=�>=�<�>�===�N�specr%rcCsH|j�|�}|std|�d���|�d���|�d���f|_||_dS)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�searchr�group�strip�_spec�_prereleases)rr>r%�matchrrr�__init__�s
�
zSpecifier.__init__cCsR|jdur|jS|j\}}|dvr'|dkr |�d�r |dd�}t|�jr'dSdS)N)r7r9r8r6r<r7�.*���TF)rFrE�endswithr�
is_prerelease)rr@rrrrr%�s


zSpecifier.prereleasesr&cC�
||_dSr�rFr'rrrr%�
cC�
|jdS)z`The operator of this specifier.

        >>> Specifier("==1.2.3").operator
        '=='
        r�rErrrrr@�
zSpecifier.operatorcCrP)zaThe version of this specifier.

        >>> Specifier("==1.2.3").version
        '1.2.3'
        r
rQrrrrrrRzSpecifier.versioncCs8|jdurd|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)>
        N�, prereleases=r=r:�(�)>)rFr%�	__class__rr.�rZprerrr�__repr__$s

��zSpecifier.__repr__cCs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{}{})�formatrErrrrr6szSpecifier.__str__cCs*t|jd|jddkd�}|jd|fS)Nr
rr6�Zstrip_trailing_zero)rrE)rZcanonical_versionrrr�_canonical_spec@s
�zSpecifier._canonical_speccC�
t|j�Sr)�hashr[rrrrr!H�
zSpecifier.__hash__r"cCsPt|t�rz	|�t|��}WntytYSwt||j�s"tS|j|jkS)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.rVr�NotImplementedr[r#rrrr$Ks
�zSpecifier.__eq__�opcCst|d|j|���}|S)NZ	_compare_)�getattr�
_operators)rr`�operator_callablerrr�
_get_operatorhs�zSpecifier._get_operator�prospectivecCsHttt�tt|���dd��}|d7}|�d�||�o#|�d�||�S)N���rIr9r7)�
_version_join�list�	itertools�	takewhile�_is_not_suffix�_version_splitrd)rrer>�prefixrrr�_compare_compatiblens
��zSpecifier._compare_compatiblecCs�|�d�r1t|jdd�}t|dd�dd�}t|�}t|�}t||�\}}|dt|��}	|	|kSt|�}
|
js=t|j�}||
kS)NrIFrZrJ)rKr�publicrl�_pad_version�lenr�local)rrer>Znormalized_prospectiveZnormalized_specZ
split_specZsplit_prospectiveZpadded_prospective�_Zshortened_prospectiveZspec_versionrrr�_compare_equal�s
�
zSpecifier._compare_equalcCs|�||�Sr)rt�rrer>rrr�_compare_not_equal�szSpecifier._compare_not_equalcCst|j�t|�kSr�rrorurrr�_compare_less_than_equal��z"Specifier._compare_less_than_equalcCst|j�t|�kSrrwrurrr�_compare_greater_than_equal�ryz%Specifier._compare_greater_than_equal�spec_strcCs<t|�}||ks
dS|js|jrt|j�t|j�krdSdS�NFT)rrL�base_version�rrer{r>rrr�_compare_less_than�szSpecifier._compare_less_thancCs^t|�}||ks
dS|js|jrt|j�t|j�krdS|jdur-t|j�t|j�kr-dSdSr|)rZis_postreleaser}rrr~rrr�_compare_greater_than�s
zSpecifier._compare_greater_thancCst|���t|���kSr)r.�lowerrurrr�_compare_arbitrary�szSpecifier._compare_arbitraryr(cC�
|�|�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")
        False
        >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
        True
        �r)�rr(rrr�__contains__��
zSpecifier.__contains__cCs<|dur|j}t|�}|jr|sdS|�|j�}|||j�S)alReturn 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 uses :attr:`prereleases` to determine
            whether or not prereleases are allowed.

        >>> 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")
        False
        >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1")
        True
        >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True)
        True
        NF)r%rrLrdr@r)rr(r%Znormalized_itemrcrrrr)
s
zSpecifier.containsr*ccs��d}g}d|dur|ndi}|D]"}t|�}|j|fi|��r3|jr.|s.|js.|�|�qd}|Vq|s@|rB|D]	}|Vq:dSdSdS)aOFilter 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 be intelligently decide whether to allow
            prereleases or not (based on the :attr:`prereleases` attribute, and
            whether the only versions matching are prereleases).

        This method is smarter than just ``filter(Specifier().contains, [...])``
        because it implements the rule from :pep:`440` that a prerelease item
        SHOULD be accepted if no other versions match the given specifier.

        >>> 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']
        Fr%NT)rr)rLr%�append)rr*r%�yielded�found_prereleases�kwr�parsed_versionrrrr+;s*�����zSpecifier.filter�r=Nr)0rrrrZ_operator_regex_strZ_version_regex_str�re�compile�VERBOSE�
IGNORECASErArbr.rr1rHr2r%r3r@rrXrrr[r/r!r0r$�CallableOperatorrdrrnrtrvrxrzrr�r�r	r��UnparsedVersionr)rr
rr+rrrrr5ast	^
��
)���
�/����r5z^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCs^g}|�d�\}}}|�|pd�|�d�D]}t�|�}|r'|�|���q|�|�q|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_regexrB�extend�groups)r�result�epochrs�restr(rGrrrrl|s
rl�
componentscCs|^}}|�dd�|���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)r�r�r�rrrrg�srg�segmentcst�fdd�dD��S)Nc3s�|]}��|�VqdSr)�
startswith)�.0rm�r�rr�	<genexpr>�s�

�z!_is_not_suffix.<locals>.<genexpr>)�dev�a�b�rcZpost)�anyr�rr�rrk�s
�rk�left�rightc
Cs�gg}}|�tt�dd�|���|�tt�dd�|���|�|t|d�d��|�|t|d�d��|�ddgtdt|d�t|d���|�ddgtdt|d�t|d���ttj�|��ttj�|��fS)NcS�|��Sr��isdigit��xrrr�<lambda>��z_pad_version.<locals>.<lambda>cSr�rr�r�rrrr��r�rr
r�)	r�rhrirjrq�insert�max�chain�
from_iterable)r�r�Z
left_splitZright_splitrrrrp�s
,,�rpc	@s2eZdZdZ	d%dedeeddfdd�Zedeefd	d
��Z	e	j
deddfdd
��Z	defd
d�Zdefdd�Zde
fdd�Zdedefddfdd�Zdedefdd�Zde
fdd�Zdeefdd�Zdedefdd�Z		d&dedeedeedefd d!�Z	d'd"eedeedeefd#d$�ZdS)(�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.
    r=N�
specifiersr%rcCs.dd�|�d�D�}ttt|��|_||_dS)aNInitialize 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.
        :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.
        cSsg|]
}|��r|���qSr)rD�r��srrr�
<listcomp>�sz)SpecifierSet.__init__.<locals>.<listcomp>�,N)r��	frozenset�mapr5�_specsrF)rr�r%Zsplit_specifiersrrrrH�s
zSpecifierSet.__init__cCs.|jdur|jS|js
dStdd�|jD��S)Ncss�|]}|jVqdSr�r%r�rrrr��s�z+SpecifierSet.prereleases.<locals>.<genexpr>)rFr�r�rrrrr%�s

zSpecifierSet.prereleasesr&cCrMrrNr'rrrr%�rOcCs.|jdurd|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)>
        NrSr=z<SpecifierSet(rU)rFr%r.rWrrrrX�s

��zSpecifierSet.__repr__cCsd�tdd�|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'
        r�css�|]}t|�VqdSr)r.r�rrrr�s�z'SpecifierSet.__str__.<locals>.<genexpr>)r��sortedr�rrrrrszSpecifierSet.__str__cCr\r)r]r�rrrrr!r^zSpecifierSet.__hash__r"cCs�t|t�r
t|�}nt|t�stSt�}t|j|jB�|_|jdur-|jdur-|j|_|S|jdur=|jdur=|j|_|S|j|jkrI|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')>
        NzFCannot combine SpecifierSets with True and False prerelease overrides.)rr.r�r_r�r�rF�
ValueError)rr"Z	specifierrrr�__and__s$



�	���zSpecifierSet.__and__cCs6t|ttf�rtt|��}nt|t�stS|j|jkS)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.r5r�r_r�r#rrrr$6s

zSpecifierSet.__eq__cCr\)z7Returns the number of specifiers in this specifier set.)rqr�rrrr�__len__PrOzSpecifierSet.__len__cCr\)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')>]
        )�iterr�rrrr�__iter__Ts
zSpecifierSet.__iter__r(cCr�)arReturn 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")
        False
        >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)
        True
        r�r�rrrr�^r�zSpecifierSet.__contains__�	installedcs\t�t�s	t����dur|j��s�jrdS|r!�jr!t�j��t��fdd�|jD��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 uses :attr:`prereleases` to determine
            whether or not prereleases are allowed.

        >>> 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")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1")
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True)
        True
        NFc3s�|]
}|j��d�VqdS)r�Nr�r��r(r%rrr��s�z(SpecifierSet.contains.<locals>.<genexpr>)rrr%rLr}�allr�)rr(r%r�rr�rr)ss



zSpecifierSet.containsr*cCs�|dur|j}|jr|jD]}|j|t|�d�}q
t|�Sg}g}|D]}t|�}|jr6|s6|s5|�|�q#|�|�q#|sH|rH|durHt|�St|�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 be intelligently decide whether to allow
            prereleases or not (based on the :attr:`prereleases` attribute, and
            whether the only versions matching are prereleases).

        This method is smarter than just ``filter(SpecifierSet(...).contains, [...])``
        because it implements the rule from :pep:`440` that a prerelease item
        SHOULD be accepted if no other versions match the given specifier.

        >>> 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"]))
        []
        >>> 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']
        Nr�)r%r�r+r1r�rrLr�)rr*r%r>�filteredr�r(r�rrrr+�s$,


�zSpecifierSet.filterr�)NNr)rrrrr.rr1rHr2r%r3rXrr/r!r	r�r0r$r�rr5r�r�r�r)rr
r+rrrrr��sR���
�
 
����
�:����r�)#rr,rir��typingrrrrrrrr	�utilsrrrr.r�r
r1r�rr�r�ABCMetarr5r�r�rlrgrkrpr�rrrr�<module>s0(7
.