
    *,h                        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    ]/var/www/html/Resume-Scraper/venv/lib/python3.12/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    $htn $ $$ $$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)
_FlatDirectorySourcezLink 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"24"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     JJ&&( 	=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     JJ&&( 	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: : 
	: htn  = =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]       zz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     TZZ^^,--djj999s   ?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#     (jjs   02r   r   r   r=   r>   r   r5   r   r   r   r    r   r!   r   r"   r   r   r@   r@   K   s_    0  
	 htn  : :
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     ##DJJ/--djj999s   ;AAAc              #   (   K   | j                    y wr.   rG   r   s    r   r   z_RemoteFileSource.file_links   s     jjs   )r   r   r   r=   r>   PageValidatorr   r5   r   r   r   r    r   r!   r   r"   r   r   rM   rM   l   si    0 & 	
 
 htn  : :
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     --djj999s   )')c                      y)Nr"   r"   r   s    r   r   z _IndexDirectorySource.file_links   s    r   rK   r"   r   r   rV   rV      s_    0  
	 htn  : :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	ww~~h(#			W	%8$		
{K 	 	sH%|.!5)c.@A

 V}	ww}}T)%9F V}	 +%9#2DEF V}		!!5c.@A
 V}
NN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^
tfh/D&EEF $&$ $JC JD J!: !Hz B
 @J 499 -9 "	9
 9 9 8C=(:../9r   