U
    cUh                     @   sn   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	 d	ZdS )
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                   @   s   e Zd ZdZedejZeddddZ	e
e ddd	Ze
e ed
ddZe
e eeef edddZee ed
ddZdS )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)$N)filenamereturnc              
      s   j |}|st| d| _|ddd _|d}d|krzt| W nF tk
r } z(t	d|d|j
d  d	d
ddd W 5 d}~X Y nX |dd}| _|d _|dd _|dd _|dd _ fdd jD  _dS )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buildZpyver.abiZplatc                    s0   h | ](} j D ]} jD ]}t|||qqqS  )abisplatsr   ).0xyzselfr   Z/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pip/_internal/models/wheel.py	<setcomp>B   s        z!Wheel.__init__.<locals>.<setcomp>)wheel_file_rematchr   r
   groupreplacer   r   PackagingInvalidWheelNamer   argsversion	build_tagsplitZ
pyversionsr   r   	file_tags)r   r
   Z
wheel_info_versioner   r   r    __init__   s2    

zWheel.__init__)r   c                 C   s   t dd | jD S )z4Return the wheel's tags as a sorted list of strings.c                 s   s   | ]}t |V  qd S N)strr   tagr   r   r    	<genexpr>H   s     z0Wheel.get_formatted_file_tags.<locals>.<genexpr>)sortedr+   r   r   r   r    get_formatted_file_tagsF   s    zWheel.get_formatted_file_tags)tagsr   c                    s<   zt  fddt|D W S  tk
r6   t Y nX dS )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   s    | ]\}}| j kr|V  qd S r/   )r+   )r   itr   r   r    r3   X   s     
 z*Wheel.support_index_min.<locals>.<genexpr>N)next	enumerateStopIteration
ValueErrorr   r6   r   r   r    support_index_minJ   s    zWheel.support_index_min)r6   tag_to_priorityr   c                    s   t  fd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   s   | ]}| kr | V  qd S r/   r   r1   r?   r   r    r3   m   s     z0Wheel.find_most_preferred_tag.<locals>.<genexpr>)minr+   )r   r6   r?   r   r@   r    find_most_preferred_tag\   s    zWheel.find_most_preferred_tagc                 C   s   | 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+   
isdisjointr=   r   r   r    	supportedq   s    zWheel.supported)__name__
__module____qualname____doc__recompileVERBOSEr"   r0   r.   r   r5   r   intr>   r   rB   r   boolrD   r   r   r   r    r	      s   * 
r	   )rH   rI   typingr   r   r   pip._vendor.packaging.tagsr   pip._vendor.packaging.utilsr   r&   r   pip._internal.exceptionspip._internal.utils.deprecationr   r	   r   r   r   r    <module>   s   