+
    <j?                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t
^ RIt
^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHtHt ^ RIHt ^ RI H!t! ^ RI"H#t#H$t$ ^ R	I%H&t& ^ R
I'H(t( ^ RI)H*t* ^ RI+H,t, ^ RI-H.t. ^ RI/H0t0 ^ RI1H2t2 ^ RI3H4t4 ^RI5H6t6H7t7H8t8 ]Pr                  ! ]:4      t;]]<]<3,          t=R R lt> ! R R]?4      t@R R ltA ! R R]?4      tBR R ltCR R ltDR R ltE ! R  R!4      tF ! R" R#]4      tGR$ R% ltH]HR& R' l4       tI]! R(R)7       ! R* R+4      4       tJ ! R, R-]4      tKR8R. R/ lltLR9R0 R1 lltMR2 R3 ltN ! R4 R5]4      tO ! R6 R74      tPR# ):zO
The main purpose of this module is to expose LinkCollector.collect_sources().
N)	dataclass)
HTMLParser)Values)CallableDictIterableListMutableMapping
NamedTupleOptionalProtocolSequenceTupleUnion)requestsResponse)
RetryErrorSSLError)NetworkConnectionError)Link)SearchScope)
PipSession)raise_for_status)is_archive_fileredact_auth_from_url)vcs)CandidatesFromPage
LinkSourcebuild_sourcec                F    V ^8  d   QhR\         R\        \         ,          /# )   urlreturn)strr   )formats   "R/opt/headortail/venv/lib/python3.14/site-packages/pip/_internal/index/collector.py__annotate__r(   3   s      3 8C=     c                    \         P                   FE  pV P                  4       P                  V4      '       g   K*  V \	        V4      ,          R9   g   KC  Vu # 	  R# )z_Look for VCS schemes in the URL.

Returns the matched VCS scheme, or None if there's no match.
z+:N)r   schemeslower
startswithlen)r#   schemes   & r'   _match_vcs_schemer0   3   sC    
 ++99;!!&))c#f+.>$.FM  r)   c                   >   a a ] tR t^>t oV3R lV 3R lltRtVtV ;t# )_NotAPIContentc                *   < V ^8  d   QhRS[ RS[ RR/# )r"   content_typerequest_descr$   Nr%   )r&   __classdict__s   "r'   r(   _NotAPIContent.__annotate__?   s"     ) )S ) ) )r)   c                >   < \         SV `  W4       Wn        W n        R # N)super__init__r4   r5   )selfr4   r5   	__class__s   &&&r'   r<   _NotAPIContent.__init__?   s    4((r)   )r4   r5   )__name__
__module____qualname____firstlineno__r<   __static_attributes____classdictcell____classcell__r>   r7   s   @@r'   r2   r2   >   s     ) ) )r)   r2   c                (    V ^8  d   QhR\         RR/# )r"   responser$   Nr   )r&   s   "r'   r(   r(   E   s     @ @ @d @r)   c                    V P                   P                  RR4      pVP                  4       pVP                  R4      '       d   R# \	        WP
                  P                  4      h)z
Check the Content-Type header to ensure the response contains a Simple
API Response.

Raises `_NotAPIContent` if the content type is not a valid content-type.
Content-TypeUnknownN)z	text/htmlz#application/vnd.pypi.simple.v1+html#application/vnd.pypi.simple.v1+json)headersgetr,   r-   r2   requestmethod)rI   r4   content_type_ls   &  r'   _ensure_api_headerrS   E   s^     ##''	BL!'')N  	
  	
'7'7'>'>
??r)   c                       ] tR t^[tRtR# )_NotHTTP N)r@   rA   rB   rC   rD   rV   r)   r'   rU   rU   [   s    r)   rU   c                4    V ^8  d   QhR\         R\        RR/# )r"   r#   sessionr$   N)r%   r   )r&   s   "r'   r(   r(   _   s!      c J 4 r)   c                    \         P                  P                  V 4      w  r#rEpVR9  d   \        4       hVP	                  V RR7      p\        V4       \        V4       R# )z
Send a HEAD request to the URL, and ensure the response contains a simple
API Response.

Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotAPIContent` if the content type is not a valid content type.
T)allow_redirectsN>   httphttps)urllibparseurlsplitrU   headr   rS   )r#   rX   r/   netlocpathqueryfragmentresps   &&      r'   _ensure_api_responserf   _   sR     -3LL,A,A#,F)FD&&j<<T<2DTtr)   c                <    V ^8  d   QhR\         R\        R\        /# )r"   r#   rX   r$   )r%   r   r   )r&   s   "r'   r(   r(   q   s!     < <c <J <8 <r)   c                   \        \        V 4      P                  4      '       d   \        WR7       \        P                  R\        V 4      4       VP                  V RRP                  . RO4      RR/R7      p\        V4       \        V4       \        P                  R\        V 4      VP                  P                  R	R
4      4       V# )a5  Access an Simple API response with GET, and return the response.

This consists of three parts:

1. If the URL looks suspiciously like an archive, send a HEAD first to
   check the Content-Type is HTML or Simple API, to avoid downloading a
   large file. Raise `_NotHTTP` if the content type cannot be determined, or
   `_NotAPIContent` if it is not HTML or a Simple API.
2. Actually perform the request. Raise HTTP exceptions on network failures.
3. Check the Content-Type header to make sure we got a Simple API response,
   and raise `_NotAPIContent` otherwise.
rX   zGetting page %sAcceptz, zCache-Controlz	max-age=0)rN   zFetched page %s as %srK   rL   )rM   z*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01)r   r   filenamerf   loggerdebugr   rO   joinr   rS   rN   )r#   rX   re   s   && r'   _get_simple_responsero   q   s     tCy))**S2
LL"$8$=>;;dii( [+
  D4 T t
LLS!3 Kr)   c                F    V ^8  d   QhR\         R\        \        ,          /# )r"   rN   r$   )ResponseHeadersr   r%   )r&   s   "r'   r(   r(      s       HSM r)   c                    V '       dV   RV 9   dO   \         P                  P                  4       pV R,          VR&   VP                  R4      pV'       d   \	        V4      # R# )z=Determine if we have any encoding information in our headers.rK   zcontent-typecharsetN)emailmessageMessage	get_paramr%   )rN   mrs   s   &  r'   _get_encoding_from_headersry      sK    >W,MM!!##N3.++i(w<r)   c                   V   a  ] tR t^t o V 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )	CacheablePageContentc                "   < V ^8  d   QhRRRR/# )r"   pageIndexContentr$   NrV   )r&   r7   s   "r'   r(   !CacheablePageContent.__annotate__   s      ^  r)   c                :    VP                   '       g   Q hWn        R # r:   )cache_link_parsingr}   r=   r}   s   &&r'   r<   CacheablePageContent.__init__   s    &&&&&	r)   c                &   < V ^8  d   QhRS[ RS[/# )r"   otherr$   )objectbool)r&   r7   s   "r'   r(   r      s     Q QF Qt Qr)   c                    \        V\        V 4      4      ;'       d.    V P                  P                  VP                  P                  8H  # r:   )
isinstancetyper}   r#   )r=   r   s   &&r'   __eq__CacheablePageContent.__eq__   s0    %d,PP%**..1PPr)   c                    < V ^8  d   QhRS[ /# r"   r$   )int)r&   r7   s   "r'   r(   r      s     # ## #r)   c                @    \        V P                  P                  4      # r:   )hashr}   r#   r=   s   &r'   __hash__CacheablePageContent.__hash__   s    DIIMM""r)   )r}   N)	r@   rA   rB   rC   r<   r   r   rD   rE   r7   s   @r'   r{   r{      s%      Q Q# #r)   r{   c                   2   a  ] tR t^t o V 3R lR ltRtV tR# )
ParseLinksc                4   < V ^8  d   QhRRRS[ S[,          /# r"   r}   r~   r$   r   r   )r&   r7   s   "r'   r(   ParseLinks.__annotate__   s    CC^CCr)   c                    R # r:   rV   r   s   &&r'   __call__ParseLinks.__call__   s    r)   rV   N)r@   rA   rB   rC   r   rD   rE   r   s   @r'   r   r      s     CCr)   r   c                0    V ^8  d   QhR\         R\         /# )r"   fnr$   )r   )r&   s   "r'   r(   r(      s      *  r)   c                   a a \         P                  ! RR7      R V 3R ll4       o\         P                  ! S 4      R V V3R ll4       pV# )z
Given a function that parses an Iterable[Link] from an IndexContent, cache the
function's result (keyed by CacheablePageContent), unless the IndexContent
`page` has `page.cache_link_parsing == False`.
N)maxsizec                F    V ^8  d   QhR\         R\        \        ,          /# )r"   cacheable_pager$   )r{   r   r   )r&   s   "r'   r(   /with_cached_index_content.<locals>.__annotate__   s     - - 4 -d -r)   c                 :   < \        S! V P                  4      4      # r:   )listr}   )r   r   s   &r'   wrapper*with_cached_index_content.<locals>.wrapper   s    B~**+,,r)   c                >    V ^8  d   QhRRR\         \        ,          /# r   )r   r   )r&   s   "r'   r(   r      s      n d r)   c                 l   < V P                   '       d   S! \        V 4      4      # \        S! V 4      4      # r:   )r   r{   r   )r}   r   r   s   &r'   wrapper_wrapper2with_cached_index_content.<locals>.wrapper_wrapper   s.    """/566BtH~r)   )	functools	lru_cachewraps)r   r   r   s   f @r'   with_cached_index_contentr      sL     &- '- __R  
 r)   c                >    V ^8  d   QhRRR\         \        ,          /# r   r   )r&   s   "r'   r(   r(      s      n $ r)   c              #    "   V P                   P                  4       pVP                  R4      '       df   \        P                  ! V P
                  4      pVP                  R. 4       F-  p\        P                  ! W0P                  4      pVf   K)  Vx  K/  	  R# \        V P                  4      pV P                  ;'       g    RpVP                  V P
                  P                  V4      4       V P                  pVP                  ;'       g    TpVP                   F%  p	\        P                   ! WVR7      pVf   K!  Vx  K'  	  R# 5i)zT
Parse a Simple API's Index Content, and yield its anchor elements as Link objects.
rM   filesNzutf-8)page_urlbase_url)r4   r,   r-   jsonloadscontentrO   r   	from_jsonr#   HTMLLinkParserencodingfeeddecoder   anchorsfrom_element)
r}   rR   datafilelinkparserr   r#   r   anchors
   &         r'   parse_linksr      s      &&,,.N  !FGGzz$,,'HHWb)D>>$1D|J	 *
 	DHH%F}}''H
KK##H-.
((C%%#H..  I<
	 !s   B>EAE:ET)frozenc                   F   a  ] tR t^t o RtRtV 3R lR ltV 3R ltRtV t	R# )r~   at  Represents one response (or page), along with its URL.

:param encoding: the encoding to decode the given content.
:param url: the URL from which the HTML was downloaded.
:param cache_link_parsing: whether links parsed from this page's url
                           should be cached. PyPI index urls should
                           have this set to False, for example.
Tc                    < V ^8  d   QhRS[ /# r   r6   )r&   r7   s   "r'   r(   IndexContent.__annotate__  s     . . .r)   c                ,    \        V P                  4      # r:   )r   r#   r   s   &r'   __str__IndexContent.__str__  s    #DHH--r)   c                f   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[S[,          ;R&   S[;R&   S[;R&   # )r"   r   r4   r   r#   r   )bytesr%   r   r   )r&   r7   s   "r'   r(   r      sH      N    sm  
H  # r)   rV   N)
r@   rA   rB   rC   __doc__r   r   __annotate_func__rD   rE   r   s   @r'   r~   r~      s#       $. .#  r)   r~   c                   f   a a ] tR tRt oRtV3R lV 3R lltV3R lR ltV3R lR ltR	tVt	V ;t
# )
r   i  zZ
HTMLParser that keeps the first base HREF and a list of all anchor
elements' attributes.
c                $   < V ^8  d   QhRS[ RR/# )r"   r#   r$   Nr6   )r&   r7   s   "r'   r(   HTMLLinkParser.__annotate__  s     : :C :D :r)   c                P   < \         SV `  R R7       Wn        RV n        . V n        R# )T)convert_charrefsN)r;   r<   r#   r   r   )r=   r#   r>   s   &&r'   r<   HTMLLinkParser.__init__  s&    $/'+79r)   c                `   < V ^8  d   QhRS[ RS[S[S[ S[S[ ,          3,          ,          RR/# )r"   tagattrsr$   N)r%   r   r   r   )r&   r7   s   "r'   r(   r     s6     - -3 -tE#x}:L4M/N -SW -r)   c                    VR 8X  d.   V P                   f    V P                  V4      pVe	   W0n         R# R# VR8X  d'   V P                  P                  \	        V4      4       R# R# )baseNa)r   get_hrefr   appenddict)r=   r   r   hrefs   &&& r'   handle_starttagHTMLLinkParser.handle_starttag  sR    &=T]]2=='D $  CZLLU, r)   c                l   < V ^8  d   QhRS[ S[S[S[S[,          3,          ,          RS[S[,          /# )r"   r   r$   )r   r   r%   r   )r&   r7   s   "r'   r(   r   &  s2      d5hsm);#<= (3- r)   c                2    V F  w  r#VR 8X  g   K  Vu # 	  R# )r   NrV   )r=   r   namevalues   &&  r'   r   HTMLLinkParser.get_href&  s     KDv~ ! r)   )r   r   r#   )r@   rA   rB   rC   r   r<   r   r   rD   rE   rF   rG   s   @@r'   r   r     s-     
: :- -  r)   r   c                    V ^8  d   QhR\         R\        \        \        3,          R\        \
        R,          ,          RR/# )r"   r   reasonmethNr$   ).N)r   r   r%   	Exceptionr   r   )r&   s   "r'   r(   r(   -  sI     @ @
@#y.!@ 8I&
'@ 
	@r)   c                 @    Vf   \         P                  pV! RW4       R # )Nz%Could not fetch URL %s: %s - skipping)rl   rm   )r   r   r   s   &&&r'   _handle_get_simple_failr   -  s    
 |||	0$?r)   c                <    V ^8  d   QhR\         R\        R\        /# )r"   rI   r   r$   )r   r   r~   )r&   s   "r'   r(   r(   7  s$     
 

,0

r)   c                     \        V P                  4      p\        V P                  V P                  R ,          VV P                  VR7      # )rK   )r   r#   r   )ry   rN   r~   r   r#   )rI   r   r   s   && r'   _make_index_contentr   7  sE     *(*:*:;H(LL- r)   c                J    V ^8  d   QhR\         R\        R\        R,          /# )r"   r   rX   r$   r~   )r   r   r   )r&   s   "r'   r(   r(   D  s&     : :T :z :h~>V :r)   c                   V P                   P                  R ^4      ^ ,          p\        V4      pV'       d   \        P	                  RVV 4       R# \
        P                  P                  V4      w  rEp  pVR8X  d   \        P                  P                  \
        P                  P                  V4      4      '       dW   VP                  R4      '       g
   VR,          p\
        P                  P                  VR4      p\        P                  RV4        \!        W!R7      p\#        WpP$                  R7      #   \&         d    \        P	                  R	T 4        R# \(         d8   p\        P	                  R
T TP*                  TP,                  4        Rp?R# Rp?i\.         d   p\1        Y4        Rp?R# Rp?i\2         d   p\1        Y4        Rp?R# Rp?i\4         d;   pRp	T	\7        T4      ,          p	\1        Y	\        P8                  R7        Rp?R# Rp?i\:        P<                   d   p\1        T RT 24        Rp?R# Rp?i\:        P>                   d    \1        T R4        R# i ; i)#zICannot look at %s URL %s because it does not support lookup as web pages.Nr   /z
index.htmlz# file: URL is directory, getting %sri   )r   z`Skipping page %s because it looks like an archive, and cannot be checked by a HTTP HEAD request.zSkipping page %s because the %s request got Content-Type: %s. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/htmlz4There was a problem confirming the ssl certificate: )r   zconnection error: z	timed out) r#   splitr0   rl   warningr]   r^   urlparseosrb   isdirrP   url2pathnameendswithurljoinrm   ro   r   r   rU   r2   r5   r4   r   r   r   r   r%   infor   ConnectionErrorTimeout)
r   rX   r#   
vcs_schemer/   _rb   re   excr   s
   &$        r'   _get_index_contentr  D  s   
((..a
 
#C #3'JW	

   &||44S9FtQ1BGGMM&..*E*Ed*KLL ||C  3JC
 ll""35:C@U#C9: #4<S<STT9  
1	
8 /  
A 	
 	
,  " +**   +**   @G#c(6;;??  ## B(:3%&@AA
 	  3k2 	3sx   D7 7!I-I-$I-%,FI-$I-%F66I-I-GI-"I-#/HI-/I-0II-I-,I-c                   ,   a  ] tR tRt o V 3R ltRtV tR# )CollectedSourcesi  c                r   < V ^8  d   Qh/ S[ S[S[,          ,          ;R&   S[ S[S[,          ,          ;R&   # )r"   
find_links
index_urls)r   r   r   )r&   r7   s   "r'   r(   CollectedSources.__annotate__  s/     *-.. *-.. r)   rV   N)r@   rA   rB   rC   r   rD   rE   r   s   @r'   r  r    s      r)   r  c                      a  ] tR tRt o RtV 3R lR lt]RV 3R lR ll4       t]V 3R lR l4       t	V 3R	 lR
 lt
V 3R lR ltRtV tR# )LinkCollectori  z
Responsible for collecting Link objects from all configured locations,
making network requests as needed.

The class's main method is its collect_sources() method.
c                *   < V ^8  d   QhRS[ RS[RR/# )r"   rX   search_scoper$   N)r   r   )r&   r7   s   "r'   r(   LinkCollector.__annotate__  s)       " 
	r)   c                    W n         Wn        R # r:   r  rX   )r=   rX   r  s   &&&r'   r<   LinkCollector.__init__  s    
 )r)   c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r"   rX   optionssuppress_no_indexr$   r  )r   r   r   )r&   r7   s   "r'   r(   r    s3         	
 
r)   c                ^   VP                   .VP                  ,           pVP                  '       d7   V'       g/   \        P	                  RRP                  R V 4       4      4       . pVP                  ;'       g    . p\        P                  ! VVVP                  R7      p\        VVR7      pV# )z
:param session: The Session to use to make requests.
:param suppress_no_index: Whether to ignore the --no-index option
    when constructing the SearchScope object.
zIgnoring indexes: %s,c              3   8   "   T F  p\        V4      x  K  	  R # 5ir:   r   ).0r#   s   & r'   	<genexpr>'LinkCollector.create.<locals>.<genexpr>  s     Ijs-c22js   )r  r	  no_index)rX   r  )
	index_urlextra_index_urlsr  rl   rm   rn   r  r   creater  )clsrX   r  r  r	  r  r  link_collectors   &&&&    r'   r  LinkCollector.create  s     ''(7+C+CC
$5LL&IjII J ''--2
"))!!%%

 '%
 r)   c                0   < V ^8  d   QhRS[ S[,          /# r   )r   r%   )r&   r7   s   "r'   r(   r    s     , ,DI ,r)   c                .    V P                   P                  # r:   )r  r  r   s   &r'   r  LinkCollector.find_links  s      +++r)   c                6   < V ^8  d   QhRS[ RS[S[,          /# )r"   locationr$   )r   r   r~   )r&   r7   s   "r'   r(   r    s$     B Bt B0F Br)   c                .    \        WP                  R7      # )z.
Fetch an HTML page containing package links.
ri   )r  rX   )r=   r'  s   &&r'   fetch_responseLinkCollector.fetch_response  s     "(LLAAr)   c                ,   < V ^8  d   QhRS[ RS[RS[/# )r"   project_namecandidates_from_pager$   )r%   r   r  )r&   r7   s   "r'   r(   r    s)     ,
 ,
,
 1,
 
	,
r)   c                  a aa \         P                  ! VVV 3R  lS P                  P                  S4       4       4      P	                  4       p\         P                  ! VVV 3R lS P
                   4       4      P	                  4       p\        P                  \        P                  4      '       d   \        P                  ! WC4       Uu. uF(  pVf   K	  VP                  f   K  RVP                   2NK*  	  pp\        V4       RS R2.V,           p\        P                  RP                  V4      4       \!        \#        V4      \#        V4      R7      # u upi )c           
   3   n   <"   T F*  p\        VSSP                  P                  R R SR7      x  K,  	  R# 5i)Fr-  page_validator
expand_dirr   r,  Nr    rX   is_secure_originr  locr-  r,  r=   s   & r'   r  0LinkCollector.collect_sources.<locals>.<genexpr>  sD      
4
 P %9#||<< #()  P   25c           
   3   n   <"   T F*  p\        VSSP                  P                  R R SR7      x  K,  	  R# 5i)Tr0  Nr3  r5  s   & r'   r  r7    sB      
5
 ' %9#||<<#')  'r8  z* z' location(s) to search for versions of :
)r  r	  )collectionsOrderedDictr  get_index_urls_locationsvaluesr  rl   isEnabledForloggingDEBUG	itertoolschainr   r.   rm   rn   r  r   )r=   r,  r-  index_url_sourcesfind_links_sourcessliness   fff    r'   collect_sourcesLinkCollector.collect_sources  s8    (33 
4
 ((AA,O
4
 

 &( 	 )44 
5
 
5
 

 &( 	 w}}-- #);OOA %&VV "QVVHO   u:, ##/.3 E LL5)*./-.
 	
s   EE#Er  N)F)r@   rA   rB   rC   r   r<   classmethodr  propertyr  r)  rI  rD   rE   r   s   @r'   r  r    sX         B , ,B B,
 ,
r)   r  r:   )T)Qr   r<  email.messagert   r   rC  r   rA  r   urllib.parser]   urllib.requestdataclassesr   html.parserr   optparser   typingr   r   r   r   r	   r
   r   r   r   r   r   pip._vendorr   pip._vendor.requestsr   pip._vendor.requests.exceptionsr   r   pip._internal.exceptionsr   pip._internal.models.linkr   !pip._internal.models.search_scoper   pip._internal.network.sessionr   pip._internal.network.utilsr   pip._internal.utils.filetypesr   pip._internal.utils.miscr   pip._internal.vcsr   sourcesr   r   r    	getLoggerr@   rl   r%   rq   r0   r   r2   rS   rU   rf   ro   ry   r{   r   r   r   r~   r   r   r   r  r  r  rV   r)   r'   <module>ra     sB         	   ! "     ! ) @ ; * 9 4 8 9 9 ! A A			8	$ c*)Y )@,	y 	$<~	# 	#D D(  8 $. . .(Z 8@
:z/z /
h
 h
r)   