
    Xi0                       % S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	J
r
JrJrJrJrJrJr  SSKJr  SSKJrJr  / SQrS6S	 jr\" S
5      r\\\4   r\" S\S9r\
\\/\4   r\" S5      rS\S'   S7S jr  " S S\RB                  5      r"\RF                   " S S5      5       r$\RF                   " S S5      5       r%\RF                   " S S5      5       r&\RN                  (       a  \\\$S4   r(\)\%\&4   r*\%" SS5      r+\&" SS5      r,\+\,44r-S\S'   S8S jr.      S9S jr/S:S jr0S:S jr1S;S  jr2S:S! jr3S:S" jr4S:S# jr5    S<S$ jr6 " S% S&\75      r8 " S' S(\Rr                  S)9r: " S* S+\:5      r;\Rx                  " S,5      r=      S=S- jr>S>S. jr?S?S/ jr@S@S0 jrASAS1 jrBSBS2 jrCSCS3 jrD " S4 S5\:5      rEg)Dz
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
    )annotationsN)AnyCallableFinalIterableIteratorSequenceTypeVarUnion   )canonicalize_version)InvalidVersionVersion)BaseSpecifierInvalidSpecifier	SpecifierSpecifierSetc                     [         $ N)__all__     G/var/www/html/venv/lib/python3.13/site-packages/packaging/specifiers.py__dir__r       s    Nr   TUnparsedVersionVar)boundz0.dev0zFinal[Version]_MIN_VERSIONc                    [        U 5      nUS:  a#  XS-
     S:X  a  US-  nUS:  a  XS-
     S:X  a  M  U[        U 5      :X  a  U $ U SU $ )zDStrip trailing zeros from a release tuple for normalized comparison.r   r   N)len)releaseends     r   _trim_releaser#   -   s\    
g,C
'gAg&!+q 'gAg&!+S\)7<wt}<r   c                  \    \ rS rSrSr\R                  " 5       r\R                  " 5       rSr	g)_BoundaryKind5   z5Where a boundary marker sits in the version ordering.r   N)
__name__
__module____qualname____firstlineno____doc__enumautoAFTER_LOCALSAFTER_POSTS__static_attributes__r   r   r   r%   r%   5   s    ?99;L))+Kr   r%   c                  X    \ rS rSrSrSrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSrg
)_BoundaryVersion<   a  A point on the version line between two real PEP 440 versions.

Some specifier semantics imply boundaries between real versions:
``<=1.0`` includes ``1.0+local`` and ``>1.0`` excludes
``1.0.post0``.  No real :class:`Version` falls on those boundaries,
so this class creates values that sort between the real versions
on either side.

Two kinds exist, shown relative to a base version V::

    V < V+local < AFTER_LOCALS(V) < V.post0 < AFTER_POSTS(V)

``AFTER_LOCALS`` sits after V and every V+local, but before
V.post0.  Upper bound of ``<=V``, ``==V``, ``!=V``.

``AFTER_POSTS`` sits after every V.postN, but before the next
release segment.  Lower bound of ``>V`` (final or pre-release V)
to exclude post-releases per PEP 440.
)_kind_trimmed_releaseversionc                P    Xl         X l        [        UR                  5      U l        g r   )r6   r4   r#   r!   r5   )selfr6   kinds      r   __init___BoundaryVersion.__init__T   s    
 -goo >r   c                   U R                   nUR                  UR                  :X  a=  [        UR                  5      U R                  :X  a  UR
                  UR
                  :X  d  gU R                  [        R                  :X  a9  UR                  UR                  :H  =(       a    UR                  UR                  :H  $ UR                  UR                  :H  =(       d    UR                  SL$ )z6Is ``other`` a version that this boundary sorts above?FN)r6   epochr#   r!   r5   prer4   r%   r.   postdev)r8   othervs      r   
_is_family_BoundaryVersion._is_familyY   s    LLKK177"emm,0E0EE		QUU"::333::'>EII,>>yyAEE!;UZZt%;;r   c                    [        U[        5      (       a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ [        $ r   )
isinstancer2   r6   r4   NotImplementedr8   rA   s     r   __eq___BoundaryVersion.__eq__h   s;    e-..<<5==0NTZZ5;;5NNr   c                D   [        U[        5      (       a`  U R                  UR                  :w  a  U R                  UR                  :  $ U R                  R                  UR                  R                  :  $ U R                  U5      (       + =(       a    U R                  U:  $ r   )rF   r2   r6   r4   valuerC   rH   s     r   __lt___BoundaryVersion.__lt__m   sr    e-..||u}},||emm33::##ekk&7&777??5))BdllU.BBr   c                D    [        U R                  U R                  45      $ r   )hashr6   r4   r8   s    r   __hash___BoundaryVersion.__hash__t   s    T\\4::.//r   c                ~    U R                   R                   SU R                  < SU R                  R                   S3$ )N(z, ))	__class__r'   r6   r4   namerQ   s    r   __repr___BoundaryVersion.__repr__w   s4    ..))*!DLL+;2djjoo=NaPPr   N)r6   r   r9   r%   returnNone)rA   r   r[   boolrA   objectr[   r]   )rA   z_BoundaryVersion | Versionr[   r]   r[   intr[   str)r'   r(   r)   r*   r+   	__slots__r:   rC   rI   rM   rR   rY   r0   r   r   r   r2   r2   <   s.    ( 9I?
<
C0Qr   r2   c                  N    \ rS rSrSrSrS
S jrSS jrSS jrSS jr	SS jr
Srg	)_LowerBound{   zLower bound of a version range.

A version *v* of ``None`` means unbounded below (-inf).
At equal versions, ``[v`` sorts before ``(v`` because an inclusive
bound starts earlier.
	inclusiver6   c                    Xl         X l        g r   r6   ri   r8   r6   ri   s      r   r:   _LowerBound.__init__       "r   c                    [        U[        5      (       d  [        $ U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   rF   rf   rG   r6   ri   rH   s     r   rI   _LowerBound.__eq__   :    %--!!||u}},R5??1RRr   c                8   [        U[        5      (       d  [        $ U R                  c  UR                  S L$ UR                  c  gU R                  UR                  :w  a  U R                  UR                  :  $ U R                  =(       a    UR                  (       + $ )NFrp   rH   s     r   rM   _LowerBound.__lt__   st    %--!!<<==,,== <<5==(<<%--//~~5eoo"55r   c                D    [        U R                  U R                  45      $ r   rP   r6   ri   rQ   s    r   rR   _LowerBound.__hash__       T\\4>>233r   c                    U R                   (       a  SOSnSU R                  R                   SU U R                  < S3$ )N[rU   < >ri   rW   r'   r6   r8   brackets     r   rY   _LowerBound.__repr__   s8    #S4>>**+1WIdll5EQGGr   Nr6   _VersionOrBoundaryri   r]   r[   r\   r^   )rA   rf   r[   r]   r`   rb   r'   r(   r)   r*   r+   rd   r:   rI   rM   rR   rY   r0   r   r   r   rf   rf   {   )     )I#S
64Hr   rf   c                  N    \ rS rSrSrSrS
S jrSS jrSS jrSS jr	SS jr
Srg	)_UpperBound   zUpper bound of a version range.

A version *v* of ``None`` means unbounded above (+inf).
At equal versions, ``v)`` sorts before ``v]`` because an exclusive
bound ends earlier.
rh   c                    Xl         X l        g r   rk   rl   s      r   r:   _UpperBound.__init__   rn   r   c                    [        U[        5      (       d  [        $ U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   rF   r   rG   r6   ri   rH   s     r   rI   _UpperBound.__eq__   rr   r   c                   [        U[        5      (       d  [        $ U R                  c  gUR                  c  gU R                  UR                  :w  a  U R                  UR                  :  $ U R                  (       + =(       a    UR                  $ NFTr   rH   s     r   rM   _UpperBound.__lt__   sh    %--!!<<== <<5==(<<%--//>>!5eoo5r   c                D    [        U R                  U R                  45      $ r   rv   rQ   s    r   rR   _UpperBound.__hash__   rx   r   c                    U R                   (       a  SOSnSU R                  R                   SU R                  < U S3$ )N]rV   r{   r|   r}   r~   r   s     r   rY   _UpperBound.__repr__   s8    #S4>>**+1T\\,<WIQGGr   Nr   r^   )rA   r   r[   r]   r`   rb   r   r   r   r   r   r      r   r   r   Fztuple[_VersionRange]_FULL_RANGEc                    U R                   b  UR                   c  gU R                   UR                   :X  a$  U R                  =(       a    UR                  (       + $ U R                   UR                   :  $ )zHTrue when the range defined by *lower* and *upper* contains no versions.Frk   )loweruppers     r   _range_is_emptyr      sQ    }} 5}}%OO788==5==((r   c                4   / nS=p4U[        U 5      :  a  U[        U5      :  at  X   u  pVX   u  px[        XW5      n	[        Xh5      n
[        X5      (       d  UR	                  X45        Xh:  a  US-  nOUS-  nU[        U 5      :  a  U[        U5      :  a  Mt  U$ )zFIntersect two sorted, non-overlapping range lists (two-pointer merge).r   r   )r    maxminr   append)leftrightresult
left_indexright_index
left_lower
left_upperright_lowerright_upperr   r   s              r   _intersect_rangesr      s    
 #%F  J
s4y
 [3u:%=!%!1
#(#5 J,J,u,,MM5.) #!OJ1K s4y
 [3u:%=  Mr   c                    / U R                   SS QU R                   S   S-   P7n[        R                  " U R                  USS9$ )z5Smallest version in the next prefix: 1.2 -> 1.3.dev0.Nr   r   r=   r!   r@   )r!   r   
from_partsr=   )r6   r!   s     r   _next_prefix_dev0r      sC    >$>goob&9A&=>GGMM7JJr   c                V    [         R                  " U R                  U R                  SS9$ )z7The .dev0 of a version's base release: 1.2 -> 1.2.dev0.r   r   )r   r   r=   r!   r6   s    r   
_base_dev0r     s     GMM7??PQRRr   c                l    [        U [        5      (       d   [        U 5      n U $ U $ ! [         a     g f = fr   )rF   r   r   r   s    r   _coerce_versionr     s=    gw''	g&G N7N  		s   & 
33c                >    U R                   c  U $ U R                  S S9$ )N)local)r   __replace__r   s    r   _public_versionr     s%    }}T**r   c                $    U R                  SSSS9$ )zqThe version that *version* is a post-release of.

1.0.post1 -> 1.0, 1.0a1.post0 -> 1.0a1, 1.0.post0.dev1 -> 1.0.
Nr?   r@   r   r   r   s    r   
_post_baser     s    
 Dd$??r   c                "    U R                  SSS9$ )zREarliest pre-release of *version*.

1.2 -> 1.2.dev0, 1.2.post1 -> 1.2.post1.dev0.
r   Nr@   r   r   r   s    r   _earliest_prereleaser     s    
 1D11r   c                4   U c  g[        U [        5      (       a\  U R                  nUR                  (       a  UR	                  SSSS9$ UR
                  b  UR
                  S-   OSnUR	                  USS9$ U R                  (       d  U $ U R	                  SSSS9$ )z:Smallest non-pre-release version at or above *v*, or None.N)r>   r@   r   r   r   )r?   r   )rF   r2   r6   is_prereleaser   r?   )rB   innerks      r   _nearest_non_prereleaser   &  s     	y!%&&		$$4t$DD !&

 6UZZ!^A  at 44??==Tt4=88r   c                      \ rS rSrSrSrg)r   i;  z
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'
r   N)r'   r(   r)   r*   r+   r0   r   r   r   r   r   ;  s    r   r   c                     \ rS rSrSrSr\SS j5       r\R                  SS j5       r
\R                  SS j5       r\R                  SS j5       r\\R                  SS j5       5       r\R                  SS	 j5       r\R                  SSS jj5       r\R"                    S       SS jj5       r\R"                    S       SS jj5       r\R                    S       SS jj5       rSrg
)r   iG  r   )_strc                    [        U 5      $ )z Internal property for match_argsrc   rQ   s    r   r   BaseSpecifier._strK  s     4yr   c                    g)zv
Returns the str representation of this Specifier-like object. This
should be representative of the Specifier itself.
Nr   rQ   s    r   __str__BaseSpecifier.__str__P      r   c                    g)z6
Returns a hash value for this Specifier-like object.
Nr   rQ   s    r   rR   BaseSpecifier.__hash__W  r   r   c                    g)z
Returns a boolean representing whether or not the two Specifier-like
objects are equal.

:param other: The other object to check against.
Nr   rH   s     r   rI   BaseSpecifier.__eq__]  r   r   c                    g)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   rQ   s    r   prereleasesBaseSpecifier.prereleasesf  r   r   c                    g)zASetter for :attr:`prereleases`.

:param value: The value to set.
Nr   r8   rL   s     r   r   r   o  r   r   Nc                    g)zB
Determines if the given item is contained within this specifier.
Nr   r8   itemr   s      r   containsBaseSpecifier.containsv  r   r   c                    g r   r   r8   iterabler   keys       r   filterBaseSpecifier.filter|       (+r   c                    g r   r   r   s       r   r   r          r   c                    g)z}
Takes an iterable of items and filters them so that only items which
are contained within this specifier are allowed in it.
Nr   r   s       r   r   r     r   r   rb   r`   r^   r[   bool | None)rL   r]   r[   r\   r   )r   rc   r   r   r[   r]   N.r   zIterable[UnparsedVersionVar]r   r   r   r\   r[   zIterator[UnparsedVersionVar]r   zIterable[T]r   r   r   zCallable[[T], UnparsedVersion]r[   zIterator[T]NNr   Iterable[Any]r   r   r   'Callable[[Any], UnparsedVersion] | Noner[   Iterator[Any])r'   r(   r)   r*   rd   __match_args__propertyr   abcabstractmethodr   rR   rI   r   setterr   typingoverloadr   r0   r   r   r   r   r   G  s   IN  	  	 
 	       	 
 __ $(	+.+ !+ 	+
 
&+ + __ $(.1	 ! ,	
 
  	 $(7;			 !	 5		
 
	 	r   r   )	metaclassc            	         \ rS rSr% SrSrSr\R                  " S\-   S-   \R                  \R                  -  5      rSSSS	S
SSSS.rS\S'   S0S1S jjrS2S jrS3S jrS4S jrS5S jrS5S jr\S6S j5       r\R,                  S7S j5       r\S8S j5       r\S8S j5       rS8S jrS8S jr\S9S j5       rS:S jrS;S  jrS<S! jrS=S" jrS>S# jr S=S$ jr!S=S% jr"S=S& jr#S=S' jr$S?S( jr%S?S) jr&S@S* jr'SAS+ jr(SBSCS, jjr)\*RV                    SD       SES- jj5       r,\*RV                    SD       SFS. jj5       r,  SG       SHS/ jjr,Sr-g)Ir   i  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).
)_prereleases_ranges_spec_spec_version_wildcard_splita  
        (?:
            (?:
                # 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   
_operatorsNc                   U R                   R                  U5      (       d  [        SU< 35      eUR                  5       nUR	                  S5      (       a  USS USS R                  5       pCOEUR	                  S5      (       a  USS USS R                  5       pCOUSS USS R                  5       pCX44U l        X l        SU l        SU l        SU l	        g)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
  N   )r  r  r  r  r	     r   )
_regex	fullmatchr   strip
startswithr   r   r   r   r   )r8   specr   operatorr6   s        r   r:   Specifier.__init__  s     {{$$T**"%8#ABBzz|??5!! $Ra$qr(..*:g__;<< $Ra$qr(..*:g $Ra$qr(..*:g'/&9
 ( :> >B 8<r   c                    U R                   b"  U R                   S   U:X  a  U R                   S   $ [        U5      nUc  gX4U l         U$ )zDOne element cache, as only one spec Version is needed per Specifier.Nr   r   )r   r   )r8   r6   version_specifiers      r   _get_spec_versionSpecifier._get_spec_version<  sV    )d.@.@.Cw.N%%a((+G4$%9  r   c                2    U R                  U5      nUc   eU$ )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  )r8   r6   spec_versions      r   _require_spec_versionSpecifier._require_spec_versionH  s&     --g6'''r   c                   U R                   b  U R                   $ U R                  nU R                  nUS:X  a  [        U l         [        $ UR	                  S5      (       a  U R                  X5      nOU R                  X5      nX0l         U$ )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.
r
  .*)r   r  r6   r   endswith_wildcard_ranges_standard_ranges)r8   opver_strr   s       r   
_to_rangesSpecifier._to_rangesR  sy     <<#<<]],,;&DLD!!**27F**27Fr   c                    U R                  US S 5      n[        U5      n[        U5      nUS:X  a  [        US5      [	        US5      4/$ [
        [	        US5      4[        US5      [        4/$ )Nr  TF)r  r   r   rf   r   _NEG_INF_POS_INF)r8   r#  r$  baser   r   s         r   r!  Specifier._wildcard_rangesj  sy    ))'#2,74 !$': -{5%/HIJJ {5%01%x0
 	
r   c                ,   U R                  U5      nUS:X  a  [        US5      [        4/$ US:X  a+  [        [	        [        U[        R                  5      S5      4/$ US:X  a  UR                  b0  UR                  UR                  S-   S S9n[        US5      [        4/$ UR                  b1  UR                  UR                  S-   SS S9n[        US5      [        4/$ [        [        U[        R                  5      S	5      [        4/$ US
:X  aB  UR                  (       a  UOUR                  SS S9nU[        ::  a  / $ [        [	        US	5      4/$ SU;   n[        U[        R                  5      nU(       a  UOUnUS:X  a  [        US5      [	        US5      4/$ US:X  a$  [        [	        US	5      4[        US	5      [        4/$ US:X  a>  UR                  UR                  S S S9n	[        US5      [	        [        U	5      S	5      4/$ [!        SU< 35      e)Nr	  Tr  r}   r   r   r   r   Fr{   +r  r  r  r   )r!   Unknown operator: )r  rf   r*  r)  r   r2   r%   r.   r@   r   r?   r/   r   r   r!   r   
ValueError)
r8   r#  r$  rB   	lower_verr   	has_localafter_localsr   prefixs
             r   r"  Specifier._standard_rangesw  s+   &&w/: D)8455:  0M4N4N OQUV  9uu  MMaeeaitMD	$Y5x@AAvv!MMqvvzqMM	$Y5x@AA   0M4M4M NPUV  9 Aammm.NE$	{5%89:: 7N	'=+E+EFL: D);ud+CDEE:;q%01UE*H5 
 :]]199Sb>]:FQ%{3DV3Le'TU  -bV455r   c                    U R                   b  U R                   $ U R                  u  pUS:X  a  gUS:X  a  UR                  S5      (       a  gU R                  U5      nUc  g UR                  $ )Nr  Fr  r  )r   r   r   r  r   )r8   r  version_strr6   s       r   r   Specifier.prereleases  sz     ($$$ !%

t t 4 4T : : ((5? $$$r   c                    Xl         g r   )r   r   s     r   r   r8    s    !r   c                     U R                   S   $ )zHThe operator of this specifier.

>>> Specifier("==1.2.3").operator
'=='
r   r   rQ   s    r   r  Specifier.operator       zz!}r   c                     U R                   S   $ )zIThe version of this specifier.

>>> Specifier("==1.2.3").version
'1.2.3'
r   r;  rQ   s    r   r6   Specifier.version  r=  r   c                    U R                   b  SU R                  < 3OSnSU R                  R                   S[	        U 5      < U S3$ )a  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= r{   rU   )>r   r   rW   r'   rc   r8   r>   s     r   rY   Specifier.__repr__  sU       , T--01 	 4>>**+1SYM#bAAr   c                4    SR                   " U R                  6 $ )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{}{})formatr   rQ   s    r   r   Specifier.__str__  s     }}djj))r   c                    U R                   u  pUS:X  d  UR                  S5      (       a  X4$ U R                  U5      n[        X1S:g  S9nX4$ )Nr
  r  r  strip_trailing_zero)r   r   r  r   )r8   r  r6   r  canonical_versions        r   _canonical_specSpecifier._canonical_spec  s]     JJu 0 0 6 6$$11':04/?
 **r   c                ,    [        U R                  5      $ r   )rP   rN  rQ   s    r   rR   Specifier.__hash__  s    D(())r   c                   [        U[        5      (       a   U R                  [        U5      5      nO [        XR                  5      (       d  [        $ U R
                  UR
                  :H  $ ! [         a	    [        s $ f = f)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
)rF   rc   rW   r   rG   rN  rH   s     r   rI   Specifier.__eq__  sm    & eS!!&s5z2 E>>22!!##u'<'<<< $ &%%&s   A+ +A>=A>c                >    [        U SU R                  U    35      nU$ )N	_compare_)getattrr  )r8   r#  operator_callables      r   _get_operatorSpecifier._get_operator1  s+    .5Idoob123/
 ! r   c           
         [        [        [        R                  " [        [        U5      5      5      S S 5      nUS-  nU R                  X5      =(       a    U R                  X5      $ )Nr   r  )_version_joinlist	itertools	takewhile_is_not_suffix_version_split_compare_greater_than_equal_compare_equal)r8   prospectiver  r4  s       r   _compare_compatibleSpecifier._compare_compatible7  s`     $$^^D5IJKCRP

 	$00C 
4	
r   c                z    U R                   nUc+  [        USS SS9n[        U5      nU[        U5      4nX l         U$ )zCached split of a wildcard spec into components and numeric length.

>>> Specifier("==1.*")._get_wildcard_split("1.*")
(['0', '1'], 2)
>>> Specifier("==3.10.*")._get_wildcard_split("3.10.*")
(['0', '3', '10'], 3)
Nr(  FrK  )r   r   r`  _numeric_prefix_len)r8   r  wildcard_split
normalized
split_specs        r   _get_wildcard_splitSpecifier._get_wildcard_splitK  sM     --!-d3BiUSJ'
3J(*=j*IJN#1 r   c                ,   UR                  S5      (       aN  U R                  U5      u  p4[        [        U5      SS9n[	        U5      n[        Xd5      nUS [        U5       nX:H  $ U R                  U5      n	U	R                  (       d  [        U5      nX:H  $ )Nr  FrK  )	r   rk  r   r   r`  	_left_padr    r  r   )
r8   rc  r  rj  spec_numeric_lennormalized_prospectivesplit_prospectivepadded_prospectiveshortened_prospectiver  s
             r   rb  Specifier._compare_equal[  s    ==+/+C+CD+I(J &:,%&" !//E F "++<!O
 %77HZ$I!(66  55d;L
  %%-k:..r   c                .    U R                  X5      (       + $ r   )rb  r8   rc  r  s      r   _compare_not_equalSpecifier._compare_not_equal  s    &&{999r   c                <    [        U5      U R                  U5      :*  $ r   r   r  rv  s      r   _compare_less_than_equal"Specifier._compare_less_than_equal       {+t/I/I$/OOOr   c                <    [        U5      U R                  U5      :  $ r   rz  rv  s      r   ra  %Specifier._compare_greater_than_equal  r}  r   c                    U R                  U5      nX:  d  gUR                  (       d!  UR                  (       a  U[        U5      :  a  ggr   )r  r   r   r8   rc  spec_strr  s       r   _compare_less_thanSpecifier._compare_less_than  sI     ))(3
 !
 ""))3D99
 r   c                    U R                  U5      nX:  d  gUR                  (       d!  UR                  (       a  [        U5      U:X  a  gUR                  b  [	        U5      U:X  a  ggr   )r  is_postreleaser   r   r   r  s       r   _compare_greater_thanSpecifier._compare_greater_than  se     ))(3
 !
 ##**;'4/ (_[-IT-Q
 r   c                h    [        U5      R                  5       [        U5      R                  5       :H  $ r   rc   r   rv  s      r   _compare_arbitrarySpecifier._compare_arbitrary  s&    ;%%'3t9??+<<<r   c                $    U R                  U5      $ )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
r   r8   r   s     r   __contains__Specifier.__contains__      & }}T""r   c           	     H    [        [        U R                  U/US95      5      $ )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:`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   )r]   r\  r   r   s      r   r   Specifier.contains  s#    2 DdVEFGGr   c                    g r   r   r   s       r   r   Specifier.filter  r   r   c                    g r   r   r   s       r   r   r    r   r   c              #    #    / nSnUb  UOU R                   nU R                  U R                  5      nU H  n[        Uc  UOU" U5      5      n	Sn
U	c5  U R                  S:X  a$  U R	                  XR
                  5      (       a  Uv   OJU R                  S:X  a(  U R	                  Uc  UOU" U5      U R
                  5      n
OU" XR
                  5      n
U
(       d  M  U	c  M  U	R                  (       a  U(       a  SnUv   M  Ub  M  U R                  SLd  M  UR                  U5        M     U(       d  Uc  U R                  SLa  U Sh  vN   gggg N7f)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.
:param key:
    A callable that takes a single argument (an item from the iterable) and
    returns a version string or :class:`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'}]
FNr
  T)	r   rX  r  r   r  r6   r   r   r   )r8   r   r   r   prereleases_versionsfound_non_prereleasesinclude_prereleasesrW  r6   parsed_versionmatchs              r   r   r  
  sQ    F  " % '2K8H8H 	
 !..t}}=  G,WWVNE%==E)d.E.E\\/ / "M%'//"{GGdll *.,,Gu3%337J,0)!M (T->->e-K(//8/  8 &#!!.+++ / $ & ,s*   CEE !EE3E	E
	ErB  N)r  rc   r   r   r[   r\   )r6   rc   r[   Version | None)r6   rc   r[   r   r[   Sequence[_VersionRange])r#  rc   r$  rc   r[   list[_VersionRange]r   rL   r   r[   r\   rb   )r[   ztuple[str, str]r`   r^   )r#  rc   r[   CallableOperator)rc  r   r  rc   r[   r]   )r  rc   r[   ztuple[list[str], int])rc  r   r  rc   r[   r]   )rc  zVersion | strr  rc   r[   r]   )r   zstr | Versionr[   r]   r   )r   UnparsedVersionr   r   r[   r]   r   r   r   r   r   ).r'   r(   r)   r*   r+   rd   _specifier_regex_strrecompileVERBOSE
IGNORECASEr  r  __annotations__r:   r  r  r%  r!  r"  r   r   r   r  r6   rY   r   rN  rR   rI   rX  rd  rk  rb  rw  r{  ra  r  r  r  r  r   r   r   r   r0   r   r   r   r   r     s   IZx ZZ%%.

R]]0JF
 "	J 	$<L
!0
<6| % %6 " "    B$* + +*=:!
( "/H:PP2@=#*H6 __ $(	+.+ !+ 	+
 
&+ + __ $(.1	 ! ,	
 
  $(7;	O,O, !O, 5	O,
 
O, O,r   r   z([0-9]+)((?:a|b|c|rc)[0-9]+)c              #  p  #    / n/ nSnU  H  n[        Uc  UOU" U5      5      nUc0  U(       a  Uv   O"UR                  U5        UR                  U5        ML  UR                  (       d  U(       d  U Sh  vN   SnUv   Mv  U(       a  M  UR                  U5        M     U(       d  U Sh  vN   gg N= N7f)z?Filter per PEP 440: exclude prereleases unless no finals exist.FNT)r   r   r   )r   r   all_nonfinalarbitrary_stringsfound_finalr   parseds          r   _pep440_filter_prereleasesr  _  s      !L#%K #d)D> 
!((.##D)##,,,"J {%1 6   - 	 s*   A2B64B25B6
!B6+B4,B64B6c                2   / nU R                  S5      u  p#nUR                  U=(       d    S5        UR                  S5       HQ  n[        R	                  U5      nU(       a!  UR                  UR                  5       5        M@  UR                  U5        MS     U$ )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_regexr  extendgroups)r6   r   r=   _restr   r  s          r   r`  r`    sw     F'',NEd
MM%,3

3''-MM%,,.)MM$   Mr   c                4    U tpU SSR                  U5       3$ )zJoin 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%     LEWAchhtn%&&r   c                8   ^  [        U 4S jS 5       5      (       + $ )Nc              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )r  ).0r4  segments     r   	<genexpr>!_is_not_suffix.<locals>.<genexpr>  s#      1Pv6""1Ps   !)r@   abrcr?   )any)r  s   `r   r_  r_    s"     1P   r   c                V    SnU  H   nUR                  5       (       d    U$ US-  nM"     U$ )zwCount leading numeric components in a :func:`_version_split` result.

>>> _numeric_prefix_len(["0", "1", "2", "a1"])
3
r   r   )isdigit)r  countr  s      r   rg  rg    s:     E  L 	
  Lr   c                R    [        U 5      nX-
  nUS::  a  U $ / U SU QS/U-  QXS Q$ )zPad a :func:`_version_split` result with ``"0"`` segments to reach
``target_numeric_len`` numeric components.  Suffix segments are preserved.

>>> _left_pad(["0", "1", "a1"], 4)
['0', '1', '0', '0', 'a1']
r   Nr  )rg  )r  target_numeric_lennumeric_len
pad_neededs       r   rn  rn    sJ     &e,K#1JQNU<K NSEJ$6N%:MNNr   c                    U u  pnUS:X  a  UR                  S5      (       d  S$ S$ US;   a  gUS:X  a  gUS:X  a  UR                  S5      (       d  S	$ S
$ US:X  a  g[        SU< 35      e)a,  Sort key for Cost Based Ordering of specifier operators in _filter_versions.

Operators run sequentially on a shrinking candidate set, so operators that
reject the most versions should run first to minimize work for later ones.

Tier 0: Exact equality (==, ===), likely to narrow candidates to one version
Tier 1: Range checks (>=, <=, >, <), cheap and usually reject a large portion
Tier 2: Wildcard equality (==.*) and compatible release (~=), more expensive
Tier 3: Exact !=, cheap but rarely rejects
Tier 4: Wildcard !=.*, expensive and rarely rejects
r  r  r   r  )r	  r  r}   r{   r   r  r  r     r
  r/  )r   r0  )op_entryr  verr#  s       r   _operator_costr    s     JAB	TzT**q11	##	Tz	TzT**q11	U{
)"0
11r   c                     \ rS rSrSrSr  S     SS jjrSS jr\SS j5       r	\	R                  SS j5       r	SS	 jrSS
 jrS S jrS!S jrS"S jrS S jrS#S jrS$S jrS%S jrS%S jrS%S jrS&S jr  S'       S(S jjr\R2                    S)       S*S jj5       r\R2                    S)       S+S jj5       r  S'       S,S jjr S-       S.S jjrSrg)/r   i  zThis 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.
)_canonicalized_has_arbitrary_is_unsatisfiabler   _resolved_ops_specsNc                   [        U[        5      (       an  UR                  S5       Vs/ s H)  o3R                  5       (       d  M  UR                  5       PM+     nn[	        [        [        U5      5      U l        SU;   U l        O1[	        U5      U l        [        S U R                   5       5      U l        [        U R                  5      S:*  U l        SU l        X l        SU l        gs  snf )aL  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.
,r
  c              3  >   #    U  H  nS [        U5      ;   v   M     g7fr
  Nr   r  ss     r   r  (SpecifierSet.__init__.<locals>.<genexpr>  s     %K{!es1vo{s   r   N)rF   rc   r  r  tuplemapr   r  r  r  r    r  r  r   r  )r8   
specifiersr   r  split_specifierss        r   r:   SpecifierSet.__init__  s    , j#&& 4>3C3CC3HV3HaGGI		3HV16s9FV7W1XDK"':"5D
+DK #&%Kt{{%K"KD!$++.!3MQ (.2%  Ws   C'C'c           	         U R                   (       dN  [        [        R                  [	        U R
                  [        S95      5      U l        SU l         SU l        SU l        U R
                  $ )zBDeduplicate, sort, and cache specs for order-sensitive operations.r   TN)	r  r  dictfromkeyssortedr  rc   r  r  rQ   s    r   _canonical_specsSpecifierSet._canonical_specs$  sM    ""fT[[c.J KLDK"&D!%D%)D"{{r   c                    U R                   b  U R                   $ U R                  (       d  g [        S U R                   5       5      (       a  gg )Nc              3  8   #    U  H  oR                   v   M     g 7fr   r  r  s     r   r  +SpecifierSet.prereleases.<locals>.<genexpr><  s     2k}}k   T)r   r  r  rQ   s    r   r   SpecifierSet.prereleases-  sE     ($$$
 {{ 2dkk222r   c                    Xl         S U l        g r   )r   r  r   s     r   r   r  A  s    !!%r   c                    U R                   b  SU R                  < 3OSnSU R                  R                   S[	        U 5      < U S3$ )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)>
rA  rB  r{   rU   rC  rD  rE  s     r   rY   SpecifierSet.__repr__F  sU       , T--01 	 4>>**+1SYM#bAAr   c                N    SR                  S U R                  5        5       5      $ )a6  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  8   #    U  H  n[        U5      v   M     g 7fr   r   r  s     r   r  'SpecifierSet.__str__.<locals>.<genexpr>f  s     @(?1A(?r  )r  r  rQ   s    r   r   SpecifierSet.__str__[  s"     xx@(=(=(?@@@r   c                4    [        U R                  5       5      $ r   )rP   r  rQ   s    r   rR   SpecifierSet.__hash__h  s    D))+,,r   c                $   [        U[        5      (       a  [        U5      nO[        U[        5      (       d  [        $ [        5       nU R                  UR                  -   Ul        [        UR                  5      S:*  Ul        U R                  =(       d    UR                  Ul        SUl        U R                  b  U R                  UR                  :X  a  UR                  Ul	        U$ UR                  c  U R                  Ul	        U$ [        S5      e)aR  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.)rF   rc   r   rG   r  r    r  r  r  r   r0  )r8   rA   	specifiers      r   __and__SpecifierSet.__and__k  s     eS!! 'EE<00!! N	;;5	#&y'7'7#8A#=	 #'#6#6#N%:N:N	 "&	 $(9(9U=O=O(O%*%7%7I"  '%)%6%6I" 	 X r   c                    [        U[        [        45      (       a  [        [        U5      5      nO[        U[        5      (       d  [        $ U R                  5       UR                  5       :H  $ )a1  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
)rF   rc   r   r   rG   r  rH   s     r   rI   SpecifierSet.__eq__  sT    & ec9-.. U,EE<00!!$$&%*@*@*BBBr   c                ,    [        U R                  5      $ )z7Returns the number of specifiers in this specifier set.)r    r  rQ   s    r   __len__SpecifierSet.__len__  s    4;;r   c                ,    [        U R                  5      $ )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  rQ   s    r   __iter__SpecifierSet.__iter__  s     DKK  r   c                    U R                   nSnU H:  nUc  UR                  5       nM  [        X#R                  5       5      nU(       a  M:    O   Uc  [        S5      eU$ )zIntersect all specifiers into a single list of version ranges.

Returns an empty list when unsatisfiable.  ``===`` specs are
modeled as full range; string matching is checked separately
by :meth:`_check_arbitrary_unsatisfiable`.
Nz _get_ranges called with no specs)r  r%  r   RuntimeError)r8   specsr   r  s       r   _get_rangesSpecifierSet._get_ranges  s\     15A~*6<<>Bv  >ABBr   c                
   U R                   nUb  U$ U R                  (       d  SU l         gU R                  5       (       + nU(       d  U R                  5       nU(       d  U R                  SL a  U R                  5       nX l         U$ )aV  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
F)r  r  r  _check_arbitrary_unsatisfiabler   _check_prerelease_only_ranges)r8   cachedr   s      r   is_unsatisfiableSpecifierSet.is_unsatisfiable  sw     ''M{{%*D"%%''88:F$**e3779F!'r   c                    U R                  5        Ha  u  p[        UR                  5      nUc    gUR                  b  X2R                  :  a    gX2R                  :X  d  MN  UR                  (       d  Ma    g   g)zxWith prereleases=False, check if every range contains only
pre-release versions (which would be excluded from matching).FT)r  r   r6   ri   )r8   r   r   nearests       r   r  *SpecifierSet._check_prerelease_only_ranges  s_     !,,.LE-emm<G}}$--(?--'EOOO / r   c                  ^^ U R                    Vs/ s H  oR                  S:X  d  M  UPM     nnU(       d  gUS   R                  R                  5       m[	        U4S jUSS  5       5      (       a  g[        US   R                  5      mU R                  SL a  Tb  TR                  (       a  gU R                    Vs/ s H  oR                  S:w  d  M  UPM     nnU(       d  gTc  g[        U4S jU 5       5      (       + $ s  snf s  snf )	zCheck === (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.
r
  Fr   c              3  \   >#    U  H!  oR                   R                  5       T:g  v   M#     g 7fr   )r6   r   )r  r  firsts     r   r  >SpecifierSet._check_arbitrary_unsatisfiable.<locals>.<genexpr>  s     A=ayy E)=s   ),r   NTc              3  D   >#    U  H  oR                  T5      v   M     g 7fr   r  )r  r  	candidates     r   r  r    s     ?hzz),,hs    )	r  r  r6   r   r  r   r   r   all)r8   r  r  standardr  r  s       @@r   r  +SpecifierSet._check_arbitrary_unsatisfiable  s     !%C1zzU/BQ	C !$$**,A9QR=AAA $IaL$8$89	
 %%''#{{B{!jjE.AA{B?h????= D, Cs   DD=DDc                $    U R                  U5      $ )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 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  SpecifierSet.__contains__  r  r   c           	         [        U5      nUb  U(       a  UR                  (       a  SnUb&  U R                  (       a  [        U[        5      (       d  UnOUn[        [        U R                  U/US95      5      $ )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   r  rF   r   r]   r\  r   )r8   r   r   	installedr6   
check_items         r   r   SpecifierSet.contains4  sh    @ "$'91F1FK ?t22:dG;T;TJ JDj\{KLMMr   c                    g r   r   r   s       r   r   SpecifierSet.filtera  r   r   c                    g r   r   r   s       r   r   r)  i  r   r   c                  ^^ Uc  U R                   b  U R                   nU R                  (       ad  [        U R                  5      S:X  a$  U R                  S   R                  UUc  SOUTS9nOU R	                  UTUc  SOUS9nUb  U$ [        UT5      $ USL a  [        U5      $ USL a  UU4S jU 5       $ [        UT5      $ )aC  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.
:param key:
    A callable that takes a single argument (an item from the iterable) and
    returns a version string or :class:`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']
r   r   T)r   r   r  Fc              3     >#    U  H4  n[        Tc  UOT" U5      5      =m b  TR                  (       a  M0  Uv   M6     g 7fr   )r   r   )r  r   r   r6   s     r   r  &SpecifierSet.filter.<locals>.<genexpr>  sB      $D /T SSW"00 $s   /?	?)r   r  r    r   _filter_versionsr  r  )r8   r   r   r   filteredr6   s      ` @r   r   r)  q  s    d 4#3#3#?**K ;; 4;;1$;;q>00(3(; 1   00(3(; 1  &-h<< $>!%$  *(C88r   c              #    ^^^#    U R                   c$  [        S U R                   5       [        S9U l         U R                   nUSL nU Hz  m[	        Tc  TOT" T5      5      mTc"  [        U4S jU 5       5      (       a  Tv   M<  M>  U(       a  TR                  (       a  MX  [        UUU4S jU 5       5      (       d  Mv  Tv   M|     g7f)a  Filter versions against all specifiers in a single pass.

Uses Cost Based Ordering: specifiers are sorted by _operator_cost so
that cheap range operators reject versions early, avoiding expensive
wildcard or compatible operators on versions that would have been
rejected anyway.
Nc              3     #    U  H7  nUR                  UR                  5      UR                  UR                  4v   M9     g 7fr   )rX  r  r6   )r  r  s     r   r  0SpecifierSet._filter_versions.<locals>.<genexpr>  s5       + ''6dmmT +s   ?Ar  Fc              3     >#    U  H>  u  pnUS :H  =(       a*    [        T5      R                  5       UR                  5       :H  v   M@     g7fr  r  )r  r  r  r#  r   s       r   r  r2    s>      &)
 %KDCIOO$5$DD&)s   AA	c              3     >#    U  HL  u  pnUS :X  a5  [        Tc  TOT" T5      5      R                  5       UR                  5       :H  OU" TU5      v   MN     g7fr  r  )r  op_fnr  r#  r   r   r  s       r   r  r2    s[       '*NE ; CKDSY7==?399;N63'( '*s   AA)r  r  r  r  r   r  r   )r8   r   r   r   opsexclude_prereleasesr   r  s     `   @@r   r.  SpecifierSet._filter_versions  s      %!' $ #"D   )U2D$S[Tc$iHF~ &)   J	
 %)=)=  '*	   
' s   B6C?	Cr  )r  zstr | Iterable[Specifier]r   r   r[   r\   )r[   ztuple[Specifier, ...]r   r  rb   r`   )rA   zSpecifierSet | strr[   r   r^   )r[   zIterator[Specifier]r  )r[   r]   )r   r  r[   r]   r   )r   r  r   r   r%  r   r[   r]   r   r   r   r   r   )r   r   r   r   r   r   r[   r   )r'   r(   r)   r*   r+   rd   r:   r  r   r   r   rY   r   rR   r   rI   r  r	  r  r  r  r  r  r   r   r   r   r.  r0   r   r   r   r   r     s   I 13#'+3-+3 !+3 
	+3Z  & & &B*A-BC4 !,B%@N#0 $(!%	+N+N !+N 	+N
 
+NZ __ $(	+.+ !+ 	+
 
&+ + __ $(.1	 ! ,	
 
  $(7;	^9^9 !^9 5	^9
 
^9H $(	,, 5, !	,
 
, ,r   r   )r[   	list[str])r!   tuple[int, ...]r[   r:  )r   rf   r   r   r[   r]   )r   r  r   r  r[   r  )r6   r   r[   r   )r6   r  r[   r  )rB   r   r[   r  )r   r   r   r   r[   r   )r6   rc   r[   r9  )r  r9  r[   rc   )r  rc   r[   r]   )r  r9  r[   ra   )r  r9  r  ra   r[   r9  )r  z!tuple[CallableOperator, str, str]r[   ra   )Fr+   
__future__r   r   r,   	functoolsr]  r  r   r   r   r   r   r   r	   r
   r   utilsr   r6   r   r   r   r   r   rc   r  r   r]   r  r   r  r#   Enumr%   total_orderingr2   rf   r   TYPE_CHECKINGr   r  _VersionRanger)  r*  r   r   r   r   r   r   r   r   r   r   r0  r   ABCMetar   r   r  r  r  r`  r[  r_  rg  rn  r  r   r   r   r   <module>rC     sD   # 
    	  U U U ' , CL%1I WcND01   'x0n 0=DII  ;Q ;Q ;Q| %H %H %HP %H %H %HP 
w(8$>? +{23MtU#tU#&.%9$;! ;)
!" 4KS
+@2999*	z 	Ockk Od@, @,F 

:;' ' "I' ' T,'O26V= Vr   