
    &              	          S 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  \\\4   r\" S\S9r\\\/\4   rS	\S
\4S jr " S S\5      r " S S\R4                  S9r " S S\5      r\R:                  " S5      rS	\S
\\   4S jrS\S
\4S jr S\\   S\\   S
\\\   \\   4   4S jr! " S S\5      r"g)z
.. testsetup::

    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
    from packaging.version import Version
    N)	CallableIterableIteratorListOptionalSetTupleTypeVarUnion   )canonicalize_version)VersionUnparsedVersionVar)boundversionreturnc                 F    [        U [        5      (       d  [        U 5      n U $ N)
isinstancer   )r   s    'lib/third_party/packaging/specifiers.py_coerce_versionr   "   s    gw'''"N    c                       \ rS rSrSrSrg)InvalidSpecifier(   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'
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r   (   s    r   r   c            	          \ rS rSr\R
                  S\4S j5       r\R
                  S\4S j5       r	\R
                  S\
S\4S j5       r\\R
                  S\\   4S j5       5       r\R                   S\SS	4S
 j5       r\R
                  SS\S\\   S\4S jj5       r\R
                   SS\\   S\\   S\\   4S jj5       rSrg	)BaseSpecifier4   r   c                     g)zv
Returns the str representation of this Specifier-like object. This
should be representative of the Specifier itself.
Nr   selfs    r   __str__BaseSpecifier.__str__5       r   c                     g)z6
Returns a hash value for this Specifier-like object.
Nr   r'   s    r   __hash__BaseSpecifier.__hash__<   r+   r   otherc                     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   r(   r/   s     r   __eq__BaseSpecifier.__eq__B   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.prereleasesK   r+   r   valueNc                     g)zASetter for :attr:`prereleases`.

:param value: The value to set.
Nr   r(   r7   s     r   r5   r6   T   r+   r   itemr5   c                     g)zB
Determines if the given item is contained within this specifier.
Nr   )r(   r:   r5   s      r   containsBaseSpecifier.contains[   r+   r   iterablec                     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(   r>   r5   s      r   filterBaseSpecifier.filtera   r+   r   r   r   )r   r   r   r    abcabstractmethodstrr)   intr-   objectboolr2   propertyr   r5   setterr<   r   r   r   r@   r"   r   r   r   r$   r$   4   s7      	#  
 	F t   Xd^     $   	S x~   
 	TX !34CKD>	$	% 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S2S\S\\   SS4S jjr\S\4S j5       r\R&                  S\SS4S j5       r\S\4S j5       r\S\4S j5       rS\4S jrS\4S jr\S\\\4   4S j5       rS\4S jrS\S\4S jrS \S\4S! jrS"\ S\S\4S# jr!S"\ S\S\4S$ jr"S"\ S\S\4S% jr#S"\ S\S\4S& jr$S"\ S\S\4S' jr%S"\ S(\S\4S) jr&S"\ S(\S\4S* jr'S"\ S\S\4S+ jr(S,\)\\ 4   S\4S- jr* S3S,\+S\\   S\4S. jjr, S3S/\-\.   S\\   S\/\.   4S0 jjr0S1r1g)4	Specifierk   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).
z8
        (?P<operator>(~=|==|!=|<=|>=|<|>|===))
        a  
        (?P<version>
            (?:
                # The identity operators allow for an escape hatch that will
                # do an exact string match of the version you wish to install.
                # This will not be parsed by PEP 440 and we cannot determine
                # any semantic meaning from it. This operator is discouraged
                # but included entirely as an escape hatch.
                (?<====)  # Only match for the identity operator
                \s*
                [^\s;)]*  # The arbitrary version can be just about anything,
                          # we match everything except for whitespace, a
                          # semi-colon for marker support, and a closing paren
                          # since versions can be enclosed in them.
            )
            |
            (?:
                # The (non)equality operators allow for wild card and local
                # versions to be specified so we have to define these two
                # operators separately to enable that.
                (?<===|!=)            # Only match for equals and not equals

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

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

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

                \s*
                v?
                (?:[0-9]+!)?          # epoch
                [0-9]+(?:\.[0-9]+)*   # release
                (?:                   # pre release
                    [-_\.]?
                    (alpha|beta|preview|pre|a|b|c|rc)
                    [-_\.]?
                    [0-9]*
                )?
                (?:                                   # post release
                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
                )?
                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
            )
        )
        z^\s*z\s*$
compatibleequal	not_equalless_than_equalgreater_than_equal	less_thangreater_than	arbitrary)~===z!=<=>=<>===Nspecr5   r   c                     U R                   R                  U5      nU(       d  [        SU S35      eUR                  S5      R	                  5       UR                  S5      R	                  5       4U l        X 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: ''operatorr   N)_regexsearchr   groupstrip_spec_prereleases)r(   r]   r5   matchs       r   __init__Specifier.__init__   sm     ""4("%9$q#ABB KK
#))+KK	"((*'

 (r   c                     U R                   b  U R                   $ U R                  u  pUS;   a<  US:X  a  UR                  S5      (       a  US S n[        U5      R                  (       a  gg)N)rW   rY   rX   rV   r\   rW   .*TF)rf   re   endswithr   is_prerelease)r(   r`   r   s      r   r5   Specifier.prereleases   sn     ($$$
 !JJ66 4G$4$4T$:$:!#2, w--r   r7   c                     Xl         g r   rf   r9   s     r   r5   ro         !r   c                      U R                   S   $ )zHThe operator of this specifier.

>>> Specifier("==1.2.3").operator
'=='
r   re   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   rt   r'   s    r   r   Specifier.version%  rv   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= rZ   ()>)rf   r5   	__class__r   rD   r(   pres     r   __repr__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{}{})formatre   r'   s    r   r)   Specifier.__str__@  s     }}djj))r   c                 r    [        U R                  S   U R                  S   S:g  S9nU R                  S   U4$ )Nr   r   rV   strip_trailing_zero)r   re   )r(   canonical_versions     r   _canonical_specSpecifier._canonical_specJ  s>    0JJqM!%A$!6
 zz!}///r   c                 ,    [        U R                  5      $ r   )hashr   r'   s    r   r-   Specifier.__hash__R  s    D(())r   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   rD   r~   r   NotImplementedr   r1   s     r   r2   Specifier.__eq__U  sm    & eS!!&s5z2 E>>22!!##u'<'<<< $ &%%&s   A+ +A>=A>opc                 >    [        U SU R                  U    35      nU$ )N	_compare_)getattr
_operators)r(   r   operator_callables      r   _get_operatorSpecifier._get_operatorr  s+    .5Idoob123/
 ! r   prospectivec           
          SR                  [        [        R                  " [        [        U5      5      5      S S 5      nUS-  nU R                  S5      " X5      =(       a    U R                  S5      " X5      $ )N.rk   rY   rW   )joinlist	itertools	takewhile_is_not_suffix_version_splitr   )r(   r   r]   prefixs       r   _compare_compatibleSpecifier._compare_compatiblex  sr     $$^^D5IJKCRP

 	$!!$': 
t?Q?QRV?W@
 	
r   c                 D   UR                  S5      (       aV  [        UR                  SS9n[        US S SS9n[        U5      n[        U5      n[	        Xe5      u  pxUS [        U5       n	X:H  $ [        U5      n
U
R                  (       d  [        UR                  5      nX:H  $ )Nrk   Fr   rl   )rm   r   publicr   _pad_versionlenr   local)r(   r   r]   normalized_prospectivenormalized_spec
split_specsplit_prospectivepadded_prospective_shortened_prospectivespec_versions              r   _compare_equalSpecifier._compare_equal  s     ==%9""&" 349RWXO (8J
 !//E F %11B$O!
 %77HZ$I!(66 #4=L
  %%%k&8&89..r   c                 .    U R                  X5      (       + $ r   )r   r(   r   r]   s      r   _compare_not_equalSpecifier._compare_not_equal  s    &&{999r   c                 D    [        UR                  5      [        U5      :*  $ r   r   r   r   s      r   _compare_less_than_equal"Specifier._compare_less_than_equal      
 {))*gdm;;r   c                 D    [        UR                  5      [        U5      :  $ r   r   r   s      r   _compare_greater_than_equal%Specifier._compare_greater_than_equal  r   r   spec_strc                     [        U5      nX:  d  gUR                  (       d>  UR                  (       a-  [        UR                  5      [        UR                  5      :X  a  ggNFT)r   rn   base_versionr(   r   r   r]   s       r   _compare_less_thanSpecifier._compare_less_than  sR     x 
 ! !!k&?&?{//0GD<M<M4NN
 r   c                 8   [        U5      nX:  d  gUR                  (       d>  UR                  (       a-  [        UR                  5      [        UR                  5      :X  a  gUR                  b-  [        UR                  5      [        UR                  5      :X  a  ggr   )r   is_postreleaser   r   r   s       r   _compare_greater_thanSpecifier._compare_greater_than  s     x 
 ! ""{'A'A{//0GD<M<M4NN ({//0GD<M<M4NN
 r   c                 h    [        U5      R                  5       [        U5      R                  5       :H  $ r   )rD   lowerr   s      r   _compare_arbitrarySpecifier._compare_arbitrary  s&    ;%%'3t9??+<<<r   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")
False
>>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
True
r<   r(   r:   s     r   __contains__Specifier.__contains__      & }}T""r   c                     Uc  U R                   n[        U5      nUR                  (       a  U(       d  gU R                  U R                  5      nU" X0R
                  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 uses :attr:`prereleases` to determine
    whether or not prereleases are allowed.

>>> Specifier(">=1.2.3").contains("1.2.3")
True
>>> Specifier(">=1.2.3").contains(Version("1.2.3"))
True
>>> Specifier(">=1.2.3").contains("1.0.0")
False
>>> Specifier(">=1.2.3").contains("1.3.0a1")
False
>>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1")
True
>>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True)
True
F)r5   r   rn   r   r`   r   )r(   r:   r5   normalized_itemr   s        r   r<   Specifier.contains  sW    8 **K *$/
 (( /3.@.@.O ,,??r   r>   c              #   @  #    Sn/ nSUb  UOS0nU Hj  n[        U5      nU R                  " U40 UD6(       d  M(  UR                  (       a+  U(       d$  U R                  (       d  UR	                  U5        Md  SnUv   Ml     U(       d  U(       a  U H  nUv   M	     ggg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 be intelligently decide whether to allow
    prereleases or not (based on the :attr:`prereleases` attribute, and
    whether the only versions matching are prereleases).

This method is smarter than just ``filter(Specifier().contains, [...])``
because it implements the rule from :pep:`440` that a prerelease item
SHOULD be accepted if no other versions match the given specifier.

>>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
['1.3']
>>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")]))
['1.2.3', '1.3', <Version('1.4')>]
>>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"]))
['1.5a1']
>>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
['1.3', '1.5a1']
>>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
['1.3', '1.5a1']
Fr5   NT)r   r<   rn   r5   append)r(   r>   r5   yieldedfound_prereleaseskwr   parsed_versions           r   r@   Specifier.filterE  s     < K,C[N  G,W5N}}^2r22 "//4#3#3%,,W5 #G!M  ( ,, - -ws   4BA$B)rf   re   r{   Nr   )2r   r   r   r    r!   _operator_regex_str_version_regex_strrecompileVERBOSE
IGNORECASEra   r   rD   r   rG   rh   rH   r5   rI   r`   r   r   r)   r	   r   rE   r-   rF   r2   CallableOperatorr   r   r   r   r   r   r   r   r   r   r   r   UnparsedVersionr<   r   r   r   r@   r"   r   r   r   rL   rL   k   s   \| ZZ%%(::WD


R]]"F "	J(S (HTN (d (4 T  . " "$ " " #     B# B$* * 0sCx 0 0*# *=F =t =:! !(8 !
w 
c 
d 
*'/' '/ '/ '/R:g :S :T :<G <3 <4 <<w <c <d <g   2 C D >=g =S =T =#sG|!4 # #, DH,@#,@2:4.,@	,@^ UY; !34;CKD>;	$	%; ;r   rL   z^([0-9]+)((?:a|b|c|rc)[0-9]+)$c                     / n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$ )Nr   )split_prefix_regexrb   extendgroupsr   )r   resultr:   rg   s       r   r   r     sR    Fc"$$T*MM%,,.)MM$ # Mr   segmentc                 8   ^  [        U 4S jS 5       5      (       + $ )Nc              3   F   >#    U  H  nTR                  U5      v   M     g 7fr   )
startswith).0r   r   s     r   	<genexpr>!_is_not_suffix.<locals>.<genexpr>  s#      1Pv6""1Ps   !)devabrcpost)any)r   s   `r   r   r     s"     1P   r   leftrightc                    / / p2UR                  [        [        R                  " S U 5      5      5        UR                  [        [        R                  " S U5      5      5        UR                  U [	        US   5      S  5        UR                  U[	        US   5      S  5        UR                  SS/[        S[	        US   5      [	        US   5      -
  5      -  5        UR                  SS/[        S[	        US   5      [	        US   5      -
  5      -  5        [        [        R                  " U6 5      [        [        R                  " U6 5      4$ )Nc                 "    U R                  5       $ r   isdigitxs    r   <lambda>_pad_version.<locals>.<lambda>  s
    r   c                 "    U R                  5       $ r   r  r  s    r   r  r    s
    !))+r   r   r   0)r   r   r   r   r   insertmaxchain)r   r   
left_splitright_splits       r   r   r     s     " d9../DdKLMtI//0EuMNO d3z!}-/01uSQ0234 a#QKN(;c*Q->P(P!QQRq3%#aZ]);c+a.>Q)Q"RRS*-.Y__k5R0STTr   c            	       p   \ rS rSrSr SS\S\\   SS4S jjr\	S\\   4S j5       r
\
R                  S	\SS4S
 j5       r
S\4S jrS\4S jrS\4S jrS\S \4   SS 4S jrS\S\4S jrS\4S jrS\\   4S jrS\S\4S jr  SS\S\\   S\\   S\4S jjr SS\\   S\\   S\\   4S jjrSrg)SpecifierSeti  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.
N
specifiersr5   r   c                    UR                  S5       Vs/ s H)  o3R                  5       (       d  M  UR                  5       PM+     nn[        5       nU H  nUR                  [	        U5      5        M     [        U5      U l        X l        gs  snf )a  Initialize a SpecifierSet instance.

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

:raises InvalidSpecifier:
    If the given ``specifiers`` are not parseable than this exception will be
    raised.
,N)r   rd   setaddrL   	frozenset_specsrf   )r(   r  r5   ssplit_specifiersparsed	specifiers          r   rh   SpecifierSet.__init__  st    ( 0:/?/?/DR/D!	IAGGI/DR "%)IJJy+, *  ' ( Ss
   B
B
c                     U R                   b  U R                   $ U R                  (       d  g [        S U R                   5       5      $ )Nc              3   8   #    U  H  oR                   v   M     g 7fr   r5   r   r  s     r   r   +SpecifierSet.prereleases.<locals>.<genexpr>  s     6+Q==+   )rf   r  r   r'   s    r   r5   SpecifierSet.prereleases  s?     ($$$
 {{ 6$++666r   r7   c                     Xl         g r   rq   r9   s     r   r5   r"    rr   r   c                 d    U R                   b  SU R                  < 3OSn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)>
rz   r{   z<SpecifierSet(r}   )rf   r5   rD   r   s     r   r   SpecifierSet.__repr__  sD       , T--01 	  D	}SE44r   c                 X    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   )rD   r  s     r   r   'SpecifierSet.__str__.<locals>.<genexpr>  s     ;{!s1vv{r!  )r   sortedr  r'   s    r   r)   SpecifierSet.__str__  s"     xx;t{{;;<<r   c                 ,    [        U R                  5      $ r   )r   r  r'   s    r   r-   SpecifierSet.__hash__
  s    DKK  r   r/   c                     [        U[        5      (       a  [        U5      nO[        U[        5      (       d  [        $ [        5       n[	        U R
                  UR
                  -  5      Ul        U R                  c   UR                  b  UR                  Ul        U$ U R                  b   UR                  c  U R                  Ul        U$ U R                  UR                  :X  a  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')>
zFCannot combine SpecifierSets with True and False prerelease overrides.)r   rD   r  r   r  r  rf   
ValueError)r(   r/   r  s      r   __and__SpecifierSet.__and__  s     eS!! 'EE<00!! N	$T[[5<<%?@	$););)G%*%7%7I"  *u/A/A/I%)%6%6I"  %"4"44%)%6%6I"   r   c                     [        U[        [        45      (       a  [        [        U5      5      nO[        U[        5      (       d  [        $ U R
                  UR
                  :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   rD   rL   r  r   r  r1   s     r   r2   SpecifierSet.__eq__-  sJ    & ec9-.. U,EE<00!!{{ell**r   c                 ,    [        U R                  5      $ )z7Returns the number of specifiers in this specifier set.)r   r  r'   s    r   __len__SpecifierSet.__len__G  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__K  s     DKK  r   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 SpecifierSet(">=1.0.0,!=1.0.1")
True
>>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1")
True
>>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1")
False
>>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1")
False
>>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)
True
r   r   s     r   r   SpecifierSet.__contains__U  r   r   	installedc                 0  ^^ [        T[        5      (       d  [        T5      mTc  U R                  mT(       d  TR                  (       a  gU(       a&  TR                  (       a  [        TR                  5      m[        UU4S jU R                   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 uses :attr:`prereleases` to determine
    whether or not prereleases are allowed.

>>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3")
True
>>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3"))
True
>>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1")
False
>>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1")
False
>>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1")
True
>>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True)
True
Fc              3   B   >#    U  H  oR                  TTS 9v   M     g7f)r  Nr   )r   r  r:   r5   s     r   r   (SpecifierSet.contains.<locals>.<genexpr>  s     Rk::d:<ks   )r   r   r5   rn   r   allr  )r(   r:   r5   r<  s    `` r   r<   SpecifierSet.containsj  sp    < $((4=D
 **K t11++4,,-D RdkkRRRr   r>   c                    Uc  U R                   nU R                  (       a7  U R                   H  nUR                  U[        U5      S9nM     [	        U5      $ / n/ nU HS  n[        U5      nUR                  (       a#  U(       d  U(       d  UR                  U5        M@  MB  UR                  U5        MU     U(       d  U(       a  Uc  [	        U5      $ [	        U5      $ )a.  Filter items in the given iterable, that match the specifiers in this set.

:param iterable:
    An iterable that can contain version strings and :class:`Version` instances.
    The items in the iterable will be filtered according to the specifier.
:param prereleases:
    Whether or not to allow prereleases in the returned iterator. If set to
    ``None`` (the default), it will be intelligently decide whether to allow
    prereleases or not (based on the :attr:`prereleases` attribute, and
    whether the only versions matching are prereleases).

This method is smarter than just ``filter(SpecifierSet(...).contains, [...])``
because it implements the rule from :pep:`440` that a prerelease item
SHOULD be accepted if no other versions match the given specifier.

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

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

>>> list(SpecifierSet("").filter(["1.3", "1.5a1"]))
['1.3']
>>> list(SpecifierSet("").filter(["1.5a1"]))
['1.5a1']
>>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"]))
['1.3', '1.5a1']
>>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True))
['1.3', '1.5a1']
r  )r5   r  r@   rG   r7  r   rn   r   )r(   r>   r5   r]   filteredr   r:   r   s           r   r@   SpecifierSet.filter  s    X **K
 ;;;;xT+=N;O $>!
 24H:< !0!6 "//#)006 $ OOD) !  1k6I-..>!r   )rf   r  r   )NNr   )r   r   r   r    r!   rD   r   rG   rh   rH   r5   rI   r   r)   rE   r-   r   r/  rF   r2   r4  r   rL   r8  r   r   r<   r   r   r@   r"   r   r   r   r  r    s{    CG!(!(19$!(	!(F 7Xd^ 7 7  " "$ " "5# 5*= =!# !U>3#67 N @+F +t +4   !(9- !# #T #0 '+$(	7S7S d^7S D>	7S
 
7St UYM" !34M"CKD>M"	$	%M" M"r   r  )#r!   rB   r   r   typingr   r   r   r   r   r   r	   r
   r   utilsr   r   r   rD   r   r   rG   r   r   r.  r   ABCMetar$   rL   r   r   r   r   r   r  r   r   r   <module>rH     s     	
 
 
 ( %1I WcND01 _  	z 	4ckk 4nU Up 

<=C DI C D UtCy Uc UuT#YS	=Q7R U$G"= G"r   