
    )h                     |    d Z ddlZddlmZmZmZmZ ddlmZ ddl	m
Z
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OptionalTag)BuildTagparse_wheel_filename)InvalidWheelFilename)
deprecatedc                       e Zd ZdZ ej
                  dej                        ZdeddfdZ	e
de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                    || _         |  d | _        	 t        |      }|\  | _        }| _        | _        t        |      | _        y # t        $ r)}| j                  j                  |      }|st        |j                  d         d t        d|d|j                  d    dddd       |j                  d	      j                  d
d      | _        |j                  d      j                  d
d      | _        |j                  d      j                  d      }|j                  d      j                  d      |j                  d      j                  d      t!        fd|D              | _        Y d }~y d }~ww xY w)Nr   zWheel filename zU is not correctly normalised. Future versions of pip will raise the following error:
z

zvto rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata)z25.3i2  )reasonreplacementgone_inissuename_-verpyver.abiplatc              3   V   K   | ]   }D ]  }D ]  }t        |||          " yw))interpreterr   platformNr   ).0pyr   r   abisplatss       M/var/www/html/venv/lib/python3.12/site-packages/pip/_internal/models/wheel.py	<genexpr>z!Wheel.__init__.<locals>.<genexpr>D   sO      '' !	'  d;;';';'s   &))r   
_build_tagr
   r   	file_tagsstrversion_PackagingInvalidWheelFilenamelegacy_wheel_file_rematchr   argsr   groupreplacesplit	frozenset)	selfr   
wheel_info_versionelegacy_wheel_info
pyversionsr#   r$   s	          @@r%   __init__zWheel.__init__   sg     	.2%	-h7JCM@DIx$.x=DL- !	 $ 9 9 ? ? I$*166!954?%h\ 2Ovvayk'
,  *//7??SIDI,2259AA#sKDL +009??DJ$**5177<D%++F399#>E& '$' DNN9!	s   1A 
E9DE44E9c                 V   | j                   | j                   S | j                  j                  | j                        }|J d       |j	                  d      }t        j                  d|      }|J d       |j                         }t        |d         |d   f| _         | j                   S )Nz!guaranteed by filename validationbuildz^(\d+)(.*)$r      )r'   r,   r-   r   r/   regroupsint)r3   r7   	build_tagr-   build_tag_groupss        r%   r@   zWheel.build_tagK   s    ??&??" !55;;DMMJ ,Q.QQ,%++G4	3 E"EE  <<>/235Ea5HI    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)r)   )r!   tags     r%   r&   z0Wheel.get_formatted_file_tags.<locals>.<genexpr>]   s     93c#h9s   )sortedr(   )r3   s    r%   get_formatted_file_tagszWheel.get_formatted_file_tags[   s    9$..999rB   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rE   )r(   )r!   itr3   s      r%   r&   z*Wheel.support_index_min.<locals>.<genexpr>m   s      Mdadnn9LMs   !!)next	enumerateStopIteration
ValueErrorr3   rI   s   ` r%   support_index_minzWheel.support_index_min_   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rE    )r!   rF   rT   s     r%   r&   z0Wheel.find_most_preferred_tag.<locals>.<genexpr>   s"      
%(c_>TOC 
s   	
)minr(   )r3   rI   rT   s     `r%   find_most_preferred_tagzWheel.find_most_preferred_tagq   s#    "  
,0NN
 
 	
rB   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(   
isdisjointrR   s     r%   	supportedzWheel.supported   s    
 >>,,T222rB   )__name__
__module____qualname____doc__r=   compileVERBOSEr,   r)   r9   propertyr	   r@   r   rH   r   r?   rS   r   rY   r   boolr\   rW   rB   r%   r   r      s    %2::	 	

	- - -^ 8  :c :d3i C $
I
04S#X
	
*3hsm 3 3rB   r   )r`   r=   typingr   r   r   r   pip._vendor.packaging.tagsr   pip._vendor.packaging.utilsr	   r
   r   r+   pip._internal.exceptionspip._internal.utils.deprecationr   r   rW   rB   r%   <module>rj      s4    
 1 1 * F : 6y3 y3rB   