HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_internal/index/__pycache__/sources.cpython-38.pyc
U

�{�e��	@s0ddlZddlZddlZddlZddlmZmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZe�e�Zee
ZeeZeegee
fZeegefZGdd�d�Zeed	�d
d�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�Z eeeeeeeeeefd�dd�Z!dS)�N)�Callable�Iterable�Optional�Tuple)�InstallationCandidate)�Link)�path_to_url�url_to_path)�is_urlc@s>eZdZeeed�dd��Zed�dd�Ze	d�dd�Z
dS)	�
LinkSource��returncCs
t��dS)z,Returns the underlying link, if there's one.N��NotImplementedError��self�r�?/tmp/pip-unpacked-wheel-_0scjqea/pip/_internal/index/sources.py�linkszLinkSource.linkcCs
t��dS)z9Candidates found by parsing an archive listing HTML file.Nrrrrr�page_candidatesszLinkSource.page_candidatescCs
t��dS)z,Links found by specifying archives directly.Nrrrrr�
file_linksszLinkSource.file_linksN)�__name__�
__module__�__qualname__�propertyrrr�FoundCandidatesr�
FoundLinksrrrrrrsr)�file_urlr
cCstj|dd�ddkS)NF)�strictrz	text/html)�	mimetypes�
guess_type)rrrr�
_is_html_file#sr!c@sTeZdZdZeedd�dd�Zeee	d�dd��Z
ed�d	d
�Ze
d�dd�ZdS)
�_FlatDirectorySourcez�Link source specified by ``--find-links=<path-to-dir>``.

    This looks the content of the directory, and returns:

    * ``page_candidates``: Links listed on each HTML file in the directory.
    * ``file_candidates``: Archives in the directory.
    N)�candidates_from_page�pathr
cCs||_t�tj�|��|_dS�N)�_candidates_from_page�pathlib�Path�osr$�realpath�_path)rr#r$rrr�__init__0sz_FlatDirectorySource.__init__rcCsdSr%rrrrrr8sz_FlatDirectorySource.linkccs>|j��D].}tt|��}t|�s$q
|�t|��EdHq
dSr%)r+�iterdirr�strr!r&r�rr$�urlrrrr<s
z$_FlatDirectorySource.page_candidatesccs4|j��D]$}tt|��}t|�r$q
t|�Vq
dSr%)r+r-rr.r!rr/rrrrCs
z_FlatDirectorySource.file_links)rrr�__doc__�CandidatesFromPager.r,rrrrrrrrrrrrr"'s
�r"c@sTeZdZdZeedd�dd�Zeeed�dd��Z	e
d�d	d
�Zed�dd�Z
dS)
�_LocalFileSourceaC``--find-links=<path-or-url>`` or ``--[extra-]index-url=<path-or-url>``.

    If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to
    the option, it is converted to a URL first. This returns:

    * ``page_candidates``: Links listed on an HTML file.
    * ``file_candidates``: The non-HTML file.
    N�r#rr
cCs||_||_dSr%�r&�_link�rr#rrrrr,Usz_LocalFileSource.__init__rcCs|jSr%�r6rrrrr]sz_LocalFileSource.linkccs&t|jj�sdS|�|j�EdHdSr%)r!r6r0r&rrrrrasz _LocalFileSource.page_candidatesccst|jj�rdS|jVdSr%)r!r6r0rrrrrfsz_LocalFileSource.file_links�rrrr1r2rr,rrrrrrrrrrrr3Ks�r3c@sVeZdZdZeeedd�dd�Zee	ed�dd��Z
ed�d	d
�Ze
d�dd�ZdS)
�_RemoteFileSourcez�``--find-links=<url>`` or ``--[extra-]index-url=<url>``.

    This returns:

    * ``page_candidates``: Links listed on an HTML file.
    * ``file_candidates``: The non-HTML file.
    N)r#�page_validatorrr
cCs||_||_||_dSr%)r&�_page_validatorr6)rr#r;rrrrr,usz_RemoteFileSource.__init__rcCs|jSr%r8rrrrrsz_RemoteFileSource.linkccs&|�|j�sdS|�|j�EdHdSr%)r<r6r&rrrrr�sz!_RemoteFileSource.page_candidatesccs|jVdSr%r8rrrrr�sz_RemoteFileSource.file_links)rrrr1r2�
PageValidatorrr,rrrrrrrrrrrr:ls
�
r:c@sTeZdZdZeedd�dd�Zeeed�dd��Z	e
d�d	d
�Zed�dd�Z
dS)
�_IndexDirectorySourcez�``--[extra-]index-url=<path-to-directory>``.

    This is treated like a remote URL; ``candidates_from_page`` contains logic
    for this by appending ``index.html`` to the link.
    Nr4cCs||_||_dSr%r5r7rrrr,�sz_IndexDirectorySource.__init__rcCs|jSr%r8rrrrr�sz_IndexDirectorySource.linkccs|�|j�EdHdSr%r5rrrrr�sz%_IndexDirectorySource.page_candidatescCsdS)Nrrrrrrr�sz _IndexDirectorySource.file_linksr9rrrrr>�s�r>)�locationr#r;�
expand_dir�cache_link_parsingr
c	Cs�d}d}tj�|�r"t|�}|}n$|�d�r:|}t|�}nt|�rF|}|dkrbd}t�||�dS|dkr�t	||t
||d�d�}||fStj�|�r�|r�t||d�}nt
|t
||d�d�}||fStj�|�r�t|t
||d�d�}||fSt�d|�|dfS)	Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)rA)r#r;r)r#r$)r#rz?Location '%s' is ignored: it is neither a file nor a directory.)r)r$�existsr�
startswithr	r
�logger�warningr:r�isdirr"r>�isfiler3)	r?r#r;r@rAr$r0�msg�sourcerrr�build_source�sX

�
��
�
��rJ)"�loggingrr)r'�typingrrrr�pip._internal.models.candidater�pip._internal.models.linkr�pip._internal.utils.urlsrr	�pip._internal.vcsr
�	getLoggerrrDrrr2�boolr=rr.r!r"r3r:r>rJrrrr�<module>s4
$! �