� ��^i�����ddlZddlZddlZddlZddlmZmZmZmZddl m Z ddl m Z ddl mZmZddlmZeje��Zee Zee Zee gee fZee gefZGd�d��Zd ed efd �ZGd �d e��ZGd�de��ZGd�de��ZGd�de��Z dededededed eeeeeff d�Z!dS)�N)�Callable�Iterable�Optional�Tuple)�InstallationCandidate)�Link)� path_to_url� url_to_path)�is_urlc�N�eZdZedeefd���Zdefd�Zde fd�Z dS)� LinkSource�returnc��t���)z,Returns the underlying link, if there's one.��NotImplementedError��selfs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/index/sources.py�linkzLinkSource.links��"�#�#�#�c��t���)z9Candidates found by parsing an archive listing HTML file.rrs r�page_candidateszLinkSource.page_candidates���!�#�#�#rc��t���)z,Links found by specifying archives directly.rrs r� file_linkszLinkSource.file_linksrrN) �__name__� __module__� __qualname__�propertyrrr�FoundCandidatesr� FoundLinksr�rrr r ss������ �$�h�t�n�$�$�$��X�$�$��$�$�$�$�$�J�$�$�$�$�$�$rr �file_urlrc�B�tj|d���ddkS)NF)�strictrz text/html)� mimetypes� guess_type)r#s r� _is_html_filer(#s"�� � ��� 7� 7� 7�� :�k� I�Irc�f�eZdZdZdededdfd�Zedee fd���Z de fd�Z de fd �ZdS) �_FlatDirectorySourcez�Link source specified by ``--find-links=``. 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. �candidates_from_page�pathrNc��||_tjtj�|����|_dS�N)�_candidates_from_page�pathlib�Path�osr,�realpath�_path)rr+r,s r�__init__z_FlatDirectorySource.__init__0s1�� &:��"��\�"�'�"2�"2�4�"8�"8�9�9�� � � rc��dSr.r"rs rrz_FlatDirectorySource.link8s���trc#��K�|j���D]V}tt|����}t |��s�.|�t |����Ed{V���WdSr.)r4�iterdirr �strr(r/r�rr,�urls rrz$_FlatDirectorySource.page_candidates<s������J�&�&�(�(� =� =�D��c�$�i�i�(�(�C� ��%�%� ���1�1�$�s�)�)�<�<� <� <� <� <� <� <� <� <�  =� =rc#�K�|j���D]?}tt|����}t |��r�.t |��V��@dSr.)r4r8r r9r(rr:s rrz_FlatDirectorySource.file_linksCsd�����J�&�&�(�(� � �D��c�$�i�i�(�(�C��S�!�!� ���s�)�)�O�O�O�O�  � r)rrr�__doc__�CandidatesFromPager9r5rrrrr rr!rr"rrr*r*'s���������:�0�:��:� � :�:�:�:���h�t�n�����X��=��=�=�=�=��J������rr*c�f�eZdZdZdededdfd�Zedeefd���Z de fd�Z de fd �Z dS) �_LocalFileSourceaC``--find-links=`` or ``--[extra-]index-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. r+rrNc�"�||_||_dSr.�r/�_link�rr+rs rr5z_LocalFileSource.__init__U��� &:��"��� � � rc��|jSr.�rCrs rrz_LocalFileSource.link]� ���z�rc#�K�t|jj��sdS|�|j��Ed{V��dSr.)r(rCr;r/rs rrz _LocalFileSource.page_candidatesasM�����T�Z�^�,�,� � �F��-�-�d�j�9�9�9�9�9�9�9�9�9�9�9rc#�RK�t|jj��rdS|jV�dSr.)r(rCr;rs rrz_LocalFileSource.file_linksfs3���� ���� (� (� � �F��j�����r�rrrr=r>rr5rrrr rr!rr"rrr@r@Ks����������0���� � ������h�t�n�����X��:��:�:�:�:� �J������rr@c�j�eZdZdZdedededdfd�Zede efd���Z de fd �Z de fd �ZdS) �_RemoteFileSourcez�``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. r+�page_validatorrrNc�0�||_||_||_dSr.)r/�_page_validatorrC)rr+rNrs rr5z_RemoteFileSource.__init__us�� &:��"�-����� � � rc��|jSr.rGrs rrz_RemoteFileSource.linkrHrc#�K�|�|j��sdS|�|j��Ed{V��dSr.)rPrCr/rs rrz!_RemoteFileSource.page_candidates�sQ�����#�#�D�J�/�/� � �F��-�-�d�j�9�9�9�9�9�9�9�9�9�9�9rc#�K�|jV�dSr.rGrs rrz_RemoteFileSource.file_links�s�����j�����r)rrrr=r>� PageValidatorrr5rrrr rr!rr"rrrMrMls����������0��&��� � � ������h�t�n�����X��:��:�:�:�:� �J������rrMc�f�eZdZdZdededdfd�Zedeefd���Z de fd�Z de fd �Z dS) �_IndexDirectorySourcez�``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. r+rrNc�"�||_||_dSr.rBrDs rr5z_IndexDirectorySource.__init__�rErc��|jSr.rGrs rrz_IndexDirectorySource.link�rHrc#�JK�|�|j��Ed{V��dSr.rBrs rrz%_IndexDirectorySource.page_candidates�s4�����-�-�d�j�9�9�9�9�9�9�9�9�9�9�9rc��dS)Nr"r"rs rrz _IndexDirectorySource.file_links�s���rrrKr"rrrVrV�s��������� �0���� � ������h�t�n�����X��:��:�:�:�:��J������rrV�locationr+rN� expand_dir�cache_link_parsingc���d}d}tj�|��rt|��}|}n8|�d��r|}t |��}nt |��r|}|�d}t�||��dS|�%t||t||������}||fStj� |��r8|rt||���}n t|t||������}||fStj�|��r$t|t||������}||fSt�d|��|dfS) Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)r])r+rNr)r+r,)r+rz?Location '%s' is ignored: it is neither a file nor a directory.)r2r,�existsr � startswithr r �logger�warningrMr�isdirr*rV�isfiler@) r[r+rNr\r]r,r;�msg�sources r� build_sourcerg�s����D��C� �w�~�~�h�����(�#�#����� � � �W� %� %�����8�$�$��� �� � ���� �{� K� � ���s�H�%�%�%��|� �|�.�!5�)��c�.@�A�A�A� � � �� �V�}�� �w�}�}�T���� � �)�%9�����F�F� +�%9��#�2D�E�E�E����F��V�}�� ����� � ��!�!5��c�.@�A�A�A� � � ���V�}�� �N�N�I����� ��;�r)"�loggingr&r2r0�typingrrrr�pip._internal.models.candidater�pip._internal.models.linkr�pip._internal.utils.urlsr r �pip._internal.vcsr � getLoggerrrar r!r>�boolrTr r9r(r*r@rMrVrgr"rr�rpsR���������� � � � �����6�6�6�6�6�6�6�6�6�6�6�6�@�@�@�@�@�@�*�*�*�*�*�*�=�=�=�=�=�=�=�=�$�$�$�$�$�$� �� �8� $� $���0�1�� �d�^� ��t�f�h�/D�&E�E�F���$����&� � $� $� $� $� $� $� $� $�J�C�J�D�J�J�J�J�!�!�!�!�!�:�!�!�!�H�����z����B����� ����@�����J����4:��:�-�:�"� :� � :� � :� �8�C�=�(�:�.� .�/�:�:�:�:�:�:r