
    3 jZ                      % 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	r	SSK	J
r
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  \R0                  S:  a  SS	K	Jr  O\
(       a  SS	KJr  / S
QrS:S jrS;S jrS<S jr\" S5      r\\\ 4   r!\" S\!S9r"\\\ /\#4   r$\" S5      r%S\&S'   S=S jr' " S S\RP                  5      r)\RT                   " S S5      5       r+\RT                   " S S5      5       r,\RT                   " S S5      5       r-\	R                  (       a  \\\+S4   r.\/\,\-4   r0\," SS5      r1\-" SS5      r2\1\244r3S\&S'   S>S  jr4      S?S! jr5S@S" jr6S@S# jr7SAS$ jr8S@S% jr9S@S& jr:S@S' jr;    SBS( jr< " S) S*\=5      r> " S+ S,\R~                  S-9r@ " S. S/\@5      rA\R                  " S05      rC      SCS1 jrDSDS2 jrESES3 jrFSFS4 jrGSGS5 jrHSHS6 jrISIS7 jrJ " S8 S9\@5      rKg)Jz
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
    )annotationsN)	TYPE_CHECKINGAnyCallableFinalIterableIteratorSequenceTypeVarUnion   )canonicalize_version)InvalidVersionVersion)   
   )	TypeGuard)BaseSpecifierInvalidSpecifier	SpecifierSpecifierSetc                     [         $ N)__all__     e/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/packaging/specifiers.py__dir__r   0   s    Nr   c                   [        U [        5      =(       aB    [        U 5      S:H  =(       a-    [        U S   [        5      =(       a    [        U S   [        5      $ )N   r   r   )
isinstancetuplelenstr)specs    r   _validate_specr&   4   sI    4 	%IN	%tAw$	% tAw$	r   c               8    U S L =(       d    [        U [        5      $ r   )r!   bool)pres    r   _validate_prer*   =   s    $;/*S$//r   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)r#   )releaseends     r   _trim_releaser2   J   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)_BoundaryKindR   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   r4   r4   R   s    ?99;L))+Kr   r4   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
)_BoundaryVersionY   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   )rE   rC   r2   r0   rD   )selfrE   kinds      r   __init___BoundaryVersion.__init__q   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)rE   epochr2   r0   rD   r)   rC   r4   r=   postdev)rG   othervs      r   
_is_family_BoundaryVersion._is_familyv   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   )r!   rA   rE   rC   NotImplementedrG   rO   s     r   __eq___BoundaryVersion.__eq__   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   )r!   rA   rE   rC   valuerQ   rU   s     r   __lt___BoundaryVersion.__lt__   sr    e-..||u}},||emm33::##ekk&7&777??5))BdllU.BBr   c                D    [        U R                  U R                  45      $ r   )hashrE   rC   rG   s    r   __hash___BoundaryVersion.__hash__   s    T\\4::.//r   c                ~    U R                   R                   SU R                  < SU R                  R                   S3$ )N(z, ))	__class__r6   rE   rC   namer^   s    r   __repr___BoundaryVersion.__repr__   s4    ..))*!DLL+;2djjoo=NaPPr   N)rE   r   rH   r4   returnNone)rO   r   rh   r(   rO   objectrh   r(   )rO   z_BoundaryVersion | Versionrh   r(   rh   intrh   r$   )r6   r7   r8   r9   r:   	__slots__rI   rQ   rV   rZ   r_   rf   r?   r   r   r   rA   rA   Y   s.    ( 9I?
<
C0Qr   rA   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.
	inclusiverE   c                    Xl         X l        g r   rE   rt   rG   rE   rt   s      r   rI   _LowerBound.__init__       "r   c                    [        U[        5      (       d  [        $ U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   r!   rq   rT   rE   rt   rU   s     r   rV   _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                  (       + $ )NFr{   rU   s     r   rZ   _LowerBound.__lt__   st    %--!!<<==,,== <<5==(<<%--//~~5eoo"55r   c                D    [        U R                  U R                  45      $ r   r]   rE   rt   r^   s    r   r_   _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[rb   < >rt   rd   r6   rE   rG   brackets     r   rf   _LowerBound.__repr__   s8    #S4>>**+1WIdll5EQGGr   NrE   _VersionOrBoundaryrt   r(   rh   ri   rj   )rO   rq   rh   r(   rl   rn   r6   r7   r8   r9   r:   ro   rI   rV   rZ   r_   rf   r?   r   r   r   rq   rq      )     )I#S
64Hr   rq   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.
rs   c                    Xl         X l        g r   rv   rw   s      r   rI   _UpperBound.__init__   ry   r   c                    [        U[        5      (       d  [        $ U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   r!   r   rT   rE   rt   rU   s     r   rV   _UpperBound.__eq__   r}   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   rU   s     r   rZ   _UpperBound.__lt__   sh    %--!!<<== <<5==(<<%--//>>!5eoo5r   c                D    [        U R                  U R                  45      $ r   r   r^   s    r   r_   _UpperBound.__hash__   r   r   c                    U R                   (       a  SOSnSU R                  R                   SU R                  < U S3$ )N]rc   r   r   r   r   r   s     r   rf   _UpperBound.__repr__   s8    #S4>>**+1T\\,<WIQGGr   Nr   rj   )rO   r   rh   r(   rl   rn   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.Frv   )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   rL   r0   rN   )r0   r   
from_partsrL   )rE   r0   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   rL   r0   rE   s    r   
_base_dev0r     s     GMM7??PQRRr   c                l    [        U [        5      (       d   [        U 5      n U $ U $ ! [         a     g f = fr   )r!   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rM   rN   r   r   r   s    r   
_post_baser   3  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rN   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)   rN   r   r   r   )rM   r   )r!   rA   rE   is_prereleaser   rM   )rP   innerks      r   _nearest_non_prereleaser   C  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   iX  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)r6   r7   r8   r9   r:   r?   r   r   r   r   r   X  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   id  r   )_strc                    [        U 5      $ )z Internal property for match_argsr$   r^   s    r   r   BaseSpecifier._strh  s     4yr   c                    g)zv
Returns the str representation of this Specifier-like object. This
should be representative of the Specifier itself.
Nr   r^   s    r   __str__BaseSpecifier.__str__m      r   c                    g)z6
Returns a hash value for this Specifier-like object.
Nr   r^   s    r   r_   BaseSpecifier.__hash__t  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   rU   s     r   rV   BaseSpecifier.__eq__z  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   r^   s    r   prereleasesBaseSpecifier.prereleases  r   r   c                    g)zASetter for :attr:`prereleases`.

:param value: The value to set.
Nr   rG   rY   s     r   r   r     r   r   Nc                    g)zB
Determines if the given item is contained within this specifier.
Nr   rG   itemr   s      r   containsBaseSpecifier.contains  r   r   c                    g r   r   rG   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   rn   rl   rj   rh   bool | None)rY   r(   rh   ri   r   )r   r$   r   r   rh   r(   N.r   zIterable[UnparsedVersionVar]r   r   r   ri   rh   zIterator[UnparsedVersionVar]r   zIterable[T]r   r   r   zCallable[[T], UnparsedVersion]rh   zIterator[T]NNr   Iterable[Any]r   r   r   'Callable[[Any], UnparsedVersion] | Nonerh   Iterator[Any])r6   r7   r8   r9   ro   __match_args__propertyr   abcabstractmethodr   r_   rV   r   setterr   typingoverloadr   r?   r   r   r   r   r   d  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'   S2S3S jjrS4S jrS5S jrS6S jrS7S jrS7S jr\S8S j5       r\R,                  S9S j5       rS:S jrS;S jr\S<S j5       r\S<S j5       rS<S jrS<S jr\S=S  j5       rS>S! jrS?S" jrS@S# jr SAS$ jr!SBS% jr"SAS& jr#SAS' jr$SAS( jr%SAS) jr&SCS* jr'SCS+ jr(SDS, jr)SES- jr*SFSGS. jjr+\,RZ                    SH       SIS/ jj5       r.\,RZ                    SH       SJS0 jj5       r.  SK       SLS1 jjr.Sr/g)Mr   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).

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

.. versionchanged:: 26.2

    Added a stable pickle format. Pickles created with packaging 26.2+ can
    be unpickled with future releases.  Backward compatibility with pickles
    from packaging < 26.2 is supported but may be removed in a future
    release.
)_prereleases_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  Nr   )r  r  r  r  r  r    r   )
_regex	fullmatchr   strip
startswithr  r  r  r  r  )rG   r%   r   operatorrE   s        r   rI   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   )rG   rE   version_specifiers      r   _get_spec_versionSpecifier._get_spec_versionc  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   )rG   rE   spec_versions      r   _require_spec_versionSpecifier._require_spec_versiono  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  rE   r   endswith_wildcard_ranges_standard_ranges)rG   opver_strr   s       r   
_to_rangesSpecifier._to_rangesy  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   rq   r   _NEG_INF_POS_INF)rG   r+  r,  baser   r   s         r   r)  Specifier._wildcard_ranges  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   )r0   Unknown operator: )r$  rq   r2  r1  r   rA   r4   r=   rN   r   rM   r>   r   r.   r0   r   
ValueError)
rG   r+  r,  rP   	lower_verr-   	has_localafter_localsr   prefixs
             r   r*  Specifier._standard_ranges  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   )rG   r  version_strrE   s       r   r   Specifier.prereleases  sz     ($$$ !%

t t 4 4T : : ((5? $$$r   c                    Xl         g r   )r  r   s     r   r   r@    s    !r   c                2    U R                   U R                  4$ r   )r  r  r^   s    r   __getstate__Specifier.__getstate__  s     

D--..r   c                   S U l         S U l        S U l        [        U[        5      (       a  [        U5      S:X  a1  Uu  p#[        U5      (       a  [        U5      (       a  X l        X0l	        g [        U5      S:X  al  [        US   [        5      (       aT  Uu  pEUR                  S5      nUR                  SS5      n[        U5      (       a  [        U5      (       a  X l        X0l	        g [        U[        5      (       aP  UR                  S5      nUR                  SS5      n[        U5      (       a  [        U5      (       a  X l        X0l	        g [        SU< 35      e)Nr    r   r  r  invalidzCannot restore Specifier from )r  r  r  r!   r"   r#   r&   r*   r  r  dictget	TypeError)rG   stater%   r   _	slot_dicts         r   __setstate__Specifier.__setstate__  s    !#eU##5zQ$)!!$''M+,F,F!%J(3%5zQ:eAh#=#=$ }}W-'mmNIF!$''M+,F,F!%J(3%eT""99W%D))NI>Kd##k(B(B!
$/!8	BCCr   c                     U R                   S   $ )zHThe operator of this specifier.

>>> Specifier("==1.2.3").operator
'=='
r   r  r^   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   rP  r^   s    r   rE   Specifier.version-  rR  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   rb   )>r  r   rd   r6   r$   rG   r)   s     r   rf   Specifier.__repr__6  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  r^   s    r   r   Specifier.__str__H  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   )rG   r  rE   r#  canonical_versions        r   _canonical_specSpecifier._canonical_specR  s]     JJu 0 0 6 6$$11':04/?
 **r   c                ,    [        U R                  5      $ r   )r]   rc  r^   s    r   r_   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
)r!   r$   rd   r   rT   rc  rU   s     r   rV   Specifier.__eq__c  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  )rG   r+  operator_callables      r   _get_operatorSpecifier._get_operator  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)rG   prospectiver%   r<  s       r   _compare_compatibleSpecifier._compare_compatible  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)
Nr0  Fr`  )r  r   ru  _numeric_prefix_len)rG   r%   wildcard_split
normalized
split_specs        r   _get_wildcard_splitSpecifier._get_wildcard_split  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'  Fr`  )	r(  r  r   r   ru  	_left_padr#   r$  r   )
rG   rx  r%   r  spec_numeric_lennormalized_prospectivesplit_prospectivepadded_prospectiveshortened_prospectiver#  s
             r   rw  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   )rw  rG   rx  r%   s      r   _compare_not_equalSpecifier._compare_not_equal  s    &&{999r   c                <    [        U5      U R                  U5      :*  $ r   r   r$  r  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   r  r  s      r   rv  %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   rG   rx  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   r$   r   r  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   rG   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(   rq  r   r   s      r   r   Specifier.contains.  s#    2 DdVEFGGr   c                    g r   r   r   s       r   r   Specifier.filterI  r   r   c                    g r   r   r   s       r   r   r  Q  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   rm  r  r   r  rE   r   r  r   )rG   r   r   r   prereleases_versionsfound_non_prereleasesinclude_prereleasesrl  rE   parsed_versionmatchs              r   r   r  Y  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rW  N)r%   r$   r   r   rh   ri   )rE   r$   rh   Version | None)rE   r$   rh   r   rh   Sequence[_VersionRange])r+  r$   r,  r$   rh   list[_VersionRange]r   rY   r   rh   ri   )rh   z#tuple[tuple[str, str], bool | None]rJ  rk   rh   ri   rn   )rh   ztuple[str, str]rl   rj   )r+  r$   rh   CallableOperator)rx  r   r%   r$   rh   r(   )r%   r$   rh   ztuple[list[str], int])rx  r   r  r$   rh   r(   )rx  zVersion | strr%   r$   rh   r(   )r   zstr | Versionrh   r(   r   )r   UnparsedVersionr   r   rh   r(   r   r   r   r   r   )0r6   r7   r8   r9   r:   ro   _specifier_regex_strrecompileVERBOSE
IGNORECASEr  r  __annotations__rI   r   r$  r-  r)  r*  r   r   r   rC  rM  r  rE   rf   r   rc  r_   rV   rm  ry  r  rw  r  r  rv  r  r  r  r  r   r   r   r   r?   r   r   r   r   r     s#   &IZx ZZ%%.

R]]0JF
 "	J 	$<L
!0
<6| % %6 " "/ DD    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)rE   r   rL   rK  restr   r  s          r   ru  ru    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)
componentsrL   r  s      r   rp  rp    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  ).0r<  segments     r   	<genexpr>!_is_not_suffix.<locals>.<genexpr>  s#      1Pv6""1Ps   !)rN   abrcrM   )any)r  s   `r   rt  rt    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   r|  r|    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  )r|  )r  target_numeric_lennumeric_len
pad_neededs       r   r  r    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  r7  )r(  r8  )op_entryrK  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 jrS*S jr  S+       S,S jjr\R6                    S-       S.S jj5       r\R6                    S-       S/S jj5       r  S+       S0S jjr S1       S2S jjrSrg)3r   i6  aU  This class abstracts handling of a set of version specifiers.

It can be passed a single specifier (``>=3.0``), a comma-separated list of
specifiers (``>=3.0,!=3.1``), or no specifier at all.

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

.. versionchanged:: 26.2

    Added a stable pickle format. Pickles created with
    packaging 26.2+ can be unpickled with future releases.
    Backward compatibility with pickles from
    packaging < 26.2 is supported but may be removed in a future
    release.
)_canonicalized_has_arbitrary_is_unsatisfiabler  _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>t  s     %K{!es1vo{   r   N)r!   r$   r  r  r"   mapr   r  r  r  r#   r  r  r  r  )rG   
specifiersr   r  split_specifierss        r   rI   SpecifierSet.__init__R  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"   rG  fromkeyssortedr  r$   r  r  r^   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  r^   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    s    !!%r   c                2    U R                   U R                  4$ r   )r  r  r^   s    r   rC  SpecifierSet.__getstate__  s     T..//r   c                L   S U l         S U l        [        U[        5      (       Ga  [	        U5      S:X  aw  Uu  p#[        U[        5      (       a^  [        S U 5       5      (       aG  [        U5      (       a7  X l        X0l        [	        U5      S:*  U l	        [        S U 5       5      U l        g [	        U5      S:X  a  [        US   [        5      (       a  Uu  pEUR                  SS5      nUR                  S5      n[        U[        5      (       a  [        [        U[         S95      n[        U[        5      (       ar  [        S	 U 5       5      (       a[  [        U5      (       aK  X l        X0l        [	        U R                  5      S:*  U l	        [        S
 U R                   5       5      U l        g [        U[        5      (       a  UR                  SS5      nUR                  S5      n[        U[        5      (       a  [        [        U[         S95      n[        U[        5      (       ar  [        S U 5       5      (       a[  [        U5      (       aK  X l        X0l        [	        U R                  5      S:*  U l	        [        S U R                   5       5      U l        g [#        SU< 35      e)Nr    c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   r!   r   r  s     r   r  ,SpecifierSet.__setstate__.<locals>.<genexpr>       DeJq)44e   r   c              3  >   #    U  H  nS [        U5      ;   v   M     g7fr  r   r  s     r   r  r    s     -Mu!es1vour  r  r   r  r  c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   r  r  s     r   r  r    r  r  c              3  >   #    U  H  nS [        U5      ;   v   M     g7fr  r   r  s     r   r  r    s     -S{!es1vo{r  c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   r  r  s     r   r  r    s     @%Q
1i00%r  c              3  >   #    U  H  nS [        U5      ;   v   M     g7fr  r   r  s     r   r  r    s     )O;a%3q6/;r  z!Cannot restore SpecifierSet from )r  r  r!   r"   r#   allr*   r  r  r  r  r  rG  rH  	frozensetr  r$   rI  )rG   rJ  specsr   rK  rL  s         r   rM  SpecifierSet.__setstate__  s   !!%eU##5zQ%*"ue,,DeDDD%k22"'K(3%*-e*/D'*--Mu-M*MD'5zQ:eAh#=#=$!h3'mmN;eY//!&C"89Eue,,DeDDD%k22"'K(3%*-dkk*:a*?D'*--St{{-S*SD'eT""IIh+E))N3K%++fU455%((@%@@@!+..#$/!&)$++&6!&;#&))O4;;)O&O#;E9EFFr   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)>
rV  rW  r   rb   rX  rY  rZ  s     r   rf   SpecifierSet.__repr__  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>   s     @(?1A(?r  )r  r  r^   s    r   r   SpecifierSet.__str__  s"     xx@(=(=(?@@@r   c                4    [        U R                  5       5      $ r   )r]   r  r^   s    r   r_   SpecifierSet.__hash__  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.)r!   r$   r   rT   r  r#   r  r  r  r  r8  )rG   rO   	specifiers      r   __and__SpecifierSet.__and__  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
)r!   r$   r   r   rT   r  rU   s     r   rV   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  r^   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  r^   s    r   __iter__SpecifierSet.__iter__D  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)rG   r  r   r  s       r   _get_rangesSpecifierSet._get_rangesN  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  r2  _check_arbitrary_unsatisfiabler   _check_prerelease_only_ranges)rG   cachedr   s      r   is_unsatisfiableSpecifierSet.is_unsatisfiabled  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)r2  r   rE   rt   )rG   r   r   nearests       r   r6  *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   )rE   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  rE   r   r  r   r   r   r  )rG   r  r  standardrB  r?  s       @@r   r5  +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  r!   r   r(   rq  r   )rG   r   r   	installedrE   
check_items         r   r   SpecifierSet.contains  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.filter  r   r   c                    g r   r   r   s       r   r   rL    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   rE   s     r   r  &SpecifierSet.filter.<locals>.<genexpr>^  sB      $D /T SSW"00 $s   /?	?)r   r  r#   r   _filter_versionsr  r-  )rG   r   r   r   filteredrE   s      ` @r   r   rL    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   )rm  r  rE   )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  rK  r  r+  r   s       r   r  rU    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  rU    s[       '*NE ; CKDSY7==?399;N63'( '*s   AA)r  r  r  r  r   r  r   )rG   r   r   r   opsexclude_prereleasesr   r  s     `   @@r   rQ  SpecifierSet._filter_versionsk  s      %!' $ #"D   )U2D$S[Tc$iHF~ &)   J	
 %)=)=  '*	   
' s   B6C?	Cr  )r  zstr | Iterable[Specifier]r   r   rh   ri   )rh   ztuple[Specifier, ...]r   r  )rh   z)tuple[tuple[Specifier, ...], bool | None]r  rn   rl   )rO   zSpecifierSet | strrh   r   rj   )rh   zIterator[Specifier]r  )rh   r(   )r   r  rh   r(   r   )r   r  r   r   rH  r   rh   r(   r   r   r   r   r   )r   r   r   r   r   r   rh   r   )r6   r7   r8   r9   r:   ro   rI   r  r   r   r   rC  rM  rf   r   r_   r%  rV   r*  r.  r2  r8  r6  r5  r  r   r   r   r   rQ  r?   r   r   r   r   r   6  s   $I 13#'+3-+3 !+3 
	+3Z  & & &07Gr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   )rh   	list[str])r%   rk   rh   zTypeGuard[tuple[str, str]])r)   rk   rh   zTypeGuard[bool | None])r0   tuple[int, ...]rh   r]  )r   rq   r   r   rh   r(   )r   r  r   r  rh   r  )rE   r   rh   r   )rE   r  rh   r  )rP   r   rh   r  )r   r   r   r   rh   r   )rE   r$   rh   r\  )r  r\  rh   r$   )r  r$   rh   r(   )r  r\  rh   rm   )r  r\  r  rm   rh   r\  )r  z!tuple[CallableOperator, str, str]rh   rm   )Lr:   
__future__r   r   r;   	functoolsrr  r  sysr   r   r   r   r   r   r	   r
   r   r   utilsr   rE   r   r   version_infor   typing_extensionsr   r   r&   r*   r+   r$   r  r,   r(   r  r.   r  r2   Enumr4   total_orderingrA   rq   r   r   r"   _VersionRanger1  r2  r   r   r   r   r   r   r   r   r   r   r8  r   ABCMetar   r   r  r  r  ru  rp  rt  r|  r  r  r   r   r   r   <module>rh     sp   # 
    	 
 
 
 
 ( ,w +0 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r, r,j 

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