
    j>                    4   U d Z ddlmZ ddlZddlZddlZddlmZmZmZm	Z	m
Z
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ er2ddlZdd	lmZmZmZ ej        d
k    rddlm Z  nddl!m Z  ddl"m#Z# ddlm$Z$ g dZ%d6dZ&d7dZ'd8dZ( e
d          Z)eee*f         Z+ e
de+          Z,ej-        ej.        ej/        ej0        dZ1de2d<   d9d$Z3 G d% d&e4          Z5 G d' d(ej6        )          Z7 G d* d e7          Z8d:d1Z9 G d2 d3e7          Z:d;d5Z;dS )<z
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
    )annotationsN)TYPE_CHECKINGAnyCallableFinalTypeVarUnion   )	
FULL_RANGEbounds_for_speccoerce_versionfilter_by_rangesintersect_specifier_boundsmatches_bounds_onlyranges_are_prerelease_onlyresolve_prereleasestrim_release)canonicalize_version)Version)IterableIteratorSequence)   
   )	TypeGuard)ranges)Interval)BaseSpecifierInvalidSpecifier	SpecifierSpecifierSetreturn	list[str]c                     t           S N)__all__     S/var/www/html/python-test/venv/lib/python3.11/site-packages/packaging/specifiers.py__dir__r*   <   s    Nr(   specobjectTypeGuard[tuple[str, str]]c                   t          | t                    oHt          |           dk    o5t          | d         t                    ot          | d         t                    S )N   r   r
   )
isinstancetuplelenstr)r+   s    r)   _validate_specr4   @   sT    4 	%IIN	%tAw$$	% tAw$$	r(   preTypeGuard[bool | None]c               4    | d u pt          | t                    S r%   )r0   bool)r5   s    r)   _validate_prer9   I   s    $;/*S$///r(   TUnparsedVersionVar)bound)>=<===!=z-dict[str, Callable[[Version, Version], bool]]_DIRECT_COMPARE_OPS	specifierr    parsedr   bool | Nonec                   | j         \  }}|                    d          s|j        dS t                              |          }| |||                     |                    S |dv rc|                     |          }|j        |j        k    s*t          |j                  t          |j                  k    r|dk    r||k     n||k    S dS dS )a!  Match ``parsed`` against ``specifier`` without building a range.

    Handles ``>=``, ``<=``, ``==``, ``!=``, ``<``, ``>`` when the spec is
    not a wildcard and ``parsed`` has no local. Returns ``None`` when the
    range path must be used. Pre-release policy is left to the caller.
    .*N)<>rG   )	_specendswithlocalrA   get_require_spec_versionepochr   release)rB   rC   op_strver_strdirect_comparespec_vs         r)   _fast_matchrT   ]   s      oOFG !9t(,,V44N!~fi&E&Eg&N&NOOO0099 <6<''<+G+G<NL
 L
 ,
 ,
 '-mm6F??&Ht4r(   c                      e Zd ZdZdS )r   a  
    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__r'   r(   r)   r   r   z   s           r(   r   c                     e Zd ZdZdZdZed%d            Zej	        d%d            Z
ej	        d&d	            Zej	        d'd            Zeej	        d(d                        Zej        d)d            Zej	        d*d+d            Zej        	 	 d,d-d            Zej        	 	 d,d.d             Zej	        	 	 d/d0d$            ZdS )1r   zO
    Abstract base class for :class:`Specifier` and :class:`SpecifierSet`.
    r'   )_strr"   r3   c                     t          |           S )z Internal property for match_argsr3   selfs    r)   r[   zBaseSpecifier._str   s     4yyr(   c                    dS )z
        Returns the str representation of this Specifier-like object. This
        should be representative of the Specifier itself.
        Nr'   r^   s    r)   __str__zBaseSpecifier.__str__         r(   intc                    dS )zF
        Returns a hash value for this Specifier-like object.
        Nr'   r^   s    r)   __hash__zBaseSpecifier.__hash__   rb   r(   otherr,   r8   c                    dS )z
        Returns a boolean representing whether or not the two Specifier-like
        objects are equal.

        :param other: The other object to check against.
        Nr'   r_   rf   s     r)   __eq__zBaseSpecifier.__eq__   rb   r(   rD   c                    dS )zWhether 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)   prereleaseszBaseSpecifier.prereleases   rb   r(   valueNonec                    dS )zQSetter for :attr:`prereleases`.

        :param value: The value to set.
        Nr'   r_   rl   s     r)   rk   zBaseSpecifier.prereleases   rb   r(   Nitemrk   c                    dS )zR
        Determines if the given item is contained within this specifier.
        Nr'   )r_   rp   rk   s      r)   containszBaseSpecifier.contains   rb   r(   .iterableIterable[UnparsedVersionVar]keyIterator[UnparsedVersionVar]c                    d S r%   r'   r_   rs   rk   ru   s       r)   filterzBaseSpecifier.filter   	     (+sr(   Iterable[T]Callable[[T], UnparsedVersion]Iterator[T]c                    d S r%   r'   rx   s       r)   ry   zBaseSpecifier.filter   	     cr(   Iterable[Any]'Callable[[Any], UnparsedVersion] | NoneIterator[Any]c                    dS )z
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        Nr'   rx   s       r)   ry   zBaseSpecifier.filter   rb   r(   r"   r3   r"   rc   rf   r,   r"   r8   r"   rD   )rl   r8   r"   rm   r%   )rp   r3   rk   rD   r"   r8   N.rs   rt   rk   rD   ru   rm   r"   rv   rs   r{   rk   rD   ru   r|   r"   r}   NNrs   r   rk   rD   ru   r   r"   r   )rV   rW   rX   rY   	__slots____match_args__propertyr[   abcabstractmethodra   re   ri   rk   setterrr   typingoverloadry   r'   r(   r)   r   r      s         IN   X 	    	   
 	        X     	    
 _ $(	+ + + + _+ _ $(.1	    _ 	 $(7;		 	 	 	 	 	 	r(   r   )	metaclassc            	         e Zd ZU dZdZdZ ej        dez   dz   ej        ej	        z            Z
ddddd	d
dddZded<   dFdGdZdHdZdIdZdJdZedKd             Zej        dLd"            ZdMd$ZdNd'ZedOd(            ZedOd)            ZdOd*ZdOd+ZedPd-            ZdQd/ZdRd2ZdSd5ZdTdUd7Zej         	 	 dVdWd=            Z!ej         	 	 dVdXdA            Z!	 	 dYdZdEZ!dS )[r    a  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).

    Instances are safe to serialize with :mod:`pickle`. They use a stable
    format so the same pickle can be loaded in future packaging releases.

    .. versionchanged:: 26.2

        Added a stable pickle format. Pickles created with packaging 26.2+ can
        be unpickled with future releases.  Backward compatibility with pickles
        from packaging < 26.2 is supported but may be removed in a future
        release.
    )_prereleases_rangesrI   _spec_versiona  
        (?:
            (?:
                # 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 .*
                    |
                    (?a:                                  # pre release
                        [-_\.]?
                        (alpha|beta|preview|pre|a|b|c|rc)
                        [-_\.]?
                        [0-9]*
                    )?
                    (?a:                                  # post release
                        (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                    )?
                    (?a:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
                    (?a:\+[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.
                (?:<=|>=|<|>)

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?a:                   # pre release
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [0-9]*
                )?
                (?a:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?a:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
        )
        z\s*
compatibleequal	not_equalless_than_equalgreater_than_equal	less_thangreater_than	arbitrary)~=r?   r@   r>   r=   rG   rH   ===r   
_operators Nr+   r3   rk   rD   r"   rm   c                   | j                             |          st          d|          |                                }|                    d          r'|dd         |dd                                         }}nb|                    d          r'|dd         |dd                                         }}n&|dd         |dd                                         }}||f| _        || _        d| _        d| _        dS )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).
        zInvalid specifier: r   Nr   )r   r?   r@   r>   r=   r/   r
   )	_regex	fullmatchr   strip
startswithrI   r   r   r   )r_   r+   rk   operatorversions        r)   __init__zSpecifier.__init__c  s    {$$T** 	C"#A#A#ABBBzz||??5!! 	; $RaR$qrr(..*:*:gHH__;<< 	; $RaR$qrr(..*:*:gHH $RaR$qrr(..*:*:gH'/&9
 ( :> 37r(   r   Version | Nonec                    | j         | j         d         |k    r| j         d         S t          |          }|dS ||f| _         |S )zDOne element cache, as only one spec Version is needed per Specifier.Nr   r
   )r   r   )r_   r   version_specifiers      r)   _get_spec_versionzSpecifier._get_spec_version  sX    )d.@.Cw.N.N%a((*733$4%'89  r(   r   c                8    |                      |          }|J |S )zGet 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 ===).
        )r   )r_   r   spec_versions      r)   rM   zSpecifier._require_spec_version  s)     --g66'''r(   Sequence[Interval]c                    | j         | j         S | j        }| j        }|dk    rt          }n9|                     |                    d                    }t          |||          }|| _         |S )zConvert this specifier to sorted, non-overlapping version ranges.

        Each standard operator maps to one or two ranges.  ``===`` is
        modeled as full range (actual check done separately).  Cached.
        Nr   rF   )r   r   r   r   rM   removesuffixr   )r_   oprQ   resultr   s        r)   
_to_rangeszSpecifier._to_ranges  sp     <#<],;;)3FF001E1Ed1K1KLLG$R'::Fr(   c                    | j         | j         S | j        \  }}|dk    rdS |dk    r|                    d          rdS |                     |          }|d S |j        S )Nr@   Fr?   rF   )r   rI   rJ   r   is_prerelease)r_   r   version_strr   s       r)   rk   zSpecifier.prereleases  s     ($$ !%
+t5 t 4 4T : :5 ((55?4 $$r(   rl   c                    || _         d S r%   )r   ro   s     r)   rk   zSpecifier.prereleases  s    !r(   #tuple[tuple[str, str], bool | None]c                    | j         | j        fS r%   )rI   r   r^   s    r)   __getstate__zSpecifier.__getstate__  s     
D-..r(   stater,   c                   d | _         d | _        t          |t                    rt	          |          dk    r3|\  }}t          |          rt          |          r|| _        || _        d S t	          |          dk    ryt          |d         t                    r^|\  }}|
                    d          }|
                    dd          }t          |          rt          |          r|| _        || _        d S t          |t                    rY|
                    d          }|
                    dd          }t          |          rt          |          r|| _        || _        d S t          d|          )Nr/   r
   rI   r   invalidzCannot restore Specifier from )r   r   r0   r1   r2   r4   r9   rI   r   dictrL   	TypeError)r_   r   r+   rk   _	slot_dicts         r)   __setstate__zSpecifier.__setstate__  sp   !eU## 	5zzQ$)!k!$'' M+,F,F !%DJ(3D%F5zzQ:eAh#=#=$9 }}W--'mmNIFF!$'' M+,F,F !%DJ(3D%FeT"" 	99W%%D))NI>>Kd## k(B(B !
$/!BBBCCCr(   c                    | j         d         S )z`The operator of this specifier.

        >>> Specifier("==1.2.3").operator
        '=='
        r   rI   r^   s    r)   r   zSpecifier.operator       z!}r(   c                    | j         d         S )zaThe version of this specifier.

        >>> Specifier("==1.2.3").version
        '1.2.3'
        r
   r   r^   s    r)   r   zSpecifier.version  r   r(   c                l    | j         
d| j        nd}d| j        j         dt	          |           | dS )aT  A 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   rG   ()>r   rk   	__class__rV   r3   r_   r5   s     r)   __repr__zSpecifier.__repr__
  sT      , 2T-111 	 B4>*AASYYA#AAAAr(   c                      dj         | j         S )zA 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{}{})formatrI   r^   s    r)   ra   zSpecifier.__str__  s     v}dj))r(   tuple[str, str]c                    | j         \  }}|dk    s|                    d          r||fS |                     |          }t          ||dk              }||fS )Nr   rF   r   )strip_trailing_zero)rI   rJ   rM   r   )r_   r   r   r   canonical_versions        r)   _canonical_speczSpecifier._canonical_spec&  sw     J'u 0 0 6 6W$$11'::0x4/?
 
 
 ***r(   rc   c                *    t          | j                  S r%   )hashr   r^   s    r)   re   zSpecifier.__hash__4  s    D()))r(   rf   r8   c                    t          |t                    r;	 |                     t          |                    }n3# t          $ r
 t          cY S w xY wt          || j                  st          S | j        |j        k    S )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
        )r0   r3   r   r   NotImplementedr   rh   s     r)   ri   zSpecifier.__eq__7  s    & eS!! 	"&s5zz22# & & &%%%%&E4>22 	"!!#u'<<<s   ": AArp   str | Versionc                ,    |                      |          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
        rr   r_   rp   s     r)   __contains__zSpecifier.__contains__T      & }}T"""r(   UnparsedVersionc                l   | j         d         dk    r2t          t          |                     |g|                              S t	          |          }|dS |t          | j        | j                  }|du r	|j        rdS t          | |          }||S t          |                                 |          S )a'  Return 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:`~packaging.version.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

        .. versionchanged:: 26.0

            With ``prereleases=None``, a prerelease now matches. A single
            version has no alternatives, so the :pep:`440` rule to accept
            prereleases when nothing else satisfies the specifier applies.
            Earlier versions rejected it. An unparsable version now returns
            ``False`` instead of raising :exc:`~packaging.version.InvalidVersion`.
        r   r   rk   NF)rI   r8   listry   r   r   r   rk   r   rT   r   r   )r_   rp   rk   rC   matchs        r)   rr   zSpecifier.containsi  s    D :a=E!!T[[$[[IIJJKKK%%>5-d.?AQRRK%F$85 D&))L"4??#4#4f===r(   .rs   rt   ru   rv   c                    d S r%   r'   rx   s       r)   ry   zSpecifier.filter  rz   r(   r{   r|   r}   c                    d S r%   r'   rx   s       r)   ry   zSpecifier.filter  r   r(   r   r   r   c                   |t          | j        | j                  }| j        dk    r9| j                                        fd|D             }t          ||          S t          |                                 ||          S )a  Filter items in the given iterable, that match the specifier.

        :param iterable:
            An iterable that can contain version strings and
            :class:`~packaging.version.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.
        :param key:
            A callable that takes a single argument (an item from the iterable) and
            returns a version string or :class:`~packaging.version.Version`
            instance to be used for filtering.

        >>> 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']
        >>> list(Specifier(">=1.2.3").filter(
        ... [{"ver": "1.2"}, {"ver": "1.3"}],
        ... key=lambda x: x["ver"]))
        [{'ver': '1.3'}]

        .. versionchanged:: 26.1

            Added the ``key`` parameter.
        Nr   c              3     K   | ]8}t          |n
 |                                                    k    4|V  9d S r%   )r3   lower).0rp   ru   
spec_lowers     r)   	<genexpr>z#Specifier.filter.<locals>.<genexpr>  s^        s{ttD		::@@BBjPP PPPP r(   )	r   r   rk   r   r   r   _apply_prereleases_filterr   r   )r_   rs   rk   ru   matchesr   s      ` @r)   ry   zSpecifier.filter  s    P -d.?AQRRK=E!!++--J    $  G
 -Wc;GGG 1 18S+NNNr(   r   N)r+   r3   rk   rD   r"   rm   )r   r3   r"   r   )r   r3   r"   r   r"   r   r   rl   rD   r"   rm   )r"   r   r   r,   r"   rm   r   )r"   r   r   r   )rp   r   r"   r8   r%   )rp   r   rk   rD   r"   r8   r   r   r   r   r   )"rV   rW   rX   rY   r   _specifier_regex_strrecompileVERBOSE
IGNORECASEr   r   __annotations__r   r   rM   r   r   rk   r   r   r   r   r   r   ra   r   re   ri   r   rr   r   r   ry   r'   r(   r)   r    r       s         &IZx RZ%%.
R]0J F "	 	J 	 	 	 	!7 !7 !7 !7 !7F
! 
! 
! 
!      * % % % X%6 " " " "/ / / /D D D DB    X    XB B B B$* * * * + + + X+* * * *= = = =:# # # #*6> 6> 6> 6> 6>p _ $(	+ + + + _+ _ $(.1	    _ $(7;	4O 4O 4O 4O 4O 4O 4Or(   r   r   ru   r   rk   r   c                j    |t          |           S |rt          |           S fd| D             S )zApply ``prereleases=`` handling to an already-matched iterable.

    ``None`` means PEP 440 default (buffer pre-releases until a final
    appears); ``True`` yields everything; ``False`` drops pre-releases.
    Nc              3  f   K   | ]+}t          |n
 |                    xj        '|V  ,d S r%   )r   r   )r   rp   ru   rC   s     r)   r   z,_apply_prereleases_filter.<locals>.<genexpr>  s^        $S[TTcc$iiHHHFQ# R 	QQQQ r(   )_pep440_filter_prereleasesiter)r   ru   rk   rC   s    ` @r)   r   r     s`     )'3777 G}}       r(   c                  b   e Zd ZdZdZ	 	 d@dAdZdBdZedCd            Zej	        dDd            ZdEdZ
dFdZdGdZdGdZdHdZdIdZdJdZdHd ZdKd"ZdLd$ZdMd%ZdMd&ZdNd(ZdOd)ZdPd*ZdPd+ZdPd,ZdQd/Z	 	 dRdSd1Zej        	 	 dTdUd7            Zej        	 	 dTdVd;            Z	 	 dRdWd?ZdS )Xr!   a  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.

    Instances are safe to serialize with :mod:`pickle`. They use a stable
    format so the same pickle can be loaded in future packaging
    releases.

    .. versionchanged:: 26.2

        Added a stable pickle format. Pickles created with
        packaging 26.2+ can be unpickled with future releases.
        Backward compatibility with pickles from
        packaging < 26.2 is supported but may be removed in a future
        release.
    )_canonicalized_has_arbitrary_is_unsatisfiabler   r   _specsr   N
specifiersstr | Iterable[Specifier]rk   rD   r"   rm   c                   t          |t                    rPd |                    d          D             }t          t	          t
          |                    | _        d|v | _        n7t          |          | _        t          d | j        D                       | _        t          | j                  dk    | _
        d| _        d| _        || _        dS )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.
        c                ^    g | ]*}|                                 |                                 +S r'   )r   r   ss     r)   
<listcomp>z)SpecifierSet.__init__.<locals>.<listcomp>3  s-    VVVaAGGIIV		VVVr(   ,r   c              3  8   K   | ]}d t          |          v V  dS r   Nr]   r  s     r)   r   z(SpecifierSet.__init__.<locals>.<genexpr><  s,      %K%K!es1vvo%K%K%K%K%K%Kr(   r
   N)r0   r3   splitr1   mapr    r  r  anyr2   r  r  r   r   )r_   r  rk   split_specifierss       r)   r   zSpecifierSet.__init__  s    , j#&& 	L  WV:3C3CC3H3HVVV16s9FV7W7W1X1XDK"':"5D
++DK #&%K%Kt{%K%K%K"K"KD!$+..!3.226 (r(   tuple[Specifier, ...]c                    | j         sLt          t                              t	          | j        t                                        | _        d| _         | j        S )zBDeduplicate, sort, and cache specs for order-sensitive operations.ru   T)r  r1   r   fromkeyssortedr  r3   r^   s    r)   _canonical_specszSpecifierSet._canonical_specsF  sG    " 	'fT[c.J.J.J K KLLDK"&D{r(   c                t    | j         | j         S | j        sd S t          d | j        D                       rdS d S )Nc              3  $   K   | ]}|j         V  d S r%   r   r  s     r)   r   z+SpecifierSet.prereleases.<locals>.<genexpr>\  s$      22q}222222r(   T)r   r  r  r^   s    r)   rk   zSpecifierSet.prereleasesM  sT     ($$
 { 	4 22dk22222 	4tr(   rl   c                "    || _         d | _        d S r%   )r   r  ro   s     r)   rk   zSpecifierSet.prereleasesa  s    !!%r(   )tuple[tuple[Specifier, ...], bool | None]c                    | j         | j        fS r%   )r  r   r^   s    r)   r   zSpecifierSet.__getstate__f  s     T.//r(   r   r,   c                   d | _         d | _        t          |t                    rt	          |          dk    r|\  }}t          |t                    rnt          d |D                       rUt          |          rF|| _        || _        t	          |          dk    | _	        t          d |D                       | _        d S t	          |          dk    rt          |d         t                    r|\  }}|                    dd          }|                    d          }t          |t                    r#t          t          |t                               }t          |t                    rxt          d	 |D                       r_t          |          rP|| _        || _        t	          | j                  dk    | _	        t          d
 | j        D                       | _        d S t          |t                    r|                    dd          }|                    d          }t          |t                    r#t          t          |t                               }t          |t                    rxt          d |D                       r_t          |          rP|| _        || _        t	          | j                  dk    | _	        t          d | j        D                       | _        d S t#          d|          )Nr/   c              3  @   K   | ]}t          |t                    V  d S r%   r0   r    r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>w  ,      DDJq)44DDDDDDr(   r
   c              3  8   K   | ]}d t          |          v V  dS r  r]   r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>}  s,      -M-M!es1vvo-M-M-M-M-M-Mr(   r  r'   r   r  c              3  @   K   | ]}t          |t                    V  d S r%   r#  r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>  r$  r(   c              3  8   K   | ]}d t          |          v V  dS r  r]   r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>  s,      -S-S!es1vvo-S-S-S-S-S-Sr(   c              3  @   K   | ]}t          |t                    V  d S r%   r#  r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>  s,      @@Q
1i00@@@@@@r(   c              3  8   K   | ]}d t          |          v V  dS r  r]   r  s     r)   r   z,SpecifierSet.__setstate__.<locals>.<genexpr>  s,      )O)Oa%3q66/)O)O)O)O)O)Or(   z!Cannot restore SpecifierSet from )r   r  r0   r1   r2   allr9   r  r   r  r  r  r   rL   	frozensetr  r3   r   )r_   r   specsrk   r   r   s         r)   r   zSpecifierSet.__setstate__l  s   !%eU## 	5zzQ%*"{ue,,	DDeDDDDD	 &k22	
 #(DK(3D%*-e**/D'*--M-Mu-M-M-M*M*MD'F5zzQ:eAh#=#=$9!h33'mmN;;eY// :!&C"8"8"899Eue,,	DDeDDDDD	 &k22	
 #(DK(3D%*-dk*:*:a*?D'*--S-St{-S-S-S*S*SD'FeT"" 	IIh++E))N33K%++ 6fU444555%((	@@%@@@@@	 "+..	
 $$/!&)$+&6&6!&;#&))O)O4;)O)O)O&O&O#EEEEFFFr(   r3   c                l    | j         
d| j        nd}d| j        j         dt	          |           | dS )a  A 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)>
        Nr   r   rG   r   r   r   r   s     r)   r   zSpecifierSet.__repr__  sT      , 2T-111 	 B4>*AASYYA#AAAAr(   c                d    d                     d |                                 D                       S )an  A 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  c              3  4   K   | ]}t          |          V  d S r%   r]   r  s     r)   r   z'SpecifierSet.__str__.<locals>.<genexpr>  s(      @@1A@@@@@@r(   )joinr  r^   s    r)   ra   zSpecifierSet.__str__  s1     xx@@(=(=(?(?@@@@@@r(   rc   c                D    t          |                                           S r%   )r   r  r^   s    r)   re   zSpecifierSet.__hash__  s    D))++,,,r(   rf   SpecifierSet | strc                   t          |t                    rt          |          }nt          |t                    st          S t                      }| j        |j        z   |_        t          |j                  dk    |_        | j        p|j        |_        | j        | j        |j        k    r|j        |_        n#|j        | j        |_        nt          d          |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')>
        r
   NzFCannot combine SpecifierSets with True and False prerelease overrides.)
r0   r3   r!   r   r  r2   r  r  r   
ValueError)r_   rf   rB   s      r)   __and__zSpecifierSet.__and__  s     eS!! 	" ''EEE<00 	"!! NN	;5	#&y'7#8#8A#=	 #'#6#N%:N	  $(9U=O(O(O%*%7I""'%)%6I""X   r(   r8   c                    t          |t          t          f          rt          t          |                    }nt          |t                    st          S |                                 |                                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
        )r0   r3   r    r!   r   r  rh   s     r)   ri   zSpecifierSet.__eq__  sk    & ec9-.. 	" U,,EEE<00 	"!!$$&&%*@*@*B*BBBr(   c                *    t          | j                  S )z7Returns the number of specifiers in this specifier set.)r2   r  r^   s    r)   __len__zSpecifierSet.__len__  s    4;r(   Iterator[Specifier]c                *    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')>]
        )r  r  r^   s    r)   __iter__zSpecifierSet.__iter__  s     DK   r(   r   c                r    | j         | j         S t          d | j        D                       | _         | j         S )zIntersect all specifiers into a single sequence of version ranges.

        Empty when unsatisfiable. Callers must ensure ``self._specs``
        is non-empty.
        Nc              3  >   K   | ]}|                                 V  d S r%   )r   r  s     r)   r   z+SpecifierSet._get_ranges.<locals>.<genexpr>  s*      1V1VQ!,,..1V1V1V1V1V1Vr(   )r   r   r  r^   s    r)   _get_rangeszSpecifierSet._get_ranges  s<     <#<11V1V$+1V1V1VVV|r(   c                    | j         }||S | j        s	d| _         dS |                                  }|s|                                 }|s*| j        du r!t          |                                           }|| _         |S )a  Check whether this specifier set can never be satisfied.

        Returns True if no version can satisfy all specifiers simultaneously.

        >>> SpecifierSet(">=2.0,<1.0").is_unsatisfiable()
        True
        >>> SpecifierSet(">=1.0,<2.0").is_unsatisfiable()
        False
        >>> SpecifierSet("").is_unsatisfiable()
        False
        >>> SpecifierSet("==1.0,!=1.0").is_unsatisfiable()
        True

        .. versionadded:: 26.1
        NF)r  r  r>  _check_arbitrary_unsatisfiablerk   r   )r_   cachedr   s      r)   is_unsatisfiablezSpecifierSet.is_unsatisfiable  s      'M{ 	%*D"5%%''' 	;88::F 	D$*e33/0@0@0B0BCCF!'r(   c                ~   d | j         D             }|sdS |d         j                                        t          fd|dd         D                       rdS t	          |d         j                  | j        du r	j        rdS d | j         D             }|sdS dS t          fd	|D                        S )
a  Check === (arbitrary equality) specs for unsatisfiability.

        === uses case-insensitive string comparison, so the only candidate
        that can match ``===V`` is the literal string V.  This method
        checks whether that candidate is excluded by other specifiers.
        c                (    g | ]}|j         d k    |S r   r   r  s     r)   r  z?SpecifierSet._check_arbitrary_unsatisfiable.<locals>.<listcomp>H  s$    CCC1qzU/B/BQ/B/B/Br(   Fr   c              3  R   K   | ]!}|j                                         k    V  "d S r%   )r   r   )r   r  firsts     r)   r   z>SpecifierSet._check_arbitrary_unsatisfiable.<locals>.<genexpr>N  s4      AAaqy  E)AAAAAAr(   r
   NTc                (    g | ]}|j         d k    |S rE  rF  r  s     r)   r  z?SpecifierSet._check_arbitrary_unsatisfiable.<locals>.<listcomp>^  s$    BBB!ajE.A.AA.A.A.Ar(   c              3  B   K   | ]}|                               V  d S r%   r   )r   r  	candidates     r)   r   z>SpecifierSet._check_arbitrary_unsatisfiable.<locals>.<genexpr>f  s/      ??qzz),,??????r(   )r  r   r   r  r   rk   r   r*  )r_   r   standardrK  rH  s      @@r)   r@  z+SpecifierSet._check_arbitrary_unsatisfiableA  s    DCCCC	 	5 !$**,,AAAA9QRR=AAAAA 	4 #9Q<#788	
 %%%' & 4BBt{BBB 	54????h???????r(   ranges.VersionRangec                8    ddl m} |                    |           S )ac  Return the :class:`~packaging.ranges.VersionRange` this set accepts.

        An empty set yields the full range; an unsatisfiable set yields the
        empty range. ``===`` specifiers contribute literal-string admission.

        >>> SpecifierSet(">=1.0,<2.0").to_range()
        <VersionRange '[1.0, 2.0.dev0)'>

        .. versionadded:: 26.3
        r
   )VersionRange)r   rO  _from_specifier_set)r_   rO  s     r)   to_rangezSpecifierSet.to_rangeh  s*     	)(((((//555r(   c                    t          |t                    st          d          | j        s|j        rt	          d          d S )Nzexpected a SpecifierSetz+set relations do not support === specifiers)r0   r!   r   r  r4  rh   s     r)   _check_relation_operandz$SpecifierSet._check_relation_operandw  sU    %.. 	75666 	L%"6 	LJKKK	L 	Lr(   c                    |                      |           |                                                     |                                          S )a=  Return whether every version matching this set also matches other.

        :raises ValueError:
            If either set uses ``===`` specifiers, or the two sets were
            given different ``prereleases`` arguments (unset on one side
            counts as different).
        :raises TypeError:
            If other is not a :class:`SpecifierSet`.

        >>> SpecifierSet(">=3.12,<3.13").is_subset(SpecifierSet(">=3.12"))
        True
        >>> SpecifierSet(">=3.12").is_subset(SpecifierSet(">=3.12,<3.13"))
        False

        .. versionadded:: 26.3
        )rS  rQ  	is_subsetrh   s     r)   rU  zSpecifierSet.is_subset}  s>    " 	$$U+++}}(()9)9:::r(   c                    |                      |           |                                                     |                                          S )a  Return whether every version matching other also matches this set.

        :raises ValueError:
            If either set uses ``===`` specifiers, or the two sets were
            given different ``prereleases`` arguments (unset on one side
            counts as different).
        :raises TypeError:
            If other is not a :class:`SpecifierSet`.

        >>> SpecifierSet(">=3.12").is_superset(SpecifierSet(">=3.12,<3.13"))
        True

        .. versionadded:: 26.3
        )rS  rQ  is_supersetrh   s     r)   rW  zSpecifierSet.is_superset  s>     	$$U+++}}**5>>+;+;<<<r(   c                    |                      |           |                                                     |                                          S )a.  Return whether this set and other share no matching versions.

        :raises ValueError:
            If either set uses ``===`` specifiers, or the two sets were
            given different ``prereleases`` arguments (unset on one side
            counts as different).
        :raises TypeError:
            If other is not a :class:`SpecifierSet`.

        >>> SpecifierSet("<3.12").is_disjoint(SpecifierSet(">=3.12"))
        True
        >>> SpecifierSet("<3.12").is_disjoint(SpecifierSet(">=3.11"))
        False

        .. versionadded:: 26.3
        )rS  rQ  is_disjointrh   s     r)   rY  zSpecifierSet.is_disjoint  s>    " 	$$U+++}}**5>>+;+;<<<r(   rp   r   c                ,    |                      |          S )aq  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 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     r)   r   zSpecifierSet.__contains__  r   r(   	installedc                   t          |          }||r	|j        rd}|| j        rt          |t                    s|}n|}|| j        s|j        x| j        rq|j        r|du s|| j        du rdS | j        }|@| j        D ]}t          ||          }| n|s dS dS | 
                                x}| _        t          ||          S t          t          |                     |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:`~packaging.version.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

        .. versionchanged:: 26.0

            With ``prereleases=None``, a prerelease now matches. A single
            version has no alternatives, so the :pep:`440` rule to accept
            prereleases when nothing else satisfies the specifiers applies.
            Earlier versions rejected it. An unparsable version now returns
            ``False`` instead of raising :exc:`~packaging.version.InvalidVersion`.
        NTFr   )r   r   r  r0   r   rK   r  r   r   rT   r>  r   r8   r   ry   )	r_   rp   rk   r[  r   
check_itemboundsr+   r   s	            r)   rr   zSpecifierSet.contains  sJ   P !&&91FK ?t2?:dG;T;T?JJ J '  % & $ u$$'D,=,F,Fu\F~
 !K    D'g66E}  %$uu%  4(,(8(8(:(::&vw777Dj\{KKLLMMMr(   .rs   rt   ru   rv   c                    d S r%   r'   rx   s       r)   ry   zSpecifierSet.filter$  rz   r(   r{   r|   r}   c                    d S r%   r'   rx   s       r)   ry   zSpecifierSet.filter,  r   r(   r   r   r   c                   || j         | j         }| j        r]| j        r'| j        fd|D             }t          ||          S | j        }||                                 }t          |||          S t          ||          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:`~packaging.version.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.
        :param key:
            A callable that takes a single argument (an item from the iterable) and
            returns a version string or :class:`~packaging.version.Version`
            instance to be used for filtering.

        >>> 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']
        >>> list(SpecifierSet(">=1.2.3").filter(
        ... [{"ver": "1.2"}, {"ver": "1.3"}],
        ... key=lambda x: x["ver"]))
        [{'ver': '1.3'}]

        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']

        .. versionchanged:: 26.0

            Prerelease filtering now follows the PEP 440 recommendation of
            yielding prereleases only when no final release is present.

        .. versionchanged:: 26.1

            Added the ``key`` parameter.
        Nc              3  V   K   | ]"t          fd D                       V  #dS )c              3  `   K   | ](}|                     n
           d          V  )d S )NTr   r   )r   r  rp   ru   s     r)   r   z0SpecifierSet.filter.<locals>.<genexpr>.<genexpr>z  sX         

3;44CCIISW
XX     r(   N)r*  )r   rp   ru   r,  s    @r)   r   z&SpecifierSet.filter.<locals>.<genexpr>w  ss             !&         r(   )rk   r  r  r   r   r>  r   )r_   rs   rk   ru   r   r   r,  s      `  @r)   ry   zSpecifierSet.filter4  s    x 4#3#?*K; 	H" L     (   1#{KKK\F~))++#FHc;GGG )3DDDr(   r   )r  r	  rk   rD   r"   rm   )r"   r  r   r   )r"   r  r   r   r   )rf   r2  r"   r!   r   )r"   r9  r   )r"   r8   )r"   rM  )rf   r,   r"   rm   )rf   r!   r"   r8   )rp   r   r"   r8   r   )rp   r   rk   rD   r[  rD   r"   r8   r   r   r   r   ) rV   rW   rX   rY   r   r   r  r   rk   r   r   r   r   ra   re   r5  ri   r8  r;  r>  rB  r@  rQ  rS  rU  rW  rY  r   rr   r   r   ry   r'   r(   r)   r!   r!     s        $I 13#'*( *( *( *( *(X       X& & & & &0 0 0 07G 7G 7G 7GrB B B B*A A A A- - - -   @C C C C4       ! ! ! !
 
 
 
! ! ! !F%@ %@ %@ %@N6 6 6 6L L L L; ; ; ;(= = = =$= = = =(# # # #0 $(!%	VN VN VN VN VNp _ $(	+ + + + _+ _ $(.1	    _ $(7;	SE SE SE SE SE SE SEr(   r!   rs   c              #  6  K   g }g }d}| D ]}t          ||n
 ||                    }|2|r|V  n*|                    |           |                    |           R|j        s|s
|E d{V  d}|V  j|s|                    |           |s
|E d{V  dS dS )z?Filter per PEP 440: exclude prereleases unless no finals exist.FNT)r   appendr   )rs   ru   all_nonfinalarbitrary_stringsfound_finalrp   rC   s          r)   r  r    s      !L#%K & &TCC>  *



!((...##D)))# 	 #,,,,,,,,"JJJ  	&%%%      r(   )r"   r#   )r+   r,   r"   r-   )r5   r,   r"   r6   )rB   r    rC   r   r"   rD   )r   r   ru   r   rk   rD   r"   r   )rs   r   ru   r   r"   r   )<rY   
__future__r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   utilsr   r   r   syscollections.abcr   r   r   version_infor   typing_extensionsr   r   r   r&   r*   r4   r9   r:   r3   r   r;   __ge____le__ri   __ne__rA   r   rT   r4  r   ABCMetar   r    r   r!   r  r'   r(   r)   <module>rs     s     # " " " " " 



 				                
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ( ' ' ' ' '       
"JJJ<<<<<<<<<<
7""$$$$$$$//////!!!!!!        0 0 0 0 GCLL%W1III  .
.
.
.	F F        :	 	 	 	 	z 	 	 	S S S S Sck S S S SlIO IO IO IO IO IO IO IOX   ,I
E I
E I
E I
E I
E= I
E I
E I
EX'  '  '  '  '  ' r(   