o
    ©„jh  ã                   @  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   úX/var/www/html/django_cbt/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 )zŽReturn 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    