
    4Քh!                       S SK Jr  S SKrS SKrS SKrS SKJr  S SKJr  S SK	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  \R4                  " \5      r\\   r\\   r\
\/\\   4   r\
\/\ 4   r! " S S5      r"S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 jr)g)    )annotationsN)defaultdict)Iterable)Callable)InvalidSdistFilenameInvalidWheelFilenamecanonicalize_nameparse_sdist_filenameparse_wheel_filename)InstallationCandidate)Link)path_to_urlurl_to_path)is_urlc                  <    \ rS rSr\SS j5       rSS jrS	S jrSrg)

LinkSource   c                    [        5       e)z,Returns the underlying link, if there's one.NotImplementedErrorselfs    S/var/www/auris/envauris/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returnzLink | Noner&   FoundCandidatesr&   
FoundLinks)	__name__
__module____qualname____firstlineno__propertyr   r   r"   __static_attributes__r$   r   r   r   r      s    $ $$$r   r   c                8    [         R                  " U SS9S   S:H  $ )NF)strictr   z	text/html)	mimetypes
guess_type)file_urls    r   _is_html_filer6   .   s    7:kIIr   c                  T    \ rS rSrSrS	S jrS
S jr\SS j5       r\SS j5       r	Sr
g)_FlatDirectoryToUrls2   z"Scans directory and caches resultsc                T    Xl         / U l        [        [        5      U l        SU l        g )NF)_path_page_candidatesr   list_project_name_to_urls_scanned_directory)r   paths     r   __init___FlatDirectoryToUrls.__init__5   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_directory;   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_candidatesR   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_urlsY   s#    &&  ")))r   )r<   r;   r>   r?   N)r@   strr&   None)r&   rT   )r&   z	list[str])r&   zdict[str, list[str]])r+   r,   r-   r.   __doc__rA   rK   r/   r   rQ   r0   r$   r   r   r8   r8   2   s7    ,('. % % * *r   r8   c                  j    \ rS rSr% Sr0 rS\S'           SS jr\SS j5       r	SS jr
SS jrS	rg
)_FlatDirectorySourcea   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.
zdict[str, _FlatDirectoryToUrls]_paths_to_urlsc                    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_namerY   _path_to_urlsr8   )r   candidates_from_pager@   project_names       r   rA   _FlatDirectorySource.__init__l   s[     &:".|< &&&!%!4!4T!:D!54!@D(,(:(:D%r   c                    g rN   r$   r   s    r   r   _FlatDirectorySource.link|   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   rd   s     r   r"   _FlatDirectorySource.file_links   s0     %%::4;M;MNCs)O Os   9;)r[   r]   r\   N)r^   CandidatesFromPager@   rS   r_   rS   r&   rT   r%   r'   r)   )r+   r,   r-   r.   rU   rY   __annotations__rA   r/   r   r   r"   r0   r$   r   r   rW   rW   a   s]     79N38;0; ; 	;
 
;   =r   rW   c                  V    \ rS rSrSr      S	S jr\S
S j5       rSS jrS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.
c                    Xl         X l        g rN   r[   _linkr   r^   r   s      r   rA   _LocalFileSource.__init__       
 &:"
r   c                    U R                   $ rN   ro   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   ro   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   ro   rI   r   s    r   r"   _LocalFileSource.file_links   s%     ((jjs   57rn   Nr^   rh   r   r   r&   rT   r%   r'   r)   r+   r,   r-   r.   rU   rA   r/   r   r   r"   r0   r$   r   r   rk   rk      sF    0  
	  :
r   rk   c                  Z    \ rS rSrSr        S	S jr\S
S j5       rSS jrS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.
c                (    Xl         X l        X0l        g rN   )r[   _page_validatorro   )r   r^   page_validatorr   s       r   rA   _RemoteFileSource.__init__   s     &:"-
r   c                    U R                   $ rN   rt   r   s    r   r   _RemoteFileSource.link   rv   r   c              #     #    U R                  U R                  5      (       d  g U R                  U R                  5       S h  vN   g  N7frN   )r   ro   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   rt   r   s    r   r"   _RemoteFileSource.file_links   s     jjs   )r[   ro   r   N)r^   rh   r   PageValidatorr   r   r&   rT   r%   r'   r)   r|   r$   r   r   r~   r~      sP    0 & 	
 
  :
r   r~   c                  V    \ rS rSrSr      S	S jr\S
S j5       rSS jrS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.
c                    Xl         X l        g rN   rn   rp   s      r   rA   _IndexDirectorySource.__init__   rr   r   c                    U R                   $ rN   rt   r   s    r   r   _IndexDirectorySource.link   rv   r   c              #  V   #    U R                  U R                  5       S h  vN   g  N7frN   rn   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   rn   Nr{   r%   r'   r)   r|   r$   r   r   r   r      sF    0  
	  :r   r   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)cache_link_parsing)r^   r   r   )r^   r@   r_   )r^   r   z?Location '%s' is ignored: it is neither a file nor a directory.)rD   r@   existsr   
startswithr   r   loggerwarningr~   r   isdirrW   r   isfilerk   )
locationr^   r   
expand_dirr   r_   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   )r5   rS   r&   bool)r   rS   r^   rh   r   r   r   r   r   r   r_   rS   r&   z$tuple[str | None, LinkSource | None])*
__future__r   loggingr3   rD   collectionsr   collections.abcr   typingr   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   r   r   r   r6   r8   rW   rk   r~   r   r   r$   r   r   <module>r      s   "   	 # $   A * = $			8	$01d^
tfh/D&EEF $&$ $J,* ,*^%: %Pz B
 @J 4;; -; "	;
 ; ; ; *;r   