Ë
    9i¯eœ  ã                   ó€  — d dl Z d dlZd dlZd dlZd dlmZmZmZmZ d dl	m
Z
 d dlmZ d dlmZmZ d dlmZ  e j$                  e«      Zee
   Zee   Zeegee
   f   Zeegef   Z G d„ d«      Zd	ed
efd„Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z dededededed
eee   ee   f   fd„Z!y)é    N)ÚCallableÚIterableÚOptionalÚTuple)ÚInstallationCandidate)ÚLink)Úpath_to_urlÚurl_to_path)Úis_urlc                   ó@   — e Zd Zedee   fd„«       Zdefd„Zde	fd„Z
y)Ú
LinkSourceÚreturnc                 ó   — t        «       ‚)z,Returns the underlying link, if there's one.©ÚNotImplementedError©Úselfs    úDE:\TRUCKING_PROJECT\Lib\site-packages\pip\_internal\index\sources.pyÚlinkzLinkSource.link   s   € ô "Ó#Ð#ó    c                 ó   — t        «       ‚)z9Candidates found by parsing an archive listing HTML file.r   r   s    r   Úpage_candidateszLinkSource.page_candidates   ó   € ä!Ó#Ð#r   c                 ó   — t        «       ‚)z,Links found by specifying archives directly.r   r   s    r   Ú
file_linkszLinkSource.file_links   r   r   N)Ú__name__Ú
__module__Ú__qualname__Úpropertyr   r   r   ÚFoundCandidatesr   Ú
FoundLinksr   © r   r   r   r      s7   „ Øð$�h˜t‘nò $ó ð$ð$ ó $ð$˜Jô $r   r   Úfile_urlr   c                 ó<   — t        j                  | d¬«      d   dk(  S )NF)Ústrictr   z	text/html)Ú	mimetypesÚ
guess_type)r#   s    r   Ú_is_html_filer(   #   s   € Ü×Ñ °Ô7¸Ñ:¸kÑIÐIr   c                   óX   — e Zd ZdZdededdfd„Zedee	   fd„«       Z
defd„Zdefd	„Zy)
Ú_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.
    Úcandidates_from_pageÚpathr   Nc                 ó€   — || _         t        j                  t        j                  j                  |«      «      | _        y ©N)Ú_candidates_from_pageÚpathlibÚPathÚosr,   ÚrealpathÚ_path)r   r+   r,   s      r   Ú__init__z_FlatDirectorySource.__init__0   s+   € ð
 &:ˆÔ"Ü—\‘\¤"§'¡'×"2Ñ"2°4Ó"8Ó9ˆ�
r   c                  ó   — y r.   r"   r   s    r   r   z_FlatDirectorySource.link8   s   € àr   c              #   óÒ   K  — | j                   j                  «       D ]D  }t        t        |«      «      }t	        |«      sŒ#| j                  t        |«      «      E d {  –—†  ŒF y 7 Œ­wr.   )r4   Úiterdirr	   Ústrr(   r/   r   ©r   r,   Úurls      r   r   z$_FlatDirectorySource.page_candidates<   sX   è ø€ Ø—J‘J×&Ñ&Ó(ò 	=ˆDÜœc $›iÓ(ˆCÜ  Ô%ØØ×1Ñ1´$°s³)Ó<×<Ñ<ñ		=ð =ús   ‚AA'ÁA%ÁA'c              #   ó¤   K  — | j                   j                  «       D ]/  }t        t        |«      «      }t	        |«      rŒ#t        |«      –— Œ1 y ­wr.   )r4   r8   r	   r9   r(   r   r:   s      r   r   z_FlatDirectorySource.file_linksC   sD   è ø€ Ø—J‘J×&Ñ&Ó(ò 	ˆDÜœc $›iÓ(ˆCÜ˜SÔ!ØÜ�s“)‹Oñ		ùs   ‚AA)r   r   r   Ú__doc__ÚCandidatesFromPager9   r5   r   r   r   r   r    r   r!   r   r"   r   r   r*   r*   '   s_   „ ñð:à0ð:ð ð:ð 
ó	:ð ð�h˜t‘nò ó ðð= ó =ð˜Jô r   r*   c                   óX   — e Zd ZdZdededdfd„Zedee   fd„«       Z	de
fd„Zdefd	„Zy)
Ú_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.
    r+   r   r   Nc                 ó    — || _         || _        y r.   ©r/   Ú_link©r   r+   r   s      r   r5   z_LocalFileSource.__init__U   ó   € ð
 &:ˆÔ"Øˆ�
r   c                 ó   — | j                   S r.   ©rC   r   s    r   r   z_LocalFileSource.link]   ó   € à�z‰zÐr   c              #   ó–   K  — t        | j                  j                  «      sy | j                  | j                  «      E d {  –—†  y 7 Œ­wr.   )r(   rC   r;   r/   r   s    r   r   z _LocalFileSource.page_candidatesa   s1   è ø€ Ü˜TŸZ™ZŸ^™^Ô,ØØ×-Ñ-¨d¯j©jÓ9×9Ò9ús   ‚?A	ÁAÁA	c              #   óh   K  — t        | j                  j                  «      ry | j                  –— y ­wr.   )r(   rC   r;   r   s    r   r   z_LocalFileSource.file_linksf   s#   è ø€ Ü˜Ÿ™Ÿ™Ô(ØØ�j‰jÓùs   ‚02©r   r   r   r=   r>   r   r5   r   r   r   r    r   r!   r   r"   r   r   r@   r@   K   s_   „ ñðà0ðð ðð 
ó	ð ð�h˜t‘nò ó ðð: ó :ð
˜Jô r   r@   c                   ó\   — e Zd ZdZdedededdfd„Zede	e   fd„«       Z
defd	„Zdefd
„Zy)Ú_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.
    r+   Úpage_validatorr   r   Nc                 ó.   — || _         || _        || _        y r.   )r/   Ú_page_validatorrC   )r   r+   rN   r   s       r   r5   z_RemoteFileSource.__init__u   s   € ð &:ˆÔ"Ø-ˆÔØˆ�
r   c                 ó   — | j                   S r.   rG   r   s    r   r   z_RemoteFileSource.link   rH   r   c              #   óŽ   K  — | j                  | j                  «      sy | j                  | j                  «      E d {  –—†  y 7 Œ­wr.   )rP   rC   r/   r   s    r   r   z!_RemoteFileSource.page_candidatesƒ   s3   è ø€ Ø×#Ñ# D§J¡JÔ/ØØ×-Ñ-¨d¯j©jÓ9×9Ò9ús   ‚;A½A¾Ac              #   ó(   K  — | j                   –— y ­wr.   rG   r   s    r   r   z_RemoteFileSource.file_linksˆ   s   è ø€ Ø�j‰jÓùs   ‚)r   r   r   r=   r>   ÚPageValidatorr   r5   r   r   r   r    r   r!   r   r"   r   r   rM   rM   l   si   „ ñðà0ðð &ðð ð	ð
 
óð ð�h˜t‘nò ó ðð: ó :ð
˜Jô r   rM   c                   óX   — e Zd ZdZdededdfd„Zedee   fd„«       Z	de
fd„Zdefd	„Zy)
Ú_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.
    r+   r   r   Nc                 ó    — || _         || _        y r.   rB   rD   s      r   r5   z_IndexDirectorySource.__init__“   rE   r   c                 ó   — | j                   S r.   rG   r   s    r   r   z_IndexDirectorySource.link›   rH   r   c              #   óV   K  — | j                  | j                  «      E d {  –—†  y 7 Œ­wr.   rB   r   s    r   r   z%_IndexDirectorySource.page_candidatesŸ   s   è ø€ Ø×-Ñ-¨d¯j©jÓ9×9Ò9ús   ‚)¡'¢)c                  ó   — y)Nr"   r"   r   s    r   r   z _IndexDirectorySource.file_links¢   s   € Ør   rK   r"   r   r   rV   rV   Œ   s_   „ ñðà0ðð ðð 
ó	ð ð�h˜t‘nò ó ðð: ó :ð˜Jô r   rV   Úlocationr+   rN   Ú
expand_dirÚcache_link_parsingc                óv  — d }d }t         j                  j                  | «      rt        | «      }| }n,| j	                  d«      r| }t        | «      }nt        | «      r| }|€d}t        j                  || «       y|€t        ||t        ||¬«      ¬«      }||fS t         j                  j                  |«      r/|rt        ||¬«      }||fS t        |t        ||¬«      ¬«      }||fS t         j                  j                  |«      rt        |t        ||¬«      ¬«      }||fS t        j                  d| «       |d fS )	Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)r]   )r+   rN   r   )r+   r,   )r+   r   z?Location '%s' is ignored: it is neither a file nor a directory.)r2   r,   Úexistsr	   Ú
startswithr
   r   ÚloggerÚwarningrM   r   Úisdirr*   rV   Úisfiler@   )	r[   r+   rN   r\   r]   r,   r;   ÚmsgÚsources	            r   Úbuild_sourcerg   ¦   sM  € ð €DØ€CÜ	‡w�w‡~�~�hÔÜ˜(Ó#ˆØ‰Ø	×	Ñ	˜WÔ	%ØˆÜ˜8Ó$‰Ü	�Ô	Øˆà
€{ðKð 	ô 	�‰�s˜HÔ%Øà€|Ü.Ø!5Ø)Ü�cÐ.@ÔAô
ˆð
 �Vˆ}Ðä	‡w�w‡}�}�TÔÙÜ)Ø%9ØôˆFð �Vˆ}Ðô	 +Ø%9Ü˜#Ð2DÔEôˆFð �Vˆ}ÐÜ	�‰�‰˜Ô	Ü!Ø!5Ü�cÐ.@ÔAô
ˆð �Vˆ}ÐÜ
‡N�NØIØôð �ˆ;Ðr   )"Úloggingr&   r2   r0   Útypingr   r   r   r   Úpip._internal.models.candidater   Úpip._internal.models.linkr   Úpip._internal.utils.urlsr	   r
   Úpip._internal.vcsr   Ú	getLoggerr   ra   r    r!   r>   ÚboolrT   r   r9   r(   r*   r@   rM   rV   rg   r"   r   r   ú<module>rp      s  ðÛ Û Û 	Û ß 6Ó 6å @Ý *ß =Ý $à	ˆ×	Ñ	˜8Ó	$€àÐ0Ñ1€Ø�d‰^€
Ø˜t˜f hÐ/DÑ&EÐEÑFÐ Ø˜$˜ ˜Ñ&€÷$ñ $ðJ˜Cð J Dó Jô!˜:ô !ôH�zô ôB˜
ô ô@˜Jô ð49Øð9ð -ð9ð "ð	9ð
 ð9ð ð9ð ˆ8�C‰=˜( :Ñ.Ð.Ñ/ô9r   