
    S6iK                    Z    d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	 e G d d             Z
y)    )annotations)	dataclassfield)NormalizedNamecanonicalize_name)CommandErrorc                      e Zd ZU dZ ee      Zded<    ee      Zded<    ede	dd      Z
ded	<   	 	 	 	 	 	 	 	 	 	 dd
ZddZddZy)ReleaseControlz9Helper for managing which release types can be installed.)default_factoryset[str]all_releases
only_finalF)initr   comparereprlist[tuple[str, str]]_orderc                L   |j                  d      rt        d      |j                  d      }d|v ro|j                          |j                          |j	                  d       | j
                  j                  |df       |d|j                  d      dz   = d|vryd|v ro|D ]  }|dk(  r.|j                          | j
                  j                  |df       6t        |      }|j                  |       |j	                  |       | j
                  j                  ||f        y)a  Parse and apply release control option value.

        Processes comma-separated package names or special values `:all:` and `:none:`.

        When adding packages to target, they're removed from other to maintain mutual
        exclusivity between all_releases and only_final. All operations are tracked in
        order so that the original command-line argument sequence can be reconstructed
        when passing options to build subprocesses.
        -z9--all-releases / --only-final option requires 1 argument.,:all:N   z:none:)

startswithr   splitclearaddr   appendindexr   discard)selfvaluetargetother	attr_namenewnames          o/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/pip/_internal/models/release_control.pyhandle_mutual_excludesz%ReleaseControl.handle_mutual_excludes   s    C K  kk#nKKMLLNJJwKK	734,cii(1,,-s" n  
	2Dx""Ix#89$T*DMM$JJtKK	401
	2    c                     | j                   dd S )a  
        Get ordered list of (flag_name, value) tuples for reconstructing CLI args.

        Returns:
            List of tuples where each tuple is (attribute_name, value).
            The attribute_name is either 'all_releases' or 'only_final'.

        Example:
            [("all_releases", ":all:"), ("only_final", "simple")]
            would be reconstructed as:
            ["--all-releases", ":all:", "--only-final", "simple"]
        N)r   )r    s    r'   get_ordered_argszReleaseControl.get_ordered_args<   s     {{1~r)   c                |    || j                   v ry|| j                  v ryd| j                   v ryd| j                  v ryy)a   
        Determine if pre-releases are allowed for a package.

        Returns:
            True: Pre-releases are allowed (package in all_releases)
            False: Only final releases allowed (package in only_final)
            None: No specific setting, use default behavior
        TFr   N)r   r   )r    canonical_names     r'   allows_prereleasesz!ReleaseControl.allows_prereleasesK   sG     T...t.)))'r)   N)
r!   strr"   r   r#   r   r$   r/   returnNone)r0   r   )r-   r   r0   zbool | None)__name__
__module____qualname____doc__r   setr   __annotations__r   listr   r(   r+   r.    r)   r'   r
   r
      sv    C"37L(7 5J5$)D%e%F! %2%2"*%23;%2HK%2	%2Nr)   r
   N)
__future__r   dataclassesr   r   pip._vendor.packaging.utilsr   r   pip._internal.exceptionsr   r
   r9   r)   r'   <module>r>      s-    " ( I 1 P P Pr)   