
    wgU                     T   d Z ddlZddlZddlmZ  ej
                  dej                        Z ej
                  d      Z ej
                  d      Z	d Z
ej                  ej                  ej                  ej                  ej                  ej                   d	Z G d
 d      Zdad Zy)zAModule for parsing and testing package version predicate strings.    N   )versionz'(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)z^\s*\((.*)\)\s*$z%^\s*(<=|>=|<|>|!=|==)\s*([^\s,]+)\s*$c                     t         j                  |       }|st        d|       |j                         \  }}t	        j
                         5  t	        j                  |      }ddd       ||fS # 1 sw Y   |fS xY w)zVParse a single version comparison.

    Return (comparison string, StrictVersion)
    z bad package restriction syntax: N)re_splitComparisonmatch
ValueErrorgroupsr   suppress_known_deprecationStrictVersion)predrescompverStrothers        k/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/setuptools/_distutils/versionpredicate.pysplitUpr      sy    
 
"
"4
(C;D8DEE::<LD&		+	+	- .%%f-.%=.%=s   A//A;)<z<=z==>z>=z!=c                   "    e Zd ZdZd Zd Zd Zy)VersionPredicatea  Parse and test package version predicates.

    >>> v = VersionPredicate('pyepat.abc (>1.0, <3333.3a1, !=1555.1b3)')

    The `name` attribute provides the full dotted name that is given::

    >>> v.name
    'pyepat.abc'

    The str() of a `VersionPredicate` provides a normalized
    human-readable version of the expression::

    >>> print(v)
    pyepat.abc (> 1.0, < 3333.3a1, != 1555.1b3)

    The `satisfied_by()` method can be used to determine with a given
    version number is included in the set described by the version
    restrictions::

    >>> v.satisfied_by('1.1')
    True
    >>> v.satisfied_by('1.4')
    True
    >>> v.satisfied_by('1.0')
    False
    >>> v.satisfied_by('4444.4')
    False
    >>> v.satisfied_by('1555.1b3')
    False

    `VersionPredicate` is flexible in accepting extra whitespace::

    >>> v = VersionPredicate(' pat( ==  0.1  )  ')
    >>> v.name
    'pat'
    >>> v.satisfied_by('0.1')
    True
    >>> v.satisfied_by('0.2')
    False

    If any version numbers passed in do not conform to the
    restrictions of `StrictVersion`, a `ValueError` is raised::

    >>> v = VersionPredicate('p1.p2.p3.p4(>=1.0, <=1.3a1, !=1.2zb3)')
    Traceback (most recent call last):
      ...
    ValueError: invalid version number '1.2zb3'

    It the module or package name given does not conform to what's
    allowed as a legal module or package name, `ValueError` is
    raised::

    >>> v = VersionPredicate('foo-bar')
    Traceback (most recent call last):
      ...
    ValueError: expected parenthesized list: '-bar'

    >>> v = VersionPredicate('foo bar (12.21)')
    Traceback (most recent call last):
      ...
    ValueError: expected parenthesized list: 'bar (12.21)'

    c                    |j                         }|st        d      t        j                  |      }|st        d|      |j	                         \  | _        }|j                         }|rt        j                  |      }|st        d|      |j	                         d   }|j                  d      D cg c]  }t        |       c}| _	        | j                  st        d|      yg | _	        yc c}w )z!Parse a version predicate string.zempty package restrictionzbad package name in zexpected parenthesized list: r   ,zempty parenthesized list in N)
stripr   re_validPackager   r	   namere_parensplitr   r   )selfversionPredicateStrr   parenstraPreds         r   __init__zVersionPredicate.__init__i   s     2779"899%%&9:34G3JKLL <<>	5NN5)E #@	!JKK,,.#C58YYs^DEDDI99 #?@S?V!WXX  DI	 Es   8C5c                     | j                   rQ| j                   D cg c]  \  }}|dz   t        |      z    }}}| j                  dz   dj                  |      z   dz   S | j                  S c c}}w )N z (z, ))r   r!   r   join)r   condverseqs       r   __str__zVersionPredicate.__str__   sb    99:>))DYT34#:C(DCD99t#diin4s::99 Es   A*c                 N    | j                   D ]  \  }}t        |   ||      r y y)zTrue if version is compatible with all the predicates in self.
        The parameter version must be acceptable to the StrictVersion
        constructor.  It may be either a string or StrictVersion.
        FT)r   compmap)r   r   r(   r)   s       r   satisfied_byzVersionPredicate.satisfied_by   s1    
  	ID#4=#.	     N)__name__
__module____qualname____doc__r#   r+   r.    r/   r   r   r   (   s    >@2r/   r   c                    t         $t        j                  dt        j                        a | j	                         } t         j                  |       }|st        d|       |j                  d      xs d}|r2t        j                         5  t        j                  |      }ddd       |j                  d      |fS # 1 sw Y   xY w)a9  Return the name and optional version number of a provision.

    The version number, if given, will be returned as a `StrictVersion`
    instance, otherwise it will be `None`.

    >>> split_provision('mypkg')
    ('mypkg', None)
    >>> split_provision(' mypkg( 1.2 ) ')
    ('mypkg', StrictVersion ('1.2'))
    Nz=([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$z illegal provides specification:    r   )_provision_rxrecompileASCIIr   r   r   groupr   r
   r   )valuemr)   s      r   split_provisionr>      s     

Lbhh
 KKMEE"A;E9EFF
''!*
C
//1 	-'',C	-771:s?	- 	-s   B<<C)r3   operatorr8    r   r9   r:   r   r   r   r   ltleeqgtgener-   r   r7   r>   r4   r/   r   <module>rG      s    G  	 "**GR 2::)*RZZ HI  

++
++	
++
++i iX r/   