HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_internal/index/__pycache__/sources.cpython-37.pyc
B

L��g�!�
@slddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZddlm
Z
mZmZmZmZmZddlmZddlmZddlmZmZddlmZe�e�ZeeZeeZ eegeefZ!eege"fZ#Gd	d
�d
�Z$e%e"d�dd
�Z&Gdd�d�Z'Gdd�de$�Z(Gdd�de$�Z)Gdd�de$�Z*Gdd�de$�Z+e%e!e#e"e"e%ee
e%e
e$fd�dd�Z,dS)�N)�defaultdict)�Callable�Dict�Iterable�List�Optional�Tuple)�InvalidSdistFilename�InvalidVersion�InvalidWheelFilename�canonicalize_name�parse_sdist_filename�parse_wheel_filename)�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-hv55ucu3/pip/_internal/index/sources.py�linkszLinkSource.linkcCs
t��dS)z9Candidates found by parsing an archive listing HTML file.N)r)rrrr�page_candidates#szLinkSource.page_candidatescCs
t��dS)z,Links found by specifying archives directly.N)r)rrrr�
file_links'szLinkSource.file_linksN)�__name__�
__module__�__qualname__�propertyrrr�FoundCandidatesr�
FoundLinksrrrrrrsr)�file_urlrcCstj|dd�ddkS)NF)�strictrz	text/html)�	mimetypes�
guess_type)r#rrr�
_is_html_file,sr'c@sbeZdZdZedd�dd�Zdd�dd�Zeeed�d	d
��Z	ee
eeefd�dd��ZdS)
�_FlatDirectoryToUrlsz"Scans directory and caches resultsN)�pathrcCs ||_g|_tt�|_d|_dS)NF)�_path�_page_candidatesr�list�_project_name_to_urls�_scanned_directory)rr)rrr�__init__3s
z_FlatDirectoryToUrls.__init__)rc
Cs�x�t�|j�D]�}t|j�}t|�r2|j�|�qyt|j	�d}WnFt
tfk
r�yt|j	�d}Wnt
tfk
r�wYnXYnX|j|�|�qWd|_dS)zrScans directory once and populates both page_candidates
        and project_name_to_urls at the same time
        rTN)�os�scandirr*rr)r'r+�appendr�namerr
r
r	r-r.)r�entry�urlZproject_filenamerrr�_scan_directory9s
z$_FlatDirectoryToUrls._scan_directorycCs|js|��|jS)N)r.r6r+)rrrrrPsz$_FlatDirectoryToUrls.page_candidatescCs|js|��|jS)N)r.r6r-)rrrr�project_name_to_urlsWsz)_FlatDirectoryToUrls.project_name_to_urls)rrr�__doc__�strr/r6r rrrr7rrrrr(0sr(c@sleZdZUdZiZeeefed<e	eedd�dd�Z
eee
d�dd	��Zed�d
d�Zed�dd
�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.
    �_paths_to_urlsN)�candidates_from_pager)�project_namercCsD||_t|�|_||jkr(|j||_nt|d�|_|j|j|<dS)N)r))�_candidates_from_pager�
_project_namer;�
_path_to_urlsr()rr<r)r=rrrr/js

z_FlatDirectorySource.__init__)rcCsdS)Nr)rrrrrzsz_FlatDirectorySource.linkccs*x$|jjD]}|�t|��EdHq
WdS)N)r@rr>r)rr5rrrr~sz$_FlatDirectorySource.page_candidatesccs&x |jj|jD]}t|�VqWdS)N)r@r7r?r)rr5rrrr�sz_FlatDirectorySource.file_links)rrrr8r;rr9r(�__annotations__�CandidatesFromPager/r rrrr!rr"rrrrrr:_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<rrcCs||_||_dS)N)r>�_link)rr<rrrrr/�sz_LocalFileSource.__init__)rcCs|jS)N)rD)rrrrr�sz_LocalFileSource.linkccs&t|jj�sdS|�|j�EdHdS)N)r'rDr5r>)rrrrr�sz _LocalFileSource.page_candidatesccst|jj�rdS|jVdS)N)r'rDr5)rrrrr�sz_LocalFileSource.file_links)rrrr8rBrr/r rrr!rr"rrrrrrC�srCc@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_validatorrrcCs||_||_||_dS)N)r>�_page_validatorrD)rr<rFrrrrr/�sz_RemoteFileSource.__init__)rcCs|jS)N)rD)rrrrr�sz_RemoteFileSource.linkccs&|�|j�sdS|�|j�EdHdS)N)rGrDr>)rrrrr�sz!_RemoteFileSource.page_candidatesccs|jVdS)N)rD)rrrrr�sz_RemoteFileSource.file_links)rrrr8rB�
PageValidatorrr/r rrr!rr"rrrrrrE�srEc@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.
    N)r<rrcCs||_||_dS)N)r>rD)rr<rrrrr/�sz_IndexDirectorySource.__init__)rcCs|jS)N)rD)rrrrr�sz_IndexDirectorySource.linkccs|�|j�EdHdS)N)r>rD)rrrrr�sz%_IndexDirectorySource.page_candidatescCsdS)Nrr)rrrrr�sz _IndexDirectorySource.file_links)rrrr8rBrr/r rrr!rr"rrrrrrI�srI)�locationr<rF�
expand_dir�cache_link_parsingr=rc
Csd}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)rL)r<rFr)r<r)r=)r<rz?Location '%s' is ignored: it is neither a file nor a directory.)r0r)�existsr�
startswithrr�logger�warningrEr�isdirr:rI�isfilerC)
rJr<rFrKrLr=r)r5�msg�sourcerrr�build_source�sN	


rU)-�loggingr%r0�collectionsr�typingrrrrrr�pip._vendor.packaging.utilsr	r
rrr
r�pip._internal.models.candidater�pip._internal.models.linkr�pip._internal.utils.urlsrr�pip._internal.vcsr�	getLoggerrrOr!r"rB�boolrHrr9r'r(r:rCrErIrUrrrr�<module>s8  	
/(!