HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/packaging/__pycache__/specifiers.cpython-37.pyc
B

�P�e&��@s8dZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZe
eefZeded�ZeeegefZeed	�d
d�ZGdd
�d
e�ZGdd�dejd�ZGdd�de�Ze�d�Zeeed	�dd�Zeed�dd�Z eeeeeeeeefd�dd�Z!Gdd�de�Z"dS)z�
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
�N)	�Callable�Iterable�Iterator�List�Optional�Set�Tuple�TypeVar�Union�)�canonicalize_version)�Version�UnparsedVersionVar)�bound)�version�returncCst|t�st|�}|S)N)�
isinstancer
)r�r�E/opt/alt/python37/lib/python3.7/site-packages/packaging/specifiers.py�_coerce_version"s
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__rrrrr(s	rc@s�eZdZejed�dd��Zejed�dd��Zeje	e
d�dd��Zeeje
e
d�d	d
���Zeje
dd�d
d
��Zejdee
e
e
d�dd��Zejdeee
e
eed�dd��ZdS)�
BaseSpecifier)rcCsdS)z�
        Returns the str representation of this Specifier-like object. This
        should be representative of the Specifier itself.
        Nr)�selfrrr�__str__5szBaseSpecifier.__str__cCsdS)zF
        Returns a hash value for this Specifier-like object.
        Nr)rrrr�__hash__<szBaseSpecifier.__hash__)�otherrcCsdS)z�
        Returns a boolean representing whether or not the two Specifier-like
        objects are equal.

        :param other: The other object to check against.
        Nr)rrrrr�__eq__BszBaseSpecifier.__eq__cCsdS)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)rrrr�prereleasesKszBaseSpecifier.prereleasesN)�valuercCsdS)zQSetter for :attr:`prereleases`.

        :param value: The value to set.
        Nr)rr"rrrr!Ts)�itemr!rcCsdS)zR
        Determines if the given item is contained within this specifier.
        Nr)rr#r!rrr�contains[szBaseSpecifier.contains)�iterabler!rcCsdS)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�filteraszBaseSpecifier.filter)N)N)rrr�abc�abstractmethod�strr�intr�object�boolr �propertyrr!�setterr$rrrr&rrrrr4s r)�	metaclassc	@s�eZdZdZdZdZe�deedejej	B�Z
dddd	d
ddd
d�ZdFee
edd�dd�Zeed�dd��Zejedd�dd��Zeed�dd��Zeed�dd��Zed�dd�Zed�dd �Zeeeefd�d!d"��Zed�d#d$�Zeed%�d&d'�Zeed(�d)d*�Zeeed+�d,d-�Z eeed+�d.d/�Z!eeed+�d0d1�Z"eeed+�d2d3�Z#eeed+�d4d5�Z$eeed6�d7d8�Z%eeed6�d9d:�Z&eeed+�d;d<�Z'e(eefed=�d>d?�Z)dGe*e
eed@�dAdB�Z+dHe,e-e
ee.e-dC�dDdE�Z/dS)I�	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*$�
compatible�equal�	not_equal�less_than_equal�greater_than_equal�	less_than�greater_than�	arbitrary)z~=z==z!=z<=z>=�<�>z===�N)�specr!rcCsH|j�|�}|s td|�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__)rcCsR|jdk	r|jS|j\}}|dkrN|dkr@|�d�r@|dd�}t|�jrNdSdS)N)z==z>=z<=z~=z===z==z.*���TF)rDrC�endswithr
�
is_prerelease)rr>rrrrr!s


zSpecifier.prereleases)r"rcCs
||_dS)N)rD)rr"rrrr!scCs
|jdS)z`The operator of this specifier.

        >>> Specifier("==1.2.3").operator
        '=='
        r)rC)rrrrr>szSpecifier.operatorcCs
|jdS)zaThe version of this specifier.

        >>> Specifier("==1.2.3").version
        '1.2.3'
        r)rC)rrrrr%szSpecifier.versioncCs8|jdk	rd|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)>
        Nz, prereleases=r;r9�(z)>)rDr!�	__class__rr))r�prerrr�__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{}{})�formatrC)rrrrr@szSpecifier.__str__cCs*t|jd|jddkd�}|jd|fS)Nrrz~=)�strip_trailing_zero)rrC)rZcanonical_versionrrr�_canonical_specJszSpecifier._canonical_speccCs
t|j�S)N)�hashrP)rrrrrRszSpecifier.__hash__)rrcCsPt|t�r4y|�t|��}WqDtk
r0tSXnt||j�sDtS|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)rKr�NotImplementedrP)rrrrrr Us
zSpecifier.__eq__)�oprcCst|d|j|���}|S)N�	_compare_)�getattr�
_operators)rrS�operator_callablerrr�
_get_operatorrszSpecifier._get_operator)�prospectiver<rcCsJd�tt�tt|���dd��}|d7}|�d�||�oH|�d�||�S)N�.���z.*z>=z==)�join�list�	itertools�	takewhile�_is_not_suffix�_version_splitrX)rrYr<�prefixrrr�_compare_compatiblexs

zSpecifier._compare_compatiblecCs�|�d�rbt|jdd�}t|dd�dd�}t|�}t|�}t||�\}}|dt|��}	|	|kSt|�}
|
jszt|j�}||
kSdS)Nz.*F)rOrG)rHr�publicra�_pad_version�lenr
�local)rrYr<Znormalized_prospectiveZnormalized_spec�
split_spec�split_prospective�padded_prospective�_�shortened_prospective�spec_versionrrr�_compare_equal�s

zSpecifier._compare_equalcCs|�||�S)N)rn)rrYr<rrr�_compare_not_equal�szSpecifier._compare_not_equalcCst|j�t|�kS)N)r
rd)rrYr<rrr�_compare_less_than_equal�sz"Specifier._compare_less_than_equalcCst|j�t|�kS)N)r
rd)rrYr<rrr�_compare_greater_than_equal�sz%Specifier._compare_greater_than_equal)rY�spec_strrcCs<t|�}||ksdS|js8|jr8t|j�t|j�kr8dSdS)NFT)r
rI�base_version)rrYrrr<rrr�_compare_less_than�szSpecifier._compare_less_thancCs^t|�}||ksdS|js8|jr8t|j�t|j�kr8dS|jdk	rZt|j�t|j�krZdSdS)NFT)r
�is_postreleasersrg)rrYrrr<rrr�_compare_greater_than�s
zSpecifier._compare_greater_thancCst|���t|���kS)N)r)�lower)rrYr<rrr�_compare_arbitrary�szSpecifier._compare_arbitrary)r#rcCs
|�|�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__szSpecifier.__contains__)r#r!rcCs<|dkr|j}t|�}|jr$|s$dS|�|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!rrIrXr>r)rr#r!�normalized_itemrWrrrr$s
zSpecifier.contains)r%r!rccs�d}g}d|dk	r|ndi}xH|D]@}t|�}|j|f|�r"|jrX|sX|jsX|�|�q"d}|Vq"W|s�|r�x|D]
}|VqtWdS)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$rIr!�append)rr%r!�yielded�found_prereleases�kwr�parsed_versionrrrr&Es



zSpecifier.filter)r;N)N)N)0rrrrZ_operator_regex_strZ_version_regex_str�re�compile�VERBOSE�
IGNORECASEr?rVr)rr,rFr-r!r.r>rrMrrrPr*rr+r �CallableOperatorrXr
rcrnrorprqrtrvrxr
ry�UnparsedVersionr$rrrr&rrrrr0ksV]
)
-r0z^([0-9]+)((?:a|b|c|rc)[0-9]+)$cCsDg}x:|�d�D],}t�|�}|r2|�|���q|�|�qW|S)NrZ)�split�
_prefix_regexr@�extend�groupsr{)r�resultr#rErrrra�s
ra)�segmentrcst�fdd�dD��S)Nc3s|]}��|�VqdS)N)�
startswith)�.0rb)r�rr�	<genexpr>�sz!_is_not_suffix.<locals>.<genexpr>)�dev�a�b�rc�post)�any)r�r)r�rr`�sr`)�left�rightrc
Cs�gg}}|�tt�dd�|���|�tt�dd�|���|�|t|d�d��|�|t|d�d��|�ddgtdt|d�t|d���|�ddgtdt|d�t|d���ttj|��ttj|��fS)NcSs|��S)N)�isdigit)�xrrr�<lambda>��z_pad_version.<locals>.<lambda>cSs|��S)N)r�)r�rrrr��r�rr�0)r{r]r^r_rf�insert�max�chain)r�r��
left_split�right_splitrrrre�s
,,rec@seZdZdZd$eeedd�dd�Zeeed�dd	��Z	e	j
edd
�dd	��Z	ed�dd
�Zed�dd�Ze
d�dd�Zedefdd�dd�Zeed�dd�Ze
d�dd�Zeed�dd�Zeed�dd�Zd%eeeeeed�dd �Zd&eeeeeed!�d"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!rcCsJdd�|�d�D�}t�}x|D]}|�t|��q Wt|�|_||_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)rB)r��srrr�
<listcomp>�sz)SpecifierSet.__init__.<locals>.<listcomp>�,N)r��set�addr0�	frozenset�_specsrD)rr�r!�split_specifiers�parsed�	specifierrrrrF�s

zSpecifierSet.__init__)rcCs.|jdk	r|jS|jsdStdd�|jD��S)Ncss|]}|jVqdS)N)r!)r�r�rrrr��sz+SpecifierSet.prereleases.<locals>.<genexpr>)rDr�r�)rrrrr!�s

zSpecifierSet.prereleases)r"rcCs
||_dS)N)rD)rr"rrrr!�scCs.|jdk	rd|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)>
        Nz, prereleases=r;z<SpecifierSet(z)>)rDr!r))rrLrrrrM�szSpecifierSet.__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|�VqdS)N)r))r�r�rrrr�sz'SpecifierSet.__str__.<locals>.<genexpr>)r\�sortedr�)rrrrr�szSpecifierSet.__str__cCs
t|j�S)N)rQr�)rrrrr
szSpecifierSet.__hash__)rrcCs�t|t�rt|�}nt|t�s"tSt�}t|j|jB�|_|jdkrX|jdk	rX|j|_n<|jdk	rv|jdkrv|j|_n|j|jkr�|j|_ntd��|S)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�rRr�r�rD�
ValueError)rrr�rrr�__and__
s






zSpecifierSet.__and__cCs6t|ttf�rtt|��}nt|t�s*tS|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)r0r�rRr�)rrrrrr -s

zSpecifierSet.__eq__cCs
t|j�S)z7Returns the number of specifiers in this specifier set.)rfr�)rrrr�__len__GszSpecifierSet.__len__cCs
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')>]
        )�iterr�)rrrr�__iter__KszSpecifierSet.__iter__)r#rcCs
|�|�S)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$)rr#rrrryUszSpecifierSet.__contains__)r#r!�	installedrcs\t�t�st����dkr |j��s.�jr.dS|rB�jrBt�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!N)r$)r�r�)r#r!rrr��sz(SpecifierSet.contains.<locals>.<genexpr>)rr
r!rIrs�allr�)rr#r!r�r)r#r!rr$js



zSpecifierSet.contains)r%r!rcCs�|dkr|j}|jr>x |jD]}|j|t|�d�}qWt|�Sg}g}x8|D]0}t|�}|jrr|sr|s||�|�qL|�|�qLW|s�|r�|dkr�t|�St|�SdS)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']
        N)r!)r!r�r&r,r�rrIr{)rr%r!r<�filteredr}r#rrrrr&�s",

zSpecifierSet.filter)r;N)NN)N)rrrrr)rr,rFr-r!r.rMrr*rr
r�r+r r�rr0r�r�ryr$rrr&rrrrr��s(
!
 
5r�)#rr'r^r��typingrrrrrrrr	r
�utilsrrr
r)r�rr,r�rr�r�ABCMetarr0r�r�rar`rer�rrrr�<module>	s,,7
*