o
    ih                     @  s^   d 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
 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.
    )annotations)Iterable)Tag)InvalidWheelFilename)parse_wheel_filenamec                   @  sB   e Zd ZdZdddZdd	d
ZdddZdddZdddZdS )WheelzA wheel filefilenamestrreturnNonec              
   C  s\   || _ zt|}W n ty } zt|jd d d }~ww |\| _}| _| _t|| _	d S )Nr   )
r   r   _PackagingInvalidWheelFilenamer   argsname	build_tag	file_tagsr	   version)selfr   
wheel_infoe_version r   V/var/www/html/ocr-read/venv/lib/python3.10/site-packages/pip/_internal/models/wheel.py__init__   s   zWheel.__init__	list[str]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)r	   .0tagr   r   r   	<genexpr>"   s    z0Wheel.get_formatted_file_tags.<locals>.<genexpr>)sortedr   r   r   r   r   get_formatted_file_tags    s   zWheel.get_formatted_file_tagstags	list[Tag]intc                   s2   zt  fddt|D W S  ty   t 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  s"    | ]\}}| j v r|V  qd S r   )r   )r   itr    r   r   r   2   s     z*Wheel.support_index_min.<locals>.<genexpr>)next	enumerateStopIteration
ValueErrorr   r"   r   r    r   support_index_min$   s
   zWheel.support_index_mintag_to_prioritydict[Tag, int]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     | ]}| v r | V  qd S r   r   r   r-   r   r   r   G   s    z0Wheel.find_most_preferred_tag.<locals>.<genexpr>)minr   )r   r"   r-   r   r/   r   find_most_preferred_tag6   s   zWheel.find_most_preferred_tagIterable[Tag]boolc                 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   	supportedK   s   zWheel.supportedN)r   r	   r
   r   )r
   r   )r"   r#   r
   r$   )r"   r#   r-   r.   r
   r$   )r"   r2   r
   r3   )	__name__
__module____qualname____doc__r   r!   r,   r1   r5   r   r   r   r   r      s    



r   N)r9   
__future__r   collections.abcr   pip._vendor.packaging.tagsr   pip._vendor.packaging.utilsr   r   r   pip._internal.exceptionsr   r   r   r   r   <module>   s    