
    ͆h	                        S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SK	J
r
  S SKrSSKJr  \R                  " S\ 35      rSS jr\SS	.         SS
 jjrg)    )annotationsN)Callable   )__version__zmkdocs.c                    [         R                  R                  U SS[         30S9n[         R                  R	                  U5       nUR                  5       sS S S 5        $ ! , (       d  f       g = f)Nz
User-Agentzmkdocs-get-deps/)headers)urllibrequestRequestr   urlopenread)urlreqresps      M/opt/services/DDDS/venv/lib/python3.13/site-packages/mkdocs_get_deps/cache.py_download_urlr      sR    
..
 
 |?OP[}=].^
 
_C				$yy{ 
%	$	$s   A!!
A/s   # )downloadcommentc                  [         R                  R                  [        R                  " S5      S5      n[
        R                  " U R                  5       5      R                  5       SS n[         R                  R                  XE[         R                  R                  U 5      S   -   5      n[        [        R                  R                  [        R                  R                  5      R                  5       5      nSX0R                  5       4-  n[         R                  R!                  U5      (       a   [#        US5       n	U	R%                  5       n
U
R'                  U5      (       ah  U
[)        U5      S n
[        U
5      n[        R*                  " X{-
  S9U::  a5  [,        R/                  S	U S
U  S35        U	R1                  5       sSSS5        $ SSS5        [,        R/                  SU  SU S35        U" U 5      n[         R:                  " USS9  U S[<        R>                  " S5      S S3n[#        US5       n	U	RA                  SX4-  5        U	RA                  U5        SSS5        [         RB                  " X5        U$ ! , (       d  f       N= f! [2        [4        4 a7  n[,        R/                  [7        U5      R8                   SU 35         SnANSnAff = f! , (       d  f       N= f)a  Downloads a file from the URL, stores it under ~/.cache/, and returns its content.

For tracking the age of the content, a prefix is inserted into the stored file, rather than relying on mtime.

Args:
    url: URL to use.
    download: Callback that will accept the URL and actually perform the download.
    cache_duration: How long to consider the URL content cached.
    comment: The appropriate comment prefix for this file format.
mkdocsmkdocs_url_cacheN    r   s   %s%s downloaded at timestamp rb)secondszUsing cached 'z' for ''z: zDownloading 'z' to 'T)exist_ok.l        08xz.partwbs   %s%d
)"ospathjoinplatformdirsuser_cache_dirhashlibsha256encode	hexdigestsplitextintdatetimenowtimezoneutc	timestampisfileopenreadline
startswithlen	timedeltalogdebugr   OSError
ValueErrortype__name__makedirsrandom	randrangewritereplace)r   cache_durationr   r   	directory	name_hashr!   r,   prefixfliner/   econtenttemp_filenames                  r   download_and_cache_urlrJ      s5   " \88BDVWIszz|,668"=I77<<	rww/?/?/DQ/G#GHD
h##H$5$5$9$9:DDF
GC-**,0GGF	ww~~d
	2dD!Qzz|??6**F.D #D	I))3?DV		N4&uA"FG vvx "!! IIcU&a01smGKK	D)fAf..w7<EBM	mT	"a		VM)*	 
# JJ}#N) "! $ 	2IIa))*"QC011	2 
#	"sI   3J ?BI?	J J 8'K?
J	J J K -KK
K()r   strreturnbytes)
r   rK   rA   zdatetime.timedeltar   zCallable[[str], bytes]r   rM   rL   rM   )
__future__r   r+   r%   loggingr    r=   urllib.requestr	   typingr   r#    r   	getLoggerr;   r6   r   rJ        r   <module>rV      sz    "    	     '(,- (5.	.&. %	.
 . .rU   