U ʗRe( @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZm Z m Z mZmZm Z mZmZ d dlmZ d dlmZ d dlmZmZmZ d dlmZ d dlmZmZ erd dlmZ ee Z!d Z"G d d deZ#G dd d eZ$e#e$dddZ%e j&dde#e#e'dddZ(dS ) N) TYPE_CHECKINGDictListMapping NamedTupleOptionalTupleUnion)WHEEL_EXTENSION)Hashes)redact_auth_from_urlsplit_auth_from_netlocsplitext)KeyBasedCompareMixin)path_to_urlurl_to_path)IndexContent)sha512sha384sha256sha224sha1md5c s: e Zd ZdZdddddddgZdDeeeedf ee ee eee eef d d fd d Z edddZedddZe edddZe edddZe edddZe edddZe edddZe edddZeeef dd d!Ze edd"d#Ze edd$d%Zed&Ze ee dd'd(Zed)Ze ee dd*d+Zed,jd-e d.Z!e ee dd/d0Z"e ee dd1d2Z#e edd3d4Z$e edd5d6Z%edd7d8Z&e edd9d:Z'e edd;d<Z(e edd=d>Z)e edd?d@Z*ee+ edAdBdCZ, Z-S )ELinkz:Represents a parsed link from a Package Index's simple URL_parsed_url_url_hashes comes_fromrequires_python yanked_reasoncache_link_parsingNTr )urlr r r r hashesreturnc sl | drt|}tj|| _|| _|dk r2|ni | _|| _|rF|nd| _ || _ t j|t d || _dS )aG :param url: url of the resource pointed to (href of the link) :param comes_from: instance of IndexContent where the link was found, or string. :param requires_python: String containing the `Requires-Python` metadata field, specified in PEP 345. This may be specified by a data-requires-python attribute in the HTML link tag, as described in PEP 503. :param yanked_reason: the reason the file has been yanked, if the file has been yanked, or None if the file hasn't been yanked. This is the value of the "data-yanked" attribute, if present, in a simple repository HTML link. If the file has been yanked but no reason was provided, this should be the empty string. See PEP 592 for more information and the specification. :param cache_link_parsing: A flag that is used elsewhere to determine whether resources retrieved from this link should be cached. PyPI index urls should generally have this set to False, for example. :param hashes: A mapping of hash names to digests to allow us to determine the validity of a download. z\\N)keydefining_class) startswithr urllibparseurlsplitr r r r r r super__init__r r )selfr! r r r r r" __class__ /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/models/link.pyr+ 4 s ! z Link.__init__)r# c C sH | j rd| j d}nd}| jr6dt| j| j|S tt| jS d S )Nz (requires-python:) z{} (from {}){})r r formatr r str)r, rpr/ r/ r0 __str__f s zLink.__str__c C s d| dS )Nzr/ r, r/ r/ r0 __repr__r s z Link.__repr__c C s | j S N)r r8 r/ r/ r0 r! u s zLink.urlc C sR | j d}t|}|s,t| j\}}|S tj|}|sNt d| j d|S )N/zURL z produced no filename)pathrstrip posixpathbasenamer netlocr' r( unquoteAssertionErrorr )r, r<