HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/index/__pycache__/sources.cpython-310.pyc
o

��h�!�@sFddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZmZmZddlmZddlmZdd	lmZmZdd
lmZe�e�ZeeZeeZe
egeefZe
ege fZ!Gdd�d�Z"d(dd�Z#Gdd�d�Z$Gdd�de"�Z%Gdd�de"�Z&Gdd�de"�Z'Gdd�de"�Z(d)d&d'�Z)dS)*�)�annotationsN)�defaultdict)�Iterable)�Callable)�InvalidSdistFilename�InvalidWheelFilename�canonicalize_name�parse_sdist_filename�parse_wheel_filename)�InstallationCandidate)�Link)�path_to_url�url_to_path)�is_urlc@s.eZdZeddd��Zd
dd�Zdd	d
�ZdS)�
LinkSource�return�Link | NonecC�t��)z,Returns the underlying link, if there's one.��NotImplementedError��self�r�F/usr/local/lib/python3.10/dist-packages/pip/_internal/index/sources.py�link szLinkSource.link�FoundCandidatescCr)z9Candidates found by parsing an archive listing HTML file.rrrrr�page_candidates%�zLinkSource.page_candidates�
FoundLinkscCr)z,Links found by specifying archives directly.rrrrr�
file_links)rzLinkSource.file_linksN�rr�rr�rr)�__name__�
__module__�__qualname__�propertyrrrrrrrrs

r�file_url�strr�boolcCstj|dd�ddkS)NF)�strictrz	text/html)�	mimetypes�
guess_type)r'rrr�
_is_html_file.sr-c@s@eZdZdZddd�Zddd	�Zeddd��Zeddd��ZdS)�_FlatDirectoryToUrlsz"Scans directory and caches results�pathr(r�NonecCs ||_g|_tt�|_d|_dS)NF)�_path�_page_candidatesr�list�_project_name_to_urls�_scanned_directory)rr/rrr�__init__5s

z_FlatDirectoryToUrls.__init__cCs�t�|j�D]A}t|j�}t|�r|j�|�qz	t|j	�d}Wnt
y>z	t|j	�d}Wn
ty;YYqwYnw|j
|�|�qd|_dS)zrScans directory once and populates both page_candidates
        and project_name_to_urls at the same time
        rTN)�os�scandirr1r
r/r-r2�appendr
�namerr	rr4r5)r�entry�url�project_filenamerrr�_scan_directory;s"
���
z$_FlatDirectoryToUrls._scan_directory�	list[str]cC�|js|��|jS�N)r5r>r2rrrrrR�z$_FlatDirectoryToUrls.page_candidates�dict[str, list[str]]cCr@rA)r5r>r4rrrr�project_name_to_urlsYrBz)_FlatDirectoryToUrls.project_name_to_urlsN)r/r(rr0)rr0)rr?)rrC)	r#r$r%�__doc__r6r>r&rrDrrrrr.2s

r.c@sJeZdZUdZiZded<ddd�Zeddd��Zddd�Z	ddd�Z
dS)�_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.
    zdict[str, _FlatDirectoryToUrls]�_paths_to_urls�candidates_from_page�CandidatesFromPager/r(�project_namerr0cCsF||_t|�|_||jvr|j||_dSt|d�|_|j|j|<dS)N)r/)�_candidates_from_pager�
_project_namerG�
_path_to_urlsr.)rrHr/rJrrrr6ls

z_FlatDirectorySource.__init__rcCsdSrArrrrrr|sz_FlatDirectorySource.linkrccs(�|jjD]}|�t|��EdHqdSrA)rMrrKr�rr<rrrr�s��z$_FlatDirectorySource.page_candidatesrccs$�|jj|jD]}t|�VqdSrA)rMrDrLrrNrrrr�s��z_FlatDirectorySource.file_linksN)rHrIr/r(rJr(rr0r r!r")r#r$r%rErG�__annotations__r6r&rrrrrrrrFas


rFc@�<eZdZdZddd	�Zeddd��Zddd�Zddd�ZdS)�_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.
    rHrIrrrr0cC�||_||_dSrA�rK�_link�rrHrrrrr6��
z_LocalFileSource.__init__rcC�|jSrA�rTrrrrr�rz_LocalFileSource.linkrccs(�t|jj�s	dS|�|j�EdHdSrA)r-rTr<rKrrrrr���z _LocalFileSource.page_candidatesrccs�t|jj�r	dS|jVdSrA)r-rTr<rrrrr�s�z_LocalFileSource.file_linksN�rHrIrrrr0r r!r"�	r#r$r%rEr6r&rrrrrrrrQ�s
	
rQc@s<eZdZdZdd
d�Zedd
d��Zddd�Zddd�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.
    rHrI�page_validator�
PageValidatorrrrr0cCs||_||_||_dSrA)rK�_page_validatorrT)rrHr]rrrrr6�s
z_RemoteFileSource.__init__rcCrWrArXrrrrr�rz_RemoteFileSource.linkrccs(�|�|j�s	dS|�|j�EdHdSrA)r_rTrKrrrrr�rYz!_RemoteFileSource.page_candidatesrccs�|jVdSrArXrrrrr�s�z_RemoteFileSource.file_linksN)rHrIr]r^rrrr0r r!r"r[rrrrr\�s


r\c@rP)�_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.
    rHrIrrrr0cCrRrArSrUrrrr6�rVz_IndexDirectorySource.__init__rcCrWrArXrrrrr�rz_IndexDirectorySource.linkrccs�|�|j�EdHdSrArSrrrrr�s�z%_IndexDirectorySource.page_candidatesrcCsdS)Nrrrrrrr�sz _IndexDirectorySource.file_linksNrZr r!r"r[rrrrr`�s

r`�locationrHrIr]r^�
expand_dir�cache_link_parsingrJ�$tuple[str | None, LinkSource | None]c
Csd}d}tj�|�rt|�}|}n|�d�r|}t|�}nt|�r#|}|dur1d}t�||�dS|durDt	||t
||d�d�}	||	fStj�|�re|rWt|||d�}	||	fSt
|t
||d�d�}	||	fStj�|�ryt|t
||d�d�}	||	fSt�d|�|dfS)	Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)rc)rHr]r)rHr/rJ)rHrz?Location '%s' is ignored: it is neither a file nor a directory.)r7r/�existsr
�
startswithrr�logger�warningr\r�isdirrFr`�isfilerQ)
rarHr]rbrcrJr/r<�msg�sourcerrr�build_source�s\	

�
��
�
�
��rm)r'r(rr))rar(rHrIr]r^rbr)rcr)rJr(rrd)*�
__future__r�loggingr+r7�collectionsr�collections.abcr�typingr�pip._vendor.packaging.utilsrrrr	r
�pip._internal.models.candidater�pip._internal.models.linkr�pip._internal.utils.urlsr
r�pip._internal.vcsr�	getLoggerr#rgrrrIr)r^rr-r.rFrQr\r`rmrrrr�<module>s2

/(!