Ë
    ímxi]Ÿ  ã                  óf  — 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 ddlmZmZ eeef   Z ede¬	«      Zeeegef   Zdd
„Zdd„Zdd„Z G d„ de«      Z G d„ dej8                  ¬«      Z G d„ de«      Z ej>                  d«      Z dd„Z!dd„Z"dd„Z#d d„Z$ G d„ de«      Z%y)!zŠ
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
é    )ÚannotationsN)ÚCallableÚFinalÚIterableÚIteratorÚTypeVarÚUnioné   )Úcanonicalize_version)ÚInvalidVersionÚVersionÚUnparsedVersionVar)Úboundc                ó`   — t        | t        «      s	 t        | «      } | S | S # t        $ r Y y w xY w©N)Ú
isinstancer   r   ©Úversions    úK/home/htdocs/ttos/venv/lib/python3.12/site-packages/packaging/specifiers.pyÚ_coerce_versionr      s:   € Ü�gœwÔ'ð	Ü˜gÓ&ˆGð €Nˆ7€Nøô ò 	Ùð	ús   ’! ¡	-¬-c                ó&   — | j                  d ¬«      S )N)Úlocal©Ú__replace__r   s    r   Ú_public_versionr   #   s   € Ø×Ñ TÐÓ*Ð*ó    c                ó,   — | j                  d d d d ¬«      S )N)ÚpreÚpostÚdevr   r   r   s    r   Ú_base_versionr!   '   s   € Ø×Ñ 4¨d¸ÀDÐÓIÐIr   c                  ó   — e Zd ZdZy)Ú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__© r   r   r#   r#   +   s   „ òr   r#   c                  óJ  — e 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y	)ÚBaseSpecifierr(   )Ú_strc                ó   — t        | «      S )z Internal property for match_args©Ústr©Úselfs    r   r+   zBaseSpecifier._str;   s   € ô �4‹yÐr   c                 ó   — y)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   c                 ó   — y)zF
        Returns a hash value for this Specifier-like object.
        Nr(   r/   s    r   Ú__hash__zBaseSpecifier.__hash__G   r3   r   c                 ó   — y)z«
        Returns a boolean representing whether or not the two Specifier-like
        objects are equal.

        :param other: The other object to check against.
        Nr(   ©r0   Úothers     r   Ú__eq__zBaseSpecifier.__eq__M   r3   r   c                 ó   — y)zîWhether or not pre-releases as a whole are allowed.

        This can be set to either ``True`` or ``False`` to explicitly enable or disable
        prereleases or it can be set to ``None`` (the default) to use default semantics.
        Nr(   r/   s    r   ÚprereleaseszBaseSpecifier.prereleasesV   r3   r   c                 ó   — y)zQSetter for :attr:`prereleases`.

        :param value: The value to set.
        Nr(   ©r0   Úvalues     r   r;   zBaseSpecifier.prereleases_   r3   r   Nc                 ó   — y)zR
        Determines if the given item is contained within this specifier.
        Nr(   ©r0   Úitemr;   s      r   ÚcontainszBaseSpecifier.containsf   r3   r   c                 ó   — y)z•
        Takes an iterable of items and filters them so that only items which
        are contained within this specifier are allowed in it.
        Nr(   )r0   Úiterabler;   s      r   ÚfilterzBaseSpecifier.filterl   r3   r   ©Úreturnr.   ©rG   Úint©r8   ÚobjectrG   Úbool©rG   úbool | None)r>   rL   rG   ÚNoner   )rA   r.   r;   rN   rG   rL   ©rD   zIterable[UnparsedVersionVar]r;   rN   rG   zIterator[UnparsedVersionVar])r$   r%   r&   Ú	__slots__Ú__match_args__Úpropertyr+   ÚabcÚabstractmethodr2   r5   r9   r;   ÚsetterrB   rE   r(   r   r   r*   r*   7   s÷   „ Ø€IØ€Nàòó ðð 	×Ñòó ðð 	×Ñòó ðð
 	×Ñòó ðð Ø×Ñòó ó ðð ×Ñòó ðð 	×Ñóó ðð
 	×ÑàQUðØ4ðØCNðà	%òó ñr   r*   )Ú	metaclassc            	      ó¼  — e Zd ZU dZdZdZdZ ej                  dez   ez   dz   ej                  ej                  z  «      Zdddd	d
ddddœZded<   d*d+d„Zd,d„Zd-d„Zed.d„«       Zej&                  d/d„«       Zed0d„«       Zed0d„«       Zd0d„Zd0d„Zed1d„«       Zd2d„Zd3d„Zd4d„Zd5d„Zd5d „Zd5d!„Zd5d"„Zd5d#„Z d6d$„Z!d6d%„Z"d7d&„Z#d8d'„Z$d9d:d(„Z%	 d9	 	 	 	 	 d;d)„Z&y)<Ú	Specifiera?  This class abstracts handling of version specifiers.

    .. tip::

        It is generally not required to instantiate this manually. You should instead
        prefer to work with :class:`SpecifierSet` instead, which can parse
        comma-separated version specifiers (which is what package metadata contains).
    )Ú_prereleasesÚ_specÚ_spec_versionz8
        (?P<operator>(~=|==|!=|<=|>=|<|>|===))
        aÈ  
        (?P<version>
            (?:
                # The identity operators allow for an escape hatch that will
                # do an exact string match of the version you wish to install.
                # This will not be parsed by PEP 440 and we cannot determine
                # any semantic meaning from it. This operator is discouraged
                # but included entirely as an escape hatch.
                (?<====)  # Only match for the identity operator
                \s*
                [^\s;)]*  # The arbitrary version can be just about anything,
                          # we match everything except for whitespace, a
                          # semi-colon for marker support, and a closing paren
                          # since versions can be enclosed in them.
            )
            |
            (?:
                # The (non)equality operators allow for wild card and local
                # versions to be specified so we have to define these two
                # operators separately to enable that.
                (?<===|!=)            # Only match for equals and not equals

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release

                # You cannot use a wild card and a pre-release, post-release, a dev or
                # local version together so group them with a | and make them optional.
                (?:
                    \.\*  # Wild card syntax of .*
                    |
                    (?:                                  # pre release
                        [-_\.]?
                        (alpha|beta|preview|pre|a|b|c|rc)
                        [-_\.]?
                        [0-9]*
                    )?
                    (?:                                  # post release
                        (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                    )?
                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
                )?
            )
            |
            (?:
                # The compatible operator requires at least two digits in the
                # release segment.
                (?<=~=)               # Only match for the compatible operator

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
                (?:                   # pre release
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
            |
            (?:
                # All other operators only allow a sub set of what the
                # (non)equality operators do. Specifically they do not allow
                # local versions to be specified nor do they allow the prefix
                # matching wild cards.
                (?<!==|!=|~=)         # We have special cases for these
                                      # operators so we want to make sure they
                                      # don't match here.

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?:                   # pre release
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
        )
        z\s*Ú
compatibleÚequalÚ	not_equalÚless_than_equalÚgreater_than_equalÚ	less_thanÚgreater_thanÚ	arbitrary)ú~=ú==ú!=z<=ú>=ú<ú>ú===r   Ú
_operatorsNc                óü   — | j                   j                  |«      }|st        d|›�«      ‚|j                  d«      j	                  «       |j                  d«      j	                  «       f| _        || _        d| _        y)að  Initialize a Specifier instance.

        :param spec:
            The string representation of a specifier which will be parsed and
            normalized before use.
        :param prereleases:
            This tells the specifier if it should accept prerelease versions if
            applicable or not. The default of ``None`` will autodetect it from the
            given specifiers.
        :raises InvalidSpecifier:
            If the given specifier is invalid (i.e. bad syntax).
        zInvalid specifier: Úoperatorr   N)Ú_regexÚ	fullmatchr#   ÚgroupÚstripr[   rZ   r\   )r0   Úspecr;   Úmatchs       r   Ú__init__zSpecifier.__init__ó   sw   € ð —‘×%Ñ% dÓ+ˆÙÜ"Ð%8¸¸Ð#AÓBÐBð �K‰K˜
Ó#×)Ñ)Ó+Ø�K‰K˜	Ó"×(Ñ(Ó*ð'
ˆŒ
ð (ˆÔð :>ˆÕr   c                óŽ   — | j                   �!| j                   d   |k(  r| j                   d   S t        |«      }|€y||f| _         |S )zDOne element cache, as only one spec Version is needed per Specifier.Nr   r
   )r\   r   )r0   r   Úversion_specifiers      r   Ú_get_spec_versionzSpecifier._get_spec_version  sY   € à×ÑÐ)¨d×.@Ñ.@ÀÑ.CÀwÒ.NØ×%Ñ% aÑ(Ð(ä+¨GÓ4ÐØÐ$Øà%Ð'8Ð9ˆÔØ Ð r   c                ó0   — | j                  |«      }|€J ‚|S )zÕGet spec version, asserting it's valid (not for === operator).

        This method should only be called for operators where version
        strings are guaranteed to be valid PEP 440 versions (not ===).
        )rx   )r0   r   Úspec_versions      r   Ú_require_spec_versionzSpecifier._require_spec_version  s&   € ð ×-Ñ-¨gÓ6ˆØÐ'Ð'Ð'ØÐr   c                óÌ   — | j                   �| j                   S | j                  \  }}|dk7  r8|dk(  r|j                  d«      ry| j                  |«      }|€y |j                  ryy)Nrg   rf   ú.*FT)rZ   r[   Úendswithrx   Úis_prerelease)r0   rn   Úversion_strr   s       r   r;   zSpecifier.prereleases%  sy   € ð ×ÑÐ(Ø×$Ñ$Ð$ð !%§
¡
Ñˆ�+Ø�tÒð ˜4Ò K×$8Ñ$8¸Ô$>Øð ×,Ñ,¨[Ó9ˆGØˆØð ×$Ò$Øàr   c                ó   — || _         y r   ©rZ   r=   s     r   r;   zSpecifier.prereleasesB  ó
   € à!ˆÕr   c                ó    — | j                   d   S )z`The operator of this specifier.

        >>> Specifier("==1.2.3").operator
        '=='
        r   ©r[   r/   s    r   rn   zSpecifier.operatorF  ó   € ð �z‰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.versionO  r†   r   c                óŒ   — | 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)>
        ú, prereleases=Ú ri   ú(ú)>)rZ   r;   Ú	__class__r$   r.   ©r0   r   s     r   Ú__repr__zSpecifier.__repr__X  sU   € ð × Ñ Ð,ð ˜T×-Ñ-Ð0Ñ1àð 	ð �4—>‘>×*Ñ*Ð+¨1¬S°«Y¨M¸#¸¸bÐAÐAr   c                ó4   —  dj                   | j                  Ž S )zÐA string representation of the Specifier that can be round-tripped.

        >>> str(Specifier('>=1.0.0'))
        '>=1.0.0'
        >>> str(Specifier('>=1.0.0', prereleases=False))
        '>=1.0.0'
        z{}{})Úformatr[   r/   s    r   r2   zSpecifier.__str__j  s   € ð ˆv�}‰}˜dŸj™jÐ)Ð)r   c                óž   — | j                   \  }}|dk(  s|j                  d«      r||fS | j                  |«      }t        ||dk7  ¬«      }||fS )Nrk   r}   re   ©Ústrip_trailing_zero)r[   r~   r{   r   )r0   rn   r   rz   Úcanonical_versions        r   Ú_canonical_speczSpecifier._canonical_spect  sc   € à ŸJ™JÑˆ�'Ø�uÒ × 0Ñ 0°Ô 6Ø˜WÐ$Ð$à×1Ñ1°'Ó:ˆä0Ø¨x¸4Ñ/?ô
Ðð Ð*Ð*Ð*r   c                ó,   — t        | j                  «      S r   )Úhashr–   r/   s    r   r5   zSpecifier.__hash__‚  s   € Ü�D×(Ñ(Ó)Ð)r   c                óî   — t        |t        «      r	 | j                  t        |«      «      }nt        || j                  «      st        S | j
                  |j
                  k(  S # t        $ r	 t        cY S w xY w)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
        )r   r.   r�   r#   ÚNotImplementedr–   r7   s     r   r9   zSpecifier.__eq__…  si   € ô& �eœSÔ!ð&ØŸ™¤s¨5£zÓ2‘ô ˜E 4§>¡>Ô2Ü!Ð!à×#Ñ# u×'<Ñ'<Ñ<Ð<øô $ò &Ü%Ò%ð&ús   ’A" Á"A4Á3A4c                ó>   — t        | d| j                  |   › �«      }|S )NÚ	_compare_)Úgetattrrl   )r0   ÚopÚoperator_callables      r   Ú_get_operatorzSpecifier._get_operator¢  s+   € Ü.5Ø�I˜dŸo™o¨bÑ1Ð2Ð3ó/
Ðð !Ð r   c           
     óà   — t        t        t        j                  t        t        |«      «      «      d d «      }|dz  } | j                  d«      ||«      xr  | j                  d«      ||«      S )Néÿÿÿÿr}   rh   rf   )Ú_version_joinÚlistÚ	itertoolsÚ	takewhileÚ_is_not_suffixÚ_version_splitr    )r0   Úprospectivers   Úprefixs       r   Ú_compare_compatiblezSpecifier._compare_compatible¨  sw   € ô Ü”×$Ñ$¤^´^ÀDÓ5IÓJÓKÈCÈRÐPó
ˆð
 	�$‰ˆà'ˆt×!Ñ! $Ó'¨°TÓ:ò 
Ð?W¸t×?QÑ?QÐRVÓ?WØ˜ó@
ð 	
r   c                ó:  — |j                  d«      r^t        t        |«      d¬«      }t        |d d d¬«      }t        |«      }t        |«      }t	        ||«      \  }}|d t        |«       }	|	|k(  S | j                  |«      }
|
j                  st        |«      }||
k(  S )Nr}   Fr“   éþÿÿÿ)r~   r   r   r¨   Ú_pad_versionÚlenr{   r   )r0   r©   rs   Únormalized_prospectiveÚnormalized_specÚ
split_specÚsplit_prospectiveÚpadded_prospectiveÚ_Úshortened_prospectiverz   s              r   Ú_compare_equalzSpecifier._compare_equal¼  s¸   € à�=‰=˜Ôä%9Ü Ó,À%ô&Ð"ô 3°4¸¸°9ÐRWÔXˆOô (¨Ó8ˆJô
 !/Ð/EÓ FÐô %1Ð1BÀJÓ$OÑ!Ð ð
 %7Ð7H¼¸Z»Ð$IÐ!à(¨JÑ6Ð6ð  ×5Ñ5°dÓ;ˆLð
  ×%Ò%Ü-¨kÓ:�à ,Ñ.Ð.r   c                ó(   — | j                  ||«       S r   )r·   ©r0   r©   rs   s      r   Ú_compare_not_equalzSpecifier._compare_not_equalä  s   € Ø×&Ñ& {°DÓ9Ð9Ð9r   c                ó<   — t        |«      | j                  |«      k  S r   ©r   r{   r¹   s      r   Ú_compare_less_than_equalz"Specifier._compare_less_than_equalç  ó   € ô ˜{Ó+¨t×/IÑ/IÈ$Ó/OÑOÐOr   c                ó<   — t        |«      | j                  |«      k\  S r   r¼   r¹   s      r   Ú_compare_greater_than_equalz%Specifier._compare_greater_than_equalí  r¾   r   c                ó’   — | j                  |«      }||k  sy|j                  s$|j                  rt        |«      t        |«      k(  ryy©NFT)r{   r   r!   ©r0   r©   Úspec_strrs   s       r   Ú_compare_less_thanzSpecifier._compare_less_thanó  sO   € ð ×)Ñ)¨(Ó3ˆð
 ˜TÒ!Øð ×"Ò"Ø×)Ò)Ü˜kÓ*¬m¸DÓ.AÒAàð
 r   c                óÚ   — | j                  |«      }||kD  sy|j                  s$|j                  rt        |«      t        |«      k(  ry|j                  �t        |«      t        |«      k(  ryyrÂ   )r{   Úis_postreleaser!   r   rÃ   s       r   Ú_compare_greater_thanzSpecifier._compare_greater_than  sy   € ð ×)Ñ)¨(Ó3ˆð
 ˜TÒ!Øð ×#Ò#Ø×*Ò*Ü˜kÓ*¬m¸DÓ.AÒAàð ×ÑÐ(¬]Øó.
ä˜4Ó ò.!ð ð
 r   c                óh   — t        |«      j                  «       t        |«      j                  «       k(  S r   )r.   Úlowerr¹   s      r   Ú_compare_arbitraryzSpecifier._compare_arbitrary0  s&   € Ü�;Ó×%Ñ%Ó'¬3¨t«9¯?©?Ó+<Ñ<Ð<r   c                ó$   — | j                  |«      S )a:  Return whether or not the item is contained in this specifier.

        :param item: The item to check for.

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

        >>> "1.2.3" in Specifier(">=1.2.3")
        True
        >>> Version("1.2.3") in Specifier(">=1.2.3")
        True
        >>> "1.0.0" in Specifier(">=1.2.3")
        False
        >>> "1.3.0a1" in Specifier(">=1.2.3")
        True
        >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
        True
        ©rB   ©r0   rA   s     r   Ú__contains__zSpecifier.__contains__3  ó   € ð& �}‰}˜TÓ"Ð"r   c                óN   — t        t        | j                  |g|¬«      «      «      S )as  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:`Version` instance.
        :param prereleases:
            Whether or not to match prereleases with this Specifier. If set to
            ``None`` (the default), it will follow the recommendation from
            :pep:`440` and match prereleases, as there are no other versions.

        >>> Specifier(">=1.2.3").contains("1.2.3")
        True
        >>> Specifier(">=1.2.3").contains(Version("1.2.3"))
        True
        >>> Specifier(">=1.2.3").contains("1.0.0")
        False
        >>> Specifier(">=1.2.3").contains("1.3.0a1")
        True
        >>> Specifier(">=1.2.3", prereleases=False).contains("1.3.0a1")
        False
        >>> Specifier(">=1.2.3").contains("1.3.0a1")
        True
        ©r;   )rL   r¤   rE   r@   s      r   rB   zSpecifier.containsH  s#   € ô2 ”D˜Ÿ™ d V¸˜ÓEÓFÓGÐGr   c              #  óÐ  K  — g }d}|�|n| j                   }| j                  | j                  «      }|D ]�  }t        |«      }|€2| j                  dk(  sŒ | j	                  || j
                  «      sŒ=|–— ŒB ||| j
                  «      sŒV|j                  r|rd}|–— Œk|�Œn| j                  dusŒ}|j                  |«       Œ� |s|€| j                  dur|E d{  –—†  yyyy7 Œ­w)a  Filter items in the given iterable, that match the specifier.

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

        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
        ['1.3']
        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")]))
        ['1.2.3', '1.3', <Version('1.4')>]
        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"]))
        ['1.5a1']
        >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
        ['1.3', '1.5a1']
        >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
        ['1.3', '1.5a1']
        FNrk   T)	r;   r    rn   r   rË   r   r   rZ   Úappend)	r0   rD   r;   Úprereleases_versionsÚfound_non_prereleasesÚinclude_prereleasesrŸ   r   Úparsed_versions	            r   rE   zSpecifier.filterc  s  è ø€ ð0  "ÐØ %Ðð 'Ð2‰K¸×8HÑ8Hð 	ð
 !×.Ñ.¨t¯}©}Ó=Ðð  ò 	9ˆGÜ,¨WÓ5ˆNØÐ%à—=‘= EÓ)¨d×.EÑ.EØ˜TŸ\™\õ/ð "“MÙ" >°4·<±<Õ@à%×3Ò3Ñ7JØ,0Ð)Ø!“Mà Ñ(¨T×->Ñ->ÀeÒ-KØ(×/Ñ/°Õ8ð	9ñ( &ØÐ#Ø×!Ñ!¨Ñ.à+×+Ñ+ð /ð $ð &ð ,ús0   ‚AC&ÁC&Á1C&Â
C&Â"C&Â1*C&ÃC$Ã	C&©rŠ   N)rs   r.   r;   rN   rG   rO   )r   r.   rG   úVersion | None)r   r.   rG   r   rM   ©r>   rN   rG   rO   rF   )rG   ztuple[str, str]rH   rJ   )rž   r.   rG   ÚCallableOperator)r©   r   rs   r.   rG   rL   )r©   r   rÄ   r.   rG   rL   )r©   zVersion | strrs   r.   rG   rL   )rA   zstr | VersionrG   rL   r   )rA   ÚUnparsedVersionr;   rN   rG   rL   rP   )'r$   r%   r&   r'   rQ   Ú_operator_regex_strÚ_version_regex_strÚreÚcompileÚVERBOSEÚ
IGNORECASEro   rl   Ú__annotations__ru   rx   r{   rS   r;   rV   rn   r   r�   r2   r–   r5   r9   r    r«   r·   rº   r½   rÀ   rÅ   rÈ   rË   rÏ   rB   rE   r(   r   r   rY   rY   v   sl  … ñð ;€IðÐð\Ðð| ˆR�Z‰ZØÐ$Ñ$Ð'9Ñ9¸FÑBØ
�
‰
�R—]‘]Ñ"ó€Fð ØØØØ"ØØØñ	€J�ó 	ô>ó8
!óð òó ðð8 ×Ñò"ó ð"ð òó ðð òó ðóBó$*ð ò+ó ð+ó*ó=ó:!ó
ó(&/óP:óPóPóó6 óD=ó#ô*Hð8 RVð<,Ø4ð<,ØCNð<,à	%ô<,r   rY   z([0-9]+)((?:a|b|c|rc)[0-9]+)c                ó  — g }| j                  d«      \  }}}|j                  |xs d«       |j                  d«      D ]J  }t        j	                  |«      }|r |j                  |j                  «       «       Œ:|j                  |«       ŒL |S )a  Split version into components.

    The split components are intended for version comparison. The logic does
    not attempt to retain the original version string, so joining the
    components back with :func:`_version_join` may not produce the original
    version string.
    ú!Ú0ú.)Ú
rpartitionrÔ   ÚsplitÚ_prefix_regexrp   ÚextendÚgroups)r   ÚresultÚepochrµ   ÚrestrA   rt   s          r   r¨   r¨   ¥  s~   € ð €Fà×'Ñ'¨Ó,�N€Eˆ1ˆdØ
‡M�M�%’,˜3Ôà—
‘
˜3“ò  ˆÜ×'Ñ'¨Ó-ˆÙØ�M‰M˜%Ÿ,™,›.Õ)à�M‰M˜$Õð ð €Mr   c                ó6   — | ^}}|› ddj                  |«      › �S )zñJoin split version components into a version string.

    This function assumes the input came from :func:`_version_split`, where the
    first component must be the epoch (either empty or numeric), and all other
    components numeric.
    ræ   rè   )Újoin)Ú
componentsrï   rð   s      r   r£   r£   »  s'   € ð €L€EˆDØˆW�A�c—h‘h˜t“nÐ%Ð&Ð&r   c                ó.   ‡ — t        ˆ fd„dD «       «       S )Nc              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­wr   )Ú
startswith)Ú.0rª   Úsegments     €r   ú	<genexpr>z!_is_not_suffix.<locals>.<genexpr>Ç  s!   øè ø€ ò Ø'-ˆ×Ñ˜6×"ñùs   ƒ)r    ÚaÚbÚrcr   )Úany)rø   s   `r   r§   r§   Æ  s"   ø€ Üó Ø1Pôó ð ð r   c                óÒ  — g g }}|j                  t        t        j                  d„ | «      «      «       |j                  t        t        j                  d„ |«      «      «       |j                  | t	        |d   «      d  «       |j                  |t	        |d   «      d  «       |j                  ddgt        dt	        |d   «      t	        |d   «      z
  «      z  «       |j                  ddgt        dt	        |d   «      t	        |d   «      z
  «      z  «       t        t        j                  j                  |«      «      t        t        j                  j                  |«      «      fS )Nc                ó"   — | j                  «       S r   ©Úisdigit©Úxs    r   ú<lambda>z_pad_version.<locals>.<lambda>Ð  s   € ¸¿¹»€ r   c                ó"   — | j                  «       S r   r   r  s    r   r  z_pad_version.<locals>.<lambda>Ñ  s   € ¸!¿)¹)»+€ r   r   r
   rç   )	rÔ   r¤   r¥   r¦   r¯   ÚinsertÚmaxÚchainÚfrom_iterable)ÚleftÚrightÚ
left_splitÚright_splits       r   r®   r®   Ì  s5  € Ø  "�€Jð ×Ñ”dœ9×.Ñ.Ñ/DÀdÓKÓLÔMØ×Ñ”tœI×/Ñ/Ñ0EÀuÓMÓNÔOð ×Ñ�dœ3˜z¨!™}Ó-Ð/Ð0Ô1Ø×Ñ�uœS ¨Q¡Ó0Ð2Ð3Ô4ð ×Ñ�a˜#˜¤ Q¬¨K¸©NÓ(;¼cÀ*ÈQÁ-Ó>PÑ(PÓ!QÑQÔRØ×Ñ�q˜3˜%¤# a¬¨Z¸©]Ó);¼cÀ+ÈaÁ.Ó>QÑ)QÓ"RÑRÔSô 	ŒY�_‰_×*Ñ*¨:Ó6Ó7ÜŒY�_‰_×*Ñ*¨;Ó7Ó8ðð r   c                  óÖ   — e Zd ZdZdZ	 	 d	 	 	 	 	 dd„Zedd„«       Zej                  dd„«       Zdd„Z	dd„Z
dd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Z	 	 d	 	 	 	 	 	 	 dd„Z	 d	 	 	 	 	 dd„Zy)ÚSpecifierSetzÌThis class abstracts handling of a set of version specifiers.

    It can be passed a single specifier (``>=3.0``), a comma-separated list of
    specifiers (``>=3.0,!=3.1``), or no specifier at all.
    )rZ   Ú_specsNc                ó"  — t        |t        «      rc|j                  d«      D �cg c]#  }|j                  «       sŒ|j                  «       ‘Œ% }}t	        t        t        |«      «      | _        || _        yt	        |«      | _        || _        yc c}w )a´  Initialize a SpecifierSet instance.

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

        :raises InvalidSpecifier:
            If the given ``specifiers`` are not parseable than this exception will be
            raised.
        ú,N)	r   r.   rê   rr   Ú	frozensetÚmaprY   r  rZ   )r0   Ú
specifiersr;   ÚsÚsplit_specifierss        r   ru   zSpecifierSet.__init__ê  s{   € ô, �j¤#Ô&ð 4>×3CÑ3CÀCÓ3HÖV¨aÈAÏGÉGÍI §¡¥	ÐVÐÐVô $¤C¬	Ð3CÓ$DÓEˆDŒKð (ˆÕô	 $ JÓ/ˆDŒKð (ˆÕùò  Ws
   ¤BºBc                óˆ   — | j                   �| j                   S | j                  sy t        d„ | j                  D «       «      ryy )Nc              3  ó4   K  — | ]  }|j                   –— Œ y ­wr   rÒ   ©r÷   r  s     r   rù   z+SpecifierSet.prereleases.<locals>.<genexpr>  s   è ø€ Ò2 ˆq�}�}Ñ2ùs   ‚T)rZ   r  rý   r/   s    r   r;   zSpecifierSet.prereleases  sB   € ð ×ÑÐ(Ø×$Ñ$Ð$ð
 �{Š{Øô Ñ2 d§k¡kÔ2Ô2Øàr   c                ó   — || _         y r   r‚   r=   s     r   r;   zSpecifierSet.prereleases$  rƒ   r   c                ó^   — | j                   �d| j                  ›�nd}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)>
        r‰   rŠ   z<SpecifierSet(rŒ   )rZ   r;   r.   rŽ   s     r   r�   zSpecifierSet.__repr__(  sD   € ð × Ñ Ð,ð ˜T×-Ñ-Ð0Ñ1àð 	ð  ¤ D£	˜}¨S¨E°Ð4Ð4r   c                óX   — dj                  t        d„ | j                  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  ó2   K  — | ]  }t        |«      –— Œ y ­wr   r-   r  s     r   rù   z'SpecifierSet.__str__.<locals>.<genexpr>H  s   è ø€ Ò;¨!œs 1ŸvÑ;ùs   ‚)rò   Úsortedr  r/   s    r   r2   zSpecifierSet.__str__=  s"   € ð �x‰xœÑ;¨t¯{©{Ô;Ó;Ó<Ð<r   c                ó,   — t        | j                  «      S r   )r˜   r  r/   s    r   r5   zSpecifierSet.__hash__J  s   € Ü�D—K‘KÓ Ð r   c                ó¼  — t        |t        «      rt        |«      }nt        |t        «      st        S t        «       }t	        | j
                  |j
                  z  «      |_        | j                  €|j                  �|j                  |_        |S | j                  �|j                  �| j                  |j                  k(  r| j                  |_        |S t        d«      ‚)a‚  Return a SpecifierSet which is a combination of the two sets.

        :param other: The other object to combine with.

        >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1'
        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>
        >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1')
        <SpecifierSet('!=1.0.1,!=2.0.1,<=2.0.0,>=1.0.0')>
        zFCannot combine SpecifierSets with True and False prerelease overrides.)r   r.   r  rš   r  r  rZ   Ú
ValueError)r0   r8   Ú	specifiers      r   Ú__and__zSpecifierSet.__and__M  sË   € ô �eœSÔ!Ü  Ó'‰EÜ˜E¤<Ô0Ü!Ð!ä “Nˆ	Ü$ T§[¡[°5·<±<Ñ%?Ó@ˆ	Ôà×ÑÐ$¨×);Ñ);Ð)GØ%*×%7Ñ%7ˆIÔ"ð Ðð ×ÑÐ)¨e×.@Ñ.@Ð.HØ×Ñ %×"4Ñ"4Ò4Ø%)×%6Ñ%6ˆIÔ"ð Ðô	 ØXóð r   c                ó¶   — t        |t        t        f«      rt        t        |«      «      }nt        |t        «      st        S | j
                  |j
                  k(  S )a¡  Whether or not the two SpecifierSet-like objects are equal.

        :param other: The other object to check against.

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

        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1")
        True
        >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) ==
        ...  SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True))
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1"
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2")
        False
        )r   r.   rY   r  rš   r  r7   s     r   r9   zSpecifierSet.__eq__l  sD   € ô& �eœc¤9Ð-Ô.Ü ¤ U£Ó,‰EÜ˜E¤<Ô0Ü!Ð!à�{‰{˜eŸl™lÑ*Ð*r   c                ó,   — t        | j                  «      S )z7Returns the number of specifiers in this specifier set.)r¯   r  r/   s    r   Ú__len__zSpecifierSet.__len__†  s   € ä�4—;‘;ÓÐr   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')>]
        )Úiterr  r/   s    r   Ú__iter__zSpecifierSet.__iter__Š  s   € ô �D—K‘KÓ Ð r   c                ó$   — | j                  |«      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   c                ó”   — t        |«      }|�|r|j                  rd}|€|n|}t        t        | j	                  |g|¬«      «      «      S )a‡  Return whether or not the item is contained in this SpecifierSet.

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

        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3")
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3"))
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1")
        True
        >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False).contains("1.3.0a1")
        False
        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True)
        True
        TrÒ   )r   r   rL   r¤   rE   )r0   rA   r;   Ú	installedr   Ú
check_items         r   rB   zSpecifierSet.contains©  sN   € ô@ " $Ó'ˆàÐ¡9°×1FÒ1FØˆKà$˜_‘T°'ˆ
Ü”D˜Ÿ™ j \¸{˜ÓKÓLÓMÐMr   c                óø  ‡	— |€| j                   �| j                   }| j                  r5| j                  D ]  }|j                  ||€dn|¬«      }Œ |�)t        |«      S |du rt        |«      S |du rˆ	fd„|D «       S g }g }d}|D ]c  }t	        |«      }|€#|j                  |«       |j                  |«       Œ3|j                  r|j                  |«       ŒQ|j                  |«       d}Œe t        |r|«      S |«      S )aö  Filter items in the given iterable, that match the specifiers in this set.

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

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

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

        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"]))
        ['1.3']
        >>> list(SpecifierSet("").filter(["1.5a1"]))
        ['1.5a1']
        >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"]))
        ['1.3', '1.5a1']
        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True))
        ['1.3', '1.5a1']
        TrÒ   Fc              3  óT   •K  — | ]  }t        |«      xŠ�‰j                  s|–— Œ! y ­wr   )r   r   )r÷   rA   r   s     €r   rù   z&SpecifierSet.filter.<locals>.<genexpr>  s2   øè ø€ ò àÜ#2°4Ó#8Ð8˜ÐAØ"×0Ò0ô ñùs   ƒ%()r;   r  rE   r)  r   rÔ   r   )
r0   rD   r;   rs   Úfiltered_itemsÚfound_prereleasesÚfound_final_releaserA   rØ   r   s
            @r   rE   zSpecifierSet.filterÑ  s5  ø€ ðN Ð 4×#3Ñ#3Ð#?Ø×*Ñ*ˆKð
 �;Š;ð Ÿ™ò �ØŸ;™;Ø°+Ð2E©$È;ð 'ó ‘ðð
 Ð&ô ˜H“~Ð%ð ˜dÑ"Ü˜H“~Ð%à˜eÑ#óà (ôð ð 46ˆØ68ÐØ#Ðàò 	+ˆDÜ,¨TÓ2ˆNð Ð%Ø×%Ñ% dÔ+Ø!×(Ñ(¨Õ.Ø×-Ò-Ø!×(Ñ(¨Õ.à×%Ñ% dÔ+Ø&*Ñ#ð	+ô Ñ&9�NÓQÐQÐ?PÓQÐQr   rÙ   )r  zstr | Iterable[Specifier]r;   rN   rG   rO   rM   rÛ   rF   rH   )r8   zSpecifierSet | strrG   r  rJ   )rG   zIterator[Specifier])rA   rÝ   rG   rL   )NN)rA   rÝ   r;   rN   r-  rN   rG   rL   r   rP   )r$   r%   r&   r'   rQ   ru   rS   r;   rV   r�   r2   r5   r$  r9   r'  r*  rÏ   rB   rE   r(   r   r   r  r  á  só   „ ñð +€Ið 13Ø#'ð$(à-ð$(ð !ð$(ð 
ó	$(ðL òó ðð& ×Ñò"ó ð"ó5ó*=ó!óó>+ó4 ó!ó#ð0 $(Ø!%ð	&Nàð&Nð !ð&Nð ð	&Nð
 
ó&NðR RVð[RØ4ð[RØCNð[Rà	%ô[Rr   r  )r   rÝ   rG   rÚ   )r   r   rG   r   )r   r.   rG   ú	list[str])ró   r4  rG   r.   )rø   r.   rG   rL   )r
  r4  r  r4  rG   ztuple[list[str], list[str]])&r'   Ú
__future__r   rT   r¥   rà   Útypingr   r   r   r   r   r	   Úutilsr   r   r   r   r.   rÝ   r   rL   rÜ   r   r   r!   r"  r#   ÚABCMetar*   rY   rá   rë   r¨   r£   r§   r®   r  r(   r   r   ú<module>r9     sÇ   ðñõ #ã 
Û Û 	ß F× Få 'ß ,à˜ ˜Ñ%€ÙÐ1¸ÔIÐ Ø˜W c˜N¨DÐ0Ñ1Ð óó+óJô	�zô 	ô<˜cŸk™kõ <ô~i,�ô i,ðX �—
‘
Ð:Ó;€óó,'óóô*KR�=õ KRr   