U 巀g@sndZddlZddlmZmZmZddlmZddlm Z ddlm Z ddl m Z ddl mZGdd d ZdS) z`Represents a wheel file and provides access to the various parts of the name that have meaning. N)DictIterableList)Tag)InvalidWheelFilename)parse_wheel_filename) deprecatedc@seZdZdZedejZeddddZ e eddd Z e e e d d d Ze e ee e fe d ddZee ed ddZdS)Wheelz A wheel filez^(?P(?P[^\s-]+?)-(?P[^\s-]*?)) ((-(?P\d[^-]*?))?-(?P[^\s-]+?)-(?P[^\s-]+?)-(?P[^\s-]+?) \.whl|\.dist-info)$N)filenamereturnc s j|}|st|d|_|ddd_|d}d|krz t|WnFtk r}z(t d|d|j dd d d d d W5d}~XYnX|dd}|_ |d_ |d d_|d d_|d d_fddjD_dS)zX :raises InvalidWheelFilename: when the filename is invalid for a wheel z is not a valid wheel filename.name_-verzWheel filename zU is not correctly normalised. Future versions of pip will raise the following error: rz zvto rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata)z25.1i2)reason replacementgone_inissueNbuildpyver.abiplatcs0h|](}jD]}jD]}t|||qqqS)abisplatsr).0xyzselfrH/opt/hc_python/lib/python3.8/site-packages/pip/_internal/models/wheel.py Bs z!Wheel.__init__..) wheel_file_rematchrr groupreplacer rPackagingInvalidWheelNamerargsversion build_tagsplit pyversionsrr file_tags)r!r wheel_info_versionerr r"__init__s2      zWheel.__init__)r cCstdd|jDS)z4Return the wheel's tags as a sorted list of strings.css|]}t|VqdSN)strrtagrrr" Hsz0Wheel.get_formatted_file_tags..)sortedr.r rrr"get_formatted_file_tagsFszWheel.get_formatted_file_tags)tagsr cs<ztfddt|DWStk r6tYnXdS)aReturn 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. c3s |]\}}|jkr|VqdSr3)r.)ritr rr"r7Xs z*Wheel.support_index_min..N)next enumerate StopIteration ValueErrorr!r:rr r"support_index_minJs zWheel.support_index_min)r:tag_to_priorityr cstfdd|jDS)aReturn 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. c3s|]}|kr|VqdSr3rr5rCrr"r7msz0Wheel.find_most_preferred_tag..)minr.)r!r:rCrrDr"find_most_preferred_tag\s zWheel.find_most_preferred_tagcCs|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. isdisjointrArrr" supportedqszWheel.supported)__name__ __module__ __qualname____doc__recompileVERBOSEr$r4r2rr9rintrBrrFrboolrHrrrr"r s*  r )rLrMtypingrrrZpip._vendor.packaging.tagsrZpip._vendor.packaging.utilsrr(rpip._internal.exceptionspip._internal.utils.deprecationrr rrrr"s