+
    <jF+                        R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHt ^ RI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H t H!t! ^ RI"H#t#H$t$H%t% ]PL                  ! ]'4      t(R R lt)R R lt*R R R llt+R R lt,R R lt-R R lt.R!R R llt/ ! R R4      t0 ! R R4      t1R# )"z(Download files with progress indicators.N)
HTTPStatus)BinaryIOIterableOptionalTuple)Response)ReadTimeoutError)get_download_progress_renderer)IncompleteDownloadErrorNetworkConnectionError)PyPI)Link)is_from_cache)
PipSession)HEADERSraise_for_statusresponse_chunks)format_sizeredact_auth_from_urlsplitextc                F    V ^8  d   QhR\         R\        \        ,          /#    respreturn)r   r   int)formats   "S/opt/headortail/venv/lib/python3.14/site-packages/pip/_internal/network/download.py__annotate__r      s      ( x}     c                 v     \        V P                  R ,          4      #   \        \        \        3 d     R# i ; i)zcontent-lengthN)r   headers
ValueErrorKeyError	TypeErrorr   s   &r   _get_http_response_sizer&      s5    4<< 0122), s    88c                F    V ^8  d   QhR\         R\        \        ,          /# r   )r   r   str)r   s   "r   r   r       s"     G G8 G Gr   c                l    V P                   P                  RV P                   P                  R4      4      # )z
Return either the ETag or Last-Modified header (or None if neither exists).
The return value can be used in an If-Range header.
etagzlast-modified)r!   getr%   s   &r   (_get_http_response_etag_or_last_modifiedr,       s*    
 <<FDLL$4$4_$EFFr   c                    V ^8  d   QhR\         R\        R\        R\        \        ,          R\        \        ,          R\
        \        ,          /# )r   r   linkprogress_bartotal_lengthrange_startr   )r   r   r(   r   r   r   bytes)r   s   "r   r   r   (   sP     0 0
0
0 0 3-	0
 #0 e_0r   c                    VP                   \        P                  8X  d   VP                  pMVP                  p\        V4      pV'       d8   V'       d   V R \        V4       R\        V4       R2pMV R \        V4       R2p\        V 4      '       d   \        P                  RV4       M5V'       d   \        P                  RV4       M\        P                  RV4       \        P                  4       \        P                  8  d   RpM+\        V 4      '       d   RpMV'       g   RpMVR	8  d   RpMRp\        V 4      pV'       g   V# \        W#VR7      p	V	! V4      # )
z (/)zUsing cached %szResuming download %szDownloading %sFT)bar_typesizeinitial_progressi   )netlocr   file_storage_domainshow_urlurl_without_fragmentr   r   r   loggerinfogetEffectiveLevelloggingINFOr   r	   )
r   r.   r/   r0   r1   url
logged_urlshow_progresschunksrenderers
   &&&&&     r   _prepare_downloadrG   (   s)    {{d...mm''%c*J,b[!9 :!K<U;VVWX  '<r+l*C)DAFJT%z2	*J7$j1!GLL0	t				$T"F-;H Fr   c                0    V ^8  d   QhR\         R\         /# )r   filenamer   r(   )r   s   "r   r   r   [   s     & & & &r   c                @    \         P                  P                  V 4      # )zB
Sanitize the "filename" value from a Content-Disposition header.
)ospathbasename)rI   s   &r   sanitize_content_filenamerO   [   s     77H%%r   c                <    V ^8  d   QhR\         R\         R\         /# )r   content_dispositiondefault_filenamer   rJ   )r   s   "r   r   r   b   s"     ( (3 (# (RU (r   c                    \         P                  P                  4       pWR&   VP                  R4      pV'       d   \	        \        V4      4      pT;'       g    T# )zw
Parse the "filename" value from a Content-Disposition header, and
return the default filename if the result is empty.
content-typerI   )emailmessageMessage	get_paramrO   r(   )rQ   rR   mrI   s   &&  r   parse_content_dispositionrZ   b   sN    
 	A+n{{:&H -S];''''r   c                <    V ^8  d   QhR\         R\        R\        /# )r   r   r.   r   )r   r   r(   )r   s   "r   r   r   q   s!      h d s r   c                   VP                   pV P                  P                  R4      pV'       d   \        W24      p\	        V4      ^,          pV'       gA   \
        P                  ! V P                  P                  RR4      4      pV'       d	   W$,          pV'       g\   VP                  V P                  8w  dA   \        P                  P	                  V P                  4      ^,          pV'       d	   W$,          pV# )zgGet an ideal filename from the given HTTP response, falling back to
the link filename if not provided.
zcontent-dispositionrT    )
rI   r!   r+   rZ   r   	mimetypesguess_extensionrB   rL   rM   )r   r.   rI   rQ   exts   &&   r   _get_http_response_filenamera   q   s     }}H,,**+@A,-@K!(+A.C''(8(8(LMOH488txx'ggtxx(+OHOr   c          
          V ^8  d   QhR\         R\        R\        \        ,          R\        \        ,          R\
        /# )r   sessionr.   r1   if_ranger   )r   r   r   r   r(   r   )r   s   "r   r   r      sB      
 # sm	
 r   c                    VP                   P                  R ^4      ^ ,          p\        P                  ! 4       pV'       d
   RV R2VR&   V'       d   W5R&    V P	                  WERR7      p\        V4       V#   \         dB   pTP                  f   Q h\        P                  RTP                  P                  T4       h Rp?ii ; i)	#zbytes=-RangezIf-RangeT)r!   streamNzHTTP error %s while getting %s)rB   splitr   copyr+   r   r   responser=   criticalstatus_code)rc   r.   r1   rd   
target_urlr!   r   es   &&&&    r   _http_get_downloadrq      s     Q'*JllnG#K=2&
{{:t{D
 K	 " zz%%%8!**:P:PRVWs   A7 7C<B>>Cc                      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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# )
Downloaderc                0   < V ^8  d   QhRS[ RS[RS[RR/# r   rc   r/   resume_retriesr   Nr   r(   r   )r   __classdict__s   "r   r   Downloader.__annotate__   s3     . .. . 	.
 
.r   c                F    V^ 8  g   Q R4       hWn         W n        W0n        R# )    z<Number of max resume retries must be bigger or equal to zeroN)_session_progress_bar_resume_retriesselfrc   r/   rv   s   &&&&r   __init__Downloader.__init__   s/     a	JI	J)-r   c                B   < V ^8  d   QhRS[ RS[RS[S[S[3,          /# )r   r.   locationr   )r   r(   r   )r   rx   s   "r   r   ry      s*     & &T &S &U38_ &r   c           	        \        V P                  V4      p\        V4      pVP                  P	                  RR4      p\        W14      p\        P                  P                  W&4      p\        VR4      ;_uu_ 4       pV P                  W1V^ V4      p	V'       d   W8  d   V P                  W1WV	4       RRR4       Wu3#   + '       g   i     Yu3# ; i)z.Download the file given by link into location.zContent-Typer]   wbN)rq   r|   r&   r!   r+   ra   rL   rM   joinopen_process_response_attempt_resume)
r   r.   r   r   r0   content_typerI   filepathcontent_filebytes_receiveds
   &&&       r   __call__Downloader.__call__   s    !$--6 /t4||'';.t:77<<3(D!!\!33L!\N  =$$N " %% "! %%s   <6B==C	c                N   < V ^8  d   QhRS[ RS[RS[RS[RS[S[,          RS[/# )r   r   r.   r   r   r0   r   )r   r   r   r   r   )r   rx   s   "r   r   ry      sK     
 

 
 	

 
 sm
 

r   c                j    \        WV P                  WTR7      pV P                  Wc\        V4      R7      # )z6Process the response and write the chunks to the file.)r1   )allow_partial)rG   r}   _write_chunks_to_filebool)r   r   r.   r   r   r0   rE   s   &&&&&& r   r   Downloader._process_response   s?     #**L
 ))\0B * 
 	
r   c                B   < V ^8  d   QhRS[ S[,          RS[RS[RS[/# )r   rE   r   r   r   )r   r2   r   r   r   )r   rx   s   "r   r   ry      s1      uo5=QU	r   c                   ^ p V F&  pV\        V4      ,          pVP                  V4       K(  	  V#   \         d+   pT'       g   Th\        P	                  R4        Rp?T# Rp?ii ; i)zEWrite the chunks to the file and return the number of bytes received.z'Connection timed out while downloading.N)lenwriter   r=   warning)r   rE   r   r   r   chunkrp   s   &&&$   r   r    Downloader._write_chunks_to_file   sq     
	F#e*,""5)      	F  NNDEE	Fs   ,2 A'A""A'c                L   < V ^8  d   QhRS[ RS[RS[RS[S[,          RS[RR/# )r   r   r.   r   r0   r   r   N)r   r   r   r   r   )r   rx   s   "r   r   ry      sK     3 33 3 	3
 sm3 3 
3r   c                   \        V4      pV P                  pV'       d   V'       d   WT8  d   V^,          p\        P                  R\	        V4      \	        V4      V P                  V,
          4        \        V P                  VVVR7      pVP                  \        P                  8g  p	V	'       d   V P                  W4      w  rTpWPP                  WW5V4      ,          pK  V'       d@   WT8  d8   \        P                   ! VP"                  4       \%        W%W@P                  R7      hR# R#   \        \        \        3 d     EK+  i ; i)z9Attempt to resume the download if connection was dropped.z<Attempting to resume incomplete download (%s/%s, attempt %d))r1   rd   )retriesN)r,   r~   r=   r   r   rq   r|   rn   r   PARTIAL_CONTENT_reset_download_stater   ConnectionErrorr   OSErrorrL   removenamer
   )
r   r   r.   r   r0   r   etag_or_last_modifiedattempts_leftresume_respmust_restarts
   &&&&&&    r   r   Downloader._attempt_resume   s$    !I N,,}1NQMNNNN+L)%%5	0MM .2	  +66*:T:TT22;M HN2G "8"8|\#  N9IIl''()l<P<P  :<	 $%5w? s   3A+D) )EEc          
      f   < V ^8  d   QhRS[ RS[RS[S[S[S[,          S[S[,          3,          /# )r   r   r   r   )r   r   r   r   r   r(   )r   rx   s   "r   r   ry     sB     C CC C 
sHSM8C=0	1	Cr   c                |    VP                  ^ 4       VP                  4        ^ p\        V4      p\        V4      pW4V3# )zCReset the download state to restart downloading from the beginning.)seektruncater&   r,   )r   r   r   r   r0   r   s   &&&   r   r    Downloader._reset_download_state  sD     	!.t4 H N-BBBr   )r}   r~   r|   N)__name__
__module____qualname____firstlineno__r   r   r   r   r   r   __static_attributes____classdictcell__rx   s   @r   rs   rs      sD     . .& &0
 
  &3 3jC Cr   rs   c                   D   a  ] tR tRt o V 3R lR ltV 3R lR ltRtV tR# )BatchDownloaderi+  c                0   < V ^8  d   QhRS[ RS[RS[RR/# ru   rw   )r   rx   s   "r   r   BatchDownloader.__annotate__,  s9     M MM M 	M
 
Mr   c                (    \        WV4      V n        R # )N)rs   _downloaderr   s   &&&&r   r   BatchDownloader.__init__,  s     &g^Lr   c                x   < V ^8  d   QhRS[ S[,          RS[RS[ S[S[S[S[S[3,          3,          ,          /# )r   linksr   r   )r   r   r(   r   )r   rx   s   "r   r   r   4  s@     1 1d^1/21	%eCHo-.	/1r   c              #  T   "   V F  pV P                  W24      w  rEW4V33x  K  	  R# 5i)z0Download the files given by links into location.Nr   )r   r   r   r.   r   r   s   &&&   r   r   BatchDownloader.__call__4  s2      D%)%5%5d%E"H<000 s   &(r   N)r   r   r   r   r   r   r   r   r   s   @r   r   r   +  s     M M1 1r   r   )r{   )r{   N)2__doc__email.messagerU   r@   r^   rL   httpr   typingr   r   r   r   pip._vendor.requests.modelsr   pip._vendor.urllib3.exceptionsr   pip._internal.cli.progress_barsr	   pip._internal.exceptionsr
   r   pip._internal.models.indexr   pip._internal.models.linkr   pip._internal.network.cacher   pip._internal.network.sessionr   pip._internal.network.utilsr   r   r   pip._internal.utils.miscr   r   r   	getLoggerr   r=   r&   r,   rG   rO   rZ   ra   rq   rs   r    r   r   <module>r      s    .    	  6 6 0 ; J T + * 5 4 R R P P			8	$G0f&(*0JC JCZ1 1r   