
    q"h!                        S SK r S SKrS SKrS SKJr  S SKJrJrJrJ	r	J
r
Jr  S SKJrJrJrJrJr  S SKJr  S SKJr  S SKJrJr  S SKJr  \ R6                  " \5      r\\   r\\   r\\/\\   4   r \\/\!4   r" " S	 S
5      r#S\$S\!4S jr% " S S5      r& " S S\#5      r' " S S\#5      r( " S S\#5      r) " S S\#5      r*S\$S\ S\"S\!S\!S\$S\\
\$   \
\#   4   4S jr+g)    N)defaultdict)CallableDictIterableListOptionalTuple)InvalidSdistFilenameInvalidWheelFilenamecanonicalize_nameparse_sdist_filenameparse_wheel_filename)InstallationCandidate)Link)path_to_urlurl_to_path)is_urlc                   N    \ rS rSr\S\\   4S j5       rS\4S jr	S\
4S jrSrg)
LinkSource   returnc                     [        5       e)z,Returns the underlying link, if there's one.NotImplementedErrorselfs    M/var/www/html/env/lib/python3.13/site-packages/pip/_internal/index/sources.pylinkLinkSource.link   s     "##    c                     [        5       e)z9Candidates found by parsing an archive listing HTML file.r   r   s    r   page_candidatesLinkSource.page_candidates"       !##r    c                     [        5       e)z,Links found by specifying archives directly.r   r   s    r   
file_linksLinkSource.file_links&   r$   r     N)__name__
__module____qualname____firstlineno__propertyr   r   r   FoundCandidatesr"   
FoundLinksr&   __static_attributes__r(   r    r   r   r      s7    $htn $ $$ $$J $r    r   file_urlr   c                 8    [         R                  " U SS9S   S:H  $ )NF)strictr   z	text/html)	mimetypes
guess_type)r1   s    r   _is_html_filer6   +   s    7:kIIr    c                   z    \ rS rSrSrS\SS4S jrSS jr\S\	\   4S j5       r
\S\\\	\   4   4S	 j5       rS
rg)_FlatDirectoryToUrls/   z"Scans directory and caches resultspathr   Nc                 T    Xl         / U l        [        [        5      U l        SU l        g )NF)_path_page_candidatesr   list_project_name_to_urls_scanned_directory)r   r:   s     r   __init___FlatDirectoryToUrls.__init__2   s$    
+-;Ft;L""'r    c                    [         R                  " U R                  5       H|  n[        UR                  5      n[        U5      (       a  U R                  R                  U5        ME   [        UR                  5      S   nU R                  U   R                  U5        M~     SU l        g! [         a.     [        UR                  5      S   n NO! [         a      M  f = ff = f)zbScans directory once and populates both page_candidates
and project_name_to_urls at the same time
r   TN)osscandirr<   r   r:   r6   r=   appendr   namer   r   r
   r?   r@   )r   entryurlproject_filenames       r   _scan_directory$_FlatDirectoryToUrls._scan_directory8   s     ZZ

+Eejj)CS!!%%,,S1#7

#CA#F  &&'78??D! ," #' ( ';EJJ'G'J$+ s*   'B))
C!4C
CC!CC!c                 \    U R                   (       d  U R                  5         U R                  $ N)r@   rK   r=   r   s    r   r"   $_FlatDirectoryToUrls.page_candidatesO   s#    &&  "$$$r    c                 \    U R                   (       d  U R                  5         U R                  $ rN   )r@   rK   r?   r   s    r   project_name_to_urls)_FlatDirectoryToUrls.project_name_to_urlsV   s#    &&  ")))r    )r=   r<   r?   r@   )r   N)r)   r*   r+   r,   __doc__strrA   rK   r-   r   r"   r   rQ   r0   r(   r    r   r8   r8   /   sd    ,(S (T ('. %c % % *d3S	>&: * *r    r8   c                       \ rS rSr% Sr0 r\\\4   \	S'   S\
S\S\SS4S	 jr\S\\   4S
 j5       rS\4S jrS\4S jrSrg)_FlatDirectorySource^   zLink 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_urlscandidates_from_pager:   project_namer   Nc                     Xl         [        U5      U l        X R                  ;   a  U R                  U   U l        g [        US9U l        U R                  U R                  U'   g )N)r:   )_candidates_from_pager   _project_namerX   _path_to_urlsr8   )r   rY   r:   rZ   s       r   rA   _FlatDirectorySource.__init__i   s[     &:".|< &&&!%!4!4T!:D!54!@D(,(:(:D%r    c                     g rN   r(   r   s    r   r   _FlatDirectorySource.linky   s    r    c              #      #    U R                   R                   H%  nU R                  [        U5      5       S h  vN   M'     g  N	7frN   )r^   r"   r\   r   r   rI   s     r   r"   $_FlatDirectorySource.page_candidates}   s6     %%55C11$s)<<< 6<s   7AA
Ac              #   z   #    U R                   R                  U R                      H  n[        U5      v   M     g 7frN   )r^   rQ   r]   r   rc   s     r   r&   _FlatDirectorySource.file_links   s0     %%::4;M;MNCs)O Os   9;)r\   r^   r]   )r)   r*   r+   r,   rS   rX   r   rT   r8   __annotations__CandidatesFromPagerA   r-   r   r   r   r.   r"   r/   r&   r0   r(   r    r   rV   rV   ^   s     79ND2238;0; ; 	;
 
;  htn  = =J r    rV   c                   h    \ rS rSrSrS\S\SS4S jr\S\	\   4S j5       r
S\4S	 jrS\4S
 jrSrg)_LocalFileSource   a/  ``--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.
rY   r   r   Nc                     Xl         X l        g rN   r\   _linkr   rY   r   s      r   rA   _LocalFileSource.__init__       
 &:"
r    c                     U R                   $ rN   rn   r   s    r   r   _LocalFileSource.link       zzr    c              #      #    [        U R                  R                  5      (       d  g U R                  U R                  5       S h  vN   g  N7frN   )r6   rn   rI   r\   r   s    r   r"    _LocalFileSource.page_candidates   s3     TZZ^^,,--djj999s   AAAAc              #   r   #    [        U R                  R                  5      (       a  g U R                  v   g 7frN   )r6   rn   rI   r   s    r   r&   _LocalFileSource.file_links   s%     ((jjs   57rm   r)   r*   r+   r,   rS   rh   r   rA   r-   r   r   r.   r"   r/   r&   r0   r(   r    r   rj   rj      s_    0  
	 htn  : :
J r    rj   c                   l    \ rS rSrSrS\S\S\SS4S jr\	S\
\   4S	 j5       rS\4S
 jrS\4S jrSrg)_RemoteFileSource   z``--find-links=<url>`` or ``--[extra-]index-url=<url>``.

This returns:

* ``page_candidates``: Links listed on an HTML file.
* ``file_candidates``: The non-HTML file.
rY   page_validatorr   r   Nc                 (    Xl         X l        X0l        g rN   )r\   _page_validatorrn   )r   rY   r~   r   s       r   rA   _RemoteFileSource.__init__   s     &:"-
r    c                     U R                   $ rN   rs   r   s    r   r   _RemoteFileSource.link   ru   r    c              #      #    U R                  U R                  5      (       d  g U R                  U R                  5       S h  vN   g  N7frN   )r   rn   r\   r   s    r   r"   !_RemoteFileSource.page_candidates   s5     ##DJJ//--djj999s   A A
AA
c              #   (   #    U R                   v   g 7frN   rs   r   s    r   r&   _RemoteFileSource.file_links   s     jjs   )r\   rn   r   )r)   r*   r+   r,   rS   rh   PageValidatorr   rA   r-   r   r   r.   r"   r/   r&   r0   r(   r    r   r|   r|      si    0 & 	
 
 htn  : :
J r    r|   c                   h    \ rS rSrSrS\S\SS4S jr\S\	\   4S j5       r
S\4S	 jrS\4S
 jrSrg)_IndexDirectorySource   z``--[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.
rY   r   r   Nc                     Xl         X l        g rN   rm   ro   s      r   rA   _IndexDirectorySource.__init__   rq   r    c                     U R                   $ rN   rs   r   s    r   r   _IndexDirectorySource.link   ru   r    c              #   V   #    U R                  U R                  5       S h  vN   g  N7frN   rm   r   s    r   r"   %_IndexDirectorySource.page_candidates   s     --djj999s   )')c                     g)Nr(   r(   r   s    r   r&    _IndexDirectorySource.file_links   s    r    rm   rz   r(   r    r   r   r      s_    0  
	 htn  : :J r    r   locationrY   r~   
expand_dircache_link_parsingrZ   c          	      ~   S nS n[         R                  R                  U 5      (       a  [        U 5      nU nO6U R	                  S5      (       a  U n[        U 5      nO[        U 5      (       a  U nUc  Sn[        R                  X5        gUc  [        UU[        XtS9S9n	Xy4$ [         R                  R                  U5      (       a)  U(       a  [        UUUS9n	Xy4$ [        U[        XtS9S9n	Xy4$ [         R                  R                  U5      (       a  [        U[        XtS9S9n	Xy4$ [        R                  SU 5        US 4$ )	Nzfile:zVLocation '%s' is ignored: it is either a non-existing path or lacks a specific scheme.)NN)r   )rY   r~   r   )rY   r:   rZ   )rY   r   z?Location '%s' is ignored: it is neither a file nor a directory.)rD   r:   existsr   
startswithr   r   loggerwarningr|   r   isdirrV   r   isfilerj   )
r   rY   r~   r   r   rZ   r:   rI   msgsources
             r   build_sourcer      sL    DC	ww~~h(#			W	%	%8$			
{K 	 	s%|.!5)cA

 }	ww}}T)%9)F }	 +%9#EF }			!!5cA
 }
NNI ;r    ),loggingr4   rD   collectionsr   typingr   r   r   r   r   r	   pip._vendor.packaging.utilsr
   r   r   r   r   pip._internal.models.candidater   pip._internal.models.linkr   pip._internal.utils.urlsr   r   pip._internal.vcsr   	getLoggerr)   r   r.   r/   rh   boolr   r   rT   r6   r8   rV   rj   r|   r   r   r(   r    r   <module>r      s6     	 # B B  A * = $			8	$01d^
tfh/D&EEF $&$ $JC JD J,* ,*^%: %Pz B
 @J 4;; -; "	;
 ; ; ; 8C=(:../;r    