
    Kg                     t    d Z ddlZddlmZmZmZ ddlmZ ddlm	Z
 ddlmZ ddlm	Z	 ddlmZ  G d d	      Zy)
z`Represents a wheel file and provides access to the various parts of the
name that have meaning.
    N)DictIterableList)Tag)InvalidWheelFilename)parse_wheel_filename)
deprecatedc                       e Zd ZdZ ej
                  dej                        ZdeddfdZ	de
e   fdZde
e   defd	Zde
e   d
eeef   defdZdee   defdZy)WheelzA wheel filez^(?P<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]*?))
        ((-(?P<build>\d[^-]*?))?-(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>[^\s-]+?)
        \.whl|\.dist-info)$filenamereturnNc                 T   | j                   j                  |      }|st        | d      || _        |j	                  d      j                  dd      | _        |j	                  d      }d|v r	 t        |       |j                  dd      }|| _        |j	                  d      | _        |j	                  d      j                  d      | _        |j	                  d      j                  d      | _        |j	                  d      j                  d      | _        | j                  D ch c]1  }| j                  D ]   }| j                   D ]  }t#        |||       " 3 c}}}| _        y# t        $ r.}t        d|d|j                  d    d	d
dd       Y d}~!d}~ww xY wc c}}}w )zX
        :raises InvalidWheelFilename: when the filename is invalid for a wheel
        z is not a valid wheel filename.name_-verzWheel filename zU is not correctly normalised. Future versions of pip will raise the following error:
r   z

zvto rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata)z25.1i2  )reasonreplacementgone_inissueNbuildpyver.abiplat)wheel_file_rematchr   r   groupreplacer   r   PackagingInvalidWheelNamer	   argsversion	build_tagsplit
pyversionsabisplatsr   	file_tags)selfr   
wheel_info_versionexyzs           ^/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/pip/_internal/models/wheel.py__init__zWheel.__init__   s    ''--h7
&(3R'STT $$V,44S#>	##E*(?$X."  ''S1H#))'2$**7399#>$$U+11#6	%%f-33C8
 #'//
"1Q499adjjC1aLjL9L/
3 - )( 6S66!9+T+
0 # 2
s   /E) (6F#)	F 2#FF c                 :    t        d | j                  D              S )z4Return the wheel's tags as a sorted list of strings.c              3   2   K   | ]  }t        |        y wN)str).0tags     r0   	<genexpr>z0Wheel.get_formatted_file_tags.<locals>.<genexpr>H   s     9.3c#h.s   )sortedr(   )r)   s    r0   get_formatted_file_tagszWheel.get_formatted_file_tagsF   s    9$..999    tagsc                 n     	 t         fdt        |      D              S # t        $ r t               w xY w)a  Return the lowest index that one of the wheel's file_tag combinations
        achieves in the given list of supported tags.

        For example, if there are 8 supported tags and one of the file tags
        is first in the list, then return 0.

        :param tags: the PEP 425 tags to check the wheel against, in order
            with most preferred first.

        :raises ValueError: If none of the wheel's file tags match one of
            the supported tags.
        c              3   F   K   | ]  \  }}|j                   v s|  y wr4   )r(   )r6   itr)   s      r0   r8   z*Wheel.support_index_min.<locals>.<genexpr>X   s!     Modadnn9Los   !!)next	enumerateStopIteration
ValueErrorr)   r<   s   ` r0   support_index_minzWheel.support_index_minJ   s4    	MioMMM 	,	s     4tag_to_priorityc                 @    t        fd| j                  D              S )a  Return the priority of the most preferred tag that one of the wheel's file
        tag combinations achieves in the given list of supported tags using the given
        tag_to_priority mapping, where lower priorities are more-preferred.

        This is used in place of support_index_min in some cases in order to avoid
        an expensive linear scan of a large list of tags.

        :param tags: the PEP 425 tags to check the wheel against.
        :param tag_to_priority: a mapping from tag to priority of that tag, where
            lower is more preferred.

        :raises ValueError: If none of the wheel's file tags match one of
            the supported tags.
        c              3   2   K   | ]  }|v s|     y wr4    )r6   r7   rG   s     r0   r8   z0Wheel.find_most_preferred_tag.<locals>.<genexpr>m   s!      
,:Sc_>TOC Ns   	
)minr(   )r)   r<   rG   s     `r0   find_most_preferred_tagzWheel.find_most_preferred_tag\   s#    "  
,0NN
 
 	
r;   c                 :    | j                   j                  |       S )zReturn whether the wheel is compatible with one of the given tags.

        :param tags: the PEP 425 tags to check the wheel against.
        )r(   
isdisjointrE   s     r0   	supportedzWheel.supportedq   s    
 >>,,T222r;   )__name__
__module____qualname____doc__recompileVERBOSEr   r5   r1   r   r:   r   intrF   r   rL   r   boolrO   rJ   r;   r0   r   r      s    BJJ	 	

	M(
 (
 (
T:c :d3i C $
I
04S#X
	
*3hsm 3 3r;   r   )rS   rT   typingr   r   r   pip._vendor.packaging.tagsr   pip._vendor.packaging.utilsr   r    r   pip._internal.exceptionspip._internal.utils.deprecationr	   r   rJ   r;   r0   <module>r^      s4    
 ' ' * = 9 6d3 d3r;   