File: //usr/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc
a
?�f. � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlm Z m
Z
mZ d dlm
Z
d dlmZ d dlmZmZ er�d dlmZmZmZmZ d d lmZ d d
lmZ G dd� de
�ZdS )
� N)�parse)�WHEEL_EXTENSION)�redact_auth_from_url�split_auth_from_netloc�splitext)�KeyBasedCompareMixin)�MYPY_CHECK_RUNNING)�path_to_url�url_to_path)�Optional�Text�Tuple�Union)�HTMLPage)�Hashesc sH e Zd ZdZg d�Zd8� fdd� Zdd� Zd d
� Zedd� �Z ed
d� �Z
edd� �Zedd� �Zedd� �Z
edd� �Zdd� Zedd� �Zedd� �Ze�d�Zedd� �Ze�d �Zed!d"� �Ze�d#�Zed$d%� �Zed&d'� �Zed(d)� �Zed*d+� �Zd,d-� Zed.d/� �Zed0d1� �Zed2d3� �Z ed4d5� �Z!d6d7� Z"� Z#S )9�Linkz?Represents a parsed link from a Package Index's simple URL
)�_parsed_url�_url�
comes_from�requires_python�
yanked_reason�cache_link_parsingNTc s\ |� d�rt|�}t�|�| _|| _|| _|r2|nd| _|| _t t
| �j|t
d� || _dS )a�
:param url: url of the resource pointed to (href of the link)
:param comes_from: instance of HTMLPage 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.
z\\N)�keyZdefining_class)
�
startswithr �urllib_parse�urlsplitr r r r r �superr �__init__r )�self�urlr r r r �� __class__� �=/usr/lib/python3.9/site-packages/pip/_internal/models/link.pyr $ s
z
Link.__init__c C sF | j rd�| j �}nd}| jr4d�t| j�| j|�S tt| j��S d S )Nz (requires-python:{})� z{} (from {}){})r �formatr r r �str)r Zrpr"