XylotrechusZ
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 er�d dlmZ e�e �Z!d Z"G d
d� de�Z#G dd
� d
e�Z$e#e$d�dd�Z%e j&dd�e#e#e'd�dd��Z(dS )� N)�
TYPE_CHECKING�Dict�List�Mapping�
NamedTuple�Optional�Tuple�Union)�WHEEL_EXTENSION)�Hashes)�redact_auth_from_url�split_auth_from_netloc�splitext)�KeyBasedCompareMixin)�path_to_url�url_to_path)�IndexContent)�sha512�sha384�sha256�sha224�sha1�md5c
s: e Zd ZdZdddddddgZdDeeeedf ee ee eee eef d d�� fd
d�
Z
ed�dd�Zed�dd�Ze
ed�dd��Ze
ed�dd��Ze
ed�dd��Ze
ed�dd��Ze
ed�dd��Ze
ed�dd��Zeeef d�d d!�Ze
ed�d"d#��Ze
ed�d$d%��Ze�d&�Ze
ee d�d'd(��Ze�d)�Ze
ee d�d*d+��Ze�d,jd-�e �d.��Z!e
ee d�d/d0��Z"e
ee d�d1d2��Z#e
ed�d3d4��Z$e
ed�d5d6��Z%ed�d7d8�Z&e
ed�d9d:��Z'e
ed�d;d<��Z(e
ed�d=d>��Z)e
ed�d?d@��Z*ee+ edA�dBdC�Z,� Z-S )E�Linkz:Represents a parsed link from a Package Index's simple URL�_parsed_url�_url�_hashes�
comes_from�requires_python�
yanked_reason�cache_link_parsingNTr )�urlr r r r �hashes�returnc sl |� d�rt|�}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)�key�defining_class)�
startswithr �urllib�parse�urlsplitr r r r r r �super�__init__r r )�selfr! r r r r r"