
    si3                       S r SSKJ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  S
SKJrJrJrJrJrJrJrJrJr  SSKJr  \(       a  S
SKJr  \R2                  " \5      r " S S\5      r " S S\5      r " S S\5      rg)zJLAP interface for repodata.    )annotationsN)TYPE_CHECKING   )context   )disable_ssl_verify_warning)get_session   )	CACHE_CONTROL_KEYETAG_KEYLAST_MODIFIED_KEYURL_KEYRepodataOnDiskRepodataStateRepoInterfaceResponse304ContentUnchangedconda_http_errors   )fetch)RepodataCachec                  L    \ rS rSr        SS jrS	S jrS
S jrSS jrSrg)JlapRepoInterface!   c                   [         R                  SU R                  R                  5        X0l        Xl        X l        [        R                  " [        5      U l	        [        R                  " S5      U l
        g )NzUsing %szconda.stderrlog)logdebug	__class____name___cache_url_repodata_fnlogging	getLogger_log
_stderrlog)selfurlrepodata_fncachekwargss        Flib/python3.13/site-packages/conda/gateways/repodata/jlap/interface.py__init__JlapRepoInterface.__init__"   sQ     			*dnn556	'%%h/	!++,=>    c                8    U R                  U5        [        5       e)zL
Fetch newest repodata if necessary.

Always writes to ``cache_path_json``.
)repodata_parsedr   r&   states     r+   repodataJlapRepoInterface.repodata4   s     	U#r.   c           	        [        U R                  5      n[        R                  (       d
  [	        5         U R                   SU R
                   3nU R                  U5      nU R                  R                  U R                  R                   S[        R                  " S5      R                  5        S3-  n [        U R                  U R
                  5         [        R                  " UUUU R                  US9nUR!                  U5        U R                  U["        '   UR%                  S0 5      R%                  S5      nU(       aH  UR%                  S5      U[&        '   UR%                  S	5      U[(        '   UR%                  S
5      U[*        '   U R                  R,                  R!                  U5        SSS5        UR/                  5       (       a  U R                  R1                  U5         UR7                  5         Wc
  [;        5       eU$ ! , (       d  f       N^= f! [        R2                   a    [5        5       ef = f! [8         a     NNf = f!  UR7                  5         f ! [8         a     f f = f= f)z
JLAP has to parse the JSON anyway.

Use this to avoid a redundant parse when repodata is updated.

When repodata is not updated, it doesn't matter whether this function or
the caller reads from a file.
/.r
   z.tmp)sessionr)   	temp_pathjlapheadersetagzlast-modifiedzcache-controlN)r	   r    r   
ssl_verifyr   r!   _repodata_state_copyr   	cache_dirnameosurandomhexr   r   request_url_jlap_stateupdater   getr   r   r   r2   existsreplaceJlap304NotModifiedr   unlinkOSErrorr   )r&   r2   r8   repodata_urlstate_r9   repodata_json_or_noner;   s           r+   r0   !JlapRepoInterface.repodata_parsed=   s    dii(!!&())Ad&7&7%89 **51
 KK!!t{{'7'7&8"**Q-:K:K:M9Nd$SS 	$	"499d.?.?@(-(D(D #++')% V$!%g))FB/33 &-kk&&9E(O/6{{?/KE+,/6{{?/KE+,!!((// A2 !!##I.  " !( ""((S A@6 '' 	0-//	0    " sg   7 H CH38H ,H> 
HH H;;I >
I
II1I! I1!
I.+I1-I..I1c                    [        US9$ )N)dict)r   r1   s     r+   r>   &JlapRepoInterface._repodata_state_copy   s    %((r.   )r   r$   r!   r%   r    N)r'   strr(   
str | Noner)   r   returnNone)r2   dict | RepodataStaterU   rT   )r2   rW   rU   zdict | Noner2   rW   )	r   
__module____qualname____firstlineno__r,   r3   r0   r>   __static_attributes__ r.   r+   r   r   !   s>    ??  ?
 ? 
?$B)H)r.   r   c                  R   ^  \ rS rSr% S\S'   \" 5       S.U 4S jjrU 4S jrSrU =r	$ )RepodataStateSkipFormat   zset[str]skip_formats)ra   c               F   > [         TU ]  " U0 UD6  [        U5      U l        g )N)superr,   setra   )r&   ra   argsr*   r   s       r+   r,    RepodataStateSkipFormat.__init__   s"    $)&)-r.   c                B   > XR                   ;   a  g[        TU ]	  U5      $ )NF)ra   rc   should_check_format)r&   formatr   s     r+   rh   +RepodataStateSkipFormat.should_check_format   s"    &&&w*622r.   )
r   rY   rZ   r[   __annotations__rd   r,   rh   r\   __classcell__)r   s   @r+   r_   r_      s"    +.5 . .3 3r.   r_   c                  "    \ rS rSrSrSS jrSrg)ZstdRepoInterface   zA
Support repodata.json.zst (if available) without checking .jlap
c                    [        US/S9$ )Nr:   )rQ   ra   )r_   r1   s     r+   r>   &ZstdRepoInterface._repodata_state_copy   s    &EIIr.   r]   NrX   )r   rY   rZ   r[   __doc__r>   r\   r]   r.   r+   rn   rn      s    Jr.   rn   )rr   
__future__r   r"   rA   typingr   base.contextr   connection.downloadr   connection.sessionr	    r   r   r   r   r   r   r   r   r   r   r   r#   r   r   r   r_   rn   r]   r.   r+   <module>ry      ss    # "  	   $ = -
 
 
  !a) a)H
3m 
3J) Jr.   