+
    Pj                       a  0 t $ ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHt  ^ RI	t
]'       d'   ^ RIHt ^ RIHtHtHt ^RIHt ]]]3,          tR]R	&    ! R
 R4      tR#   ] d    ]'       g   ^ RI
t
 LOi ; i)    )annotationsN)TYPE_CHECKING)atomic_write)Iterator)AnyLiteral	TypeAlias)CachingFileSystemr	   Detailc                      ] tR t^tRtR R l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 ltR R ltR R ltR R ltRtR# )CacheMetadataa  Cache metadata.

All reading and writing of cache metadata is performed by this class,
accessing the cached files and blocks is not.

Metadata is stored in a single file per storage directory in JSON format.
For backward compatibility. No longer supports pickle.
c                   V ^8  d   QhRR/# )   storagez	list[str] )formats   "~/Users/ahmed/devFolder/Ultron/claude-voice/gateway/.venv/lib/python3.14/site-packages/fsspec/implementations/cache_metadata.py__annotate__CacheMetadata.__annotate__"   s     / /	 /    c                H    V'       g   \        R4      hWn        / .V n        R# )z

Parameters
----------
storage: list[str]
    Directories containing cached files, must be at least one. Metadata
    is stored in the last of these directories by convention.
z3CacheMetadata expects at least one storage locationN)
ValueError_storagecached_files)selfr   s   &&r   __init__CacheMetadata.__init__"   s"     RSS+-$r   c                    V ^8  d   QhRRRR/# )r   fnstrreturnr   r   )r   s   "r   r   r   1   s        r   c                8   \        VR4      ;_uu_ 4       p\        P                  ! V4      pRRR4       XP                  4        F?  p\	        VP                  R4      \        4      '       g   K*  \        VR,          4      VR&   KA  	  V#   + '       g   i     Le; i)z6Low-level function to load metadata from specific filerNblocks)openjsonloadvalues
isinstancegetlistset)r   r   floadedcs   &&   r   _loadCacheMetadata._load1   sg    "c]]aYYq\F A!%%/400!!H+.( !  ]s   B		B	c               $    V ^8  d   QhRRRRRR/# )r   metadata_to_saver   r   r    r!   Noner   )r   s   "r   r   r   :   s!     + +f +# +$ +r   c                    \        VRR7      ;_uu_ 4       p\        P                  ! W4       RRR4       R#   + '       g   i     R# ; i)z4Low-level function to save metadata to specific filew)modeN)r   r&   dump)r   r3   r   r-   s   &&& r   _saveCacheMetadata._save:   s-    "3''1II&* ('''s	   7A	c                    V ^8  d   QhRRRR/# )r   writable_onlyboolr!   zIterator[tuple[str, str, bool]]r   )r   s   "r   r   r   ?   s      D D!D	(Dr   c              #     "   \        V P                  4      p\        V P                  4       FF  w  r4W2^,
          8H  pV'       d   V'       g   K"  \        P                  P                  VR4      WE3x  KH  	  R# 5i)zYield locations (filenames) where metadata is stored, and whether
writable or not.

Parameters
----------
writable: bool
    Set to True to only yield writable locations.

Returns
-------
Yields (str, str, bool)
cacheN)lenr   	enumerateospathjoin)r   r<   nir   writables   &&    r   _scan_locationsCacheMetadata._scan_locations?   sW      #DMM2JAEzHX'',,w0'CC	 3s   A
A9,A9c               $    V ^8  d   QhRRRRRR/# )r   rC   r    cfszCachingFileSystem | Noner!   z#Literal[False] | tuple[Detail, str]r   )r   s   "r   r   r   U   s$      6	,r   c                L   \        V P                  4       V P                  4       F  w  w  r4rVW9  d   K  Wa,          P                  4       pVe   VP                  '       d*   VR,          VP
                  P                  V4      8w  d   Ke  VP                  '       d5   \        P                  ! 4       VR,          ,
          VP                  8  d   K  \        P                  P                  WGR,          4      p\        P                  P                  V4      '       g   K  Ws3u # 	  R# )zIf path is in cache return its details, otherwise return ``False``.

If the optional CachingFileSystem is specified then it is used to
perform extra checks to reject possible matches, such as if they are
too old.
uidtimer   F)ziprH   r   copycheck_filesfsukeyexpiryrN   rB   rC   rD   exists)r   rC   rK   r   base_r?   details   &&&     r   
check_fileCacheMetadata.check_fileU   s     %((<(<(>@Q@Q$R MRq [%%'F???ve}D8I'I:::$))+v">"Kd4L1Bww~~b!!z! %S  r   c                    V ^8  d   QhRRRR/# )r   expiry_timeintr!   ztuple[list[str], bool]r   )r   s   "r   r   r   p   s     3 3 31G 3r   c                   . pV P                   R,          P                  4       P                  4        F  w  r4\        P                  ! 4       VR,          ,
          V8  g   K/  VP	                  RR4      pV'       g   \        RV 24      h\        P                  P                  V P                  R,          V4      pVP                  V4       V P                   R,          P                  V4       K  	  V P                   R,          '       dU   \        P                  P                  V P                  R,          R4      pV P                  V P                   R,          V4       V P                   R,          '       * pW'3# )zRemove expired metadata from the cache.

Returns names of files corresponding to expired metadata and a boolean
flag indicating whether the writable cache is empty. Caller is
responsible for deleting the expired files.
rN   r    z)Cache metadata does not contain 'fn' for r?   )r   rP   itemsrN   r*   RuntimeErrorrB   rC   rD   r   appendpopr9   )r   r\   expired_filesrC   rX   r   
cache_pathwritable_cache_emptys   &&      r   clear_expiredCacheMetadata.clear_expiredp   s      --b1668>>@LDyy{VF^+k9ZZb)&CD6J  WW\\$--"3R8$$R(!!"%))$/ A R  dmmB&7AJJJt((,j9#'#4#4R#8822r   c                   V ^8  d   QhRR/# r   r!   r4   r   )r   s   "r   r   r      s     	1 	1d 	1r   c                   . pV P                  4        F_  w  p p\        P                  P                  V4      '       d#   VP	                  V P                  V4      4       KN  VP	                  / 4       Ka  	  T;'       g    / .V n        R# )z>Load all metadata from disk and store in ``self.cached_files``N)rH   rB   rC   rU   rc   r0   r   )r   r   r   rW   s   &   r   r'   CacheMetadata.load   sk    ,,.HB1ww~~b!!##DJJrN3##B' / )00RDr   c               $    V ^8  d   QhRRRRRR/# )r   r-   r   rC   r    r!   r4   r   )r   s   "r   r   r      s!      c   r   c                    V P                   R,          V,          pVR,          RJd<   \        VR,          4      VP                  ,          VP                  8  d   RVR&   R# R# R# )z{Perform side-effect actions on closing a cached file.

The actual closing of the file is the responsibility of the caller.
r$   TNr`   )r   r@   	blocksizesize)r   r-   rC   r/   s   &&& r   on_close_cached_file"CacheMetadata.on_close_cached_file   sT     b!$'X;d"s1X;'7!++'E'OAhK (P"r   c                    V ^8  d   QhRRRR/# )r   rC   r    r!   z
str | Noner   )r   s   "r   r   r      s      S Z r   c                   V P                  VR4      pV'       g   R# Vw  r4VP                  V P                  R,          4      '       d5   V P                  R,          P	                  V4       V P                  4        V# \        R4      h)zRemove metadata of cached file.

If path is in the cache, return the filename of the cached file,
otherwise return ``None``.  Caller is responsible for deleting the
cached file.
Nz<Can only delete cached file in last, writable cache locationr`   )rY   
startswithr   r   rd   savePermissionError)r   rC   detailsrW   r   s   &&   r   pop_fileCacheMetadata.pop_file   st     //$-==r*++b!%%d+IIK
 	 "N r   c                   V ^8  d   QhRR/# rk   r   )r   s   "r   r   r      s     "1 "1d "1r   c                   \        V P                  4       V P                  4       EF  w  w  rr4V'       g   K  \        P                  P                  V4      '       d   V P                  V4      pVP                  4        F  w  rgWd9   g   K  VR,          RJ g   WF,          R,          RJ d   RVR&   M+WF,          R,          pVP                  VR,          4       WR&   \        VR,          WF,          R,          4      VR&   WF,          R,          VR&   K  	  VP                  4        F  w  rgWe9  g   K  WuV&   K  	  MTpVP                  4        UU	u/ uF  w  riWiP                  4       bK  	  ppp	VP                  4        F7  p\        VR,          \        4      '       g   K"  \        VR,          4      VR&   K9  	  V P                  WA4       WPP                  R&   EK  	  R# u up	pi )zSave metadata to diskr$   TrN   rM   Nr`   )rO   rH   r   rB   rC   rU   r0   ra   updatemaxrP   r(   r)   r,   r+   r9   )
r   r   rW   rG   r?   r   kr/   r$   vs
   &         r   rw   CacheMetadata.save   s   (+D,@,@,BDDUDU(V$RHww~~b!!#zz"~(..0DAzX;$.%(82D2L*.AhK &+Xh%7F"MM!H+6*0hK$'&	58F3C$D&	#(8E?% 1  "KKMDA,*+Q *  %-9-?-?-AB-ATQQ[-AEB\\^ak3//"&q{"3AhK $ JJu!$0b!A )W6 Cs   Gc               $    V ^8  d   QhRRRRRR/# )r   rC   r    rX   r   r!   r4   r   )r   s   "r   r   r      s!     - - -V - -r   c                0    W P                   R,          V&   R# )z8Update metadata for specific file in memory, do not saveNr`   )r   )r   rC   rX   s   &&&r   update_fileCacheMetadata.update_file   s    &,"d#r   )r   r   N)F)__name__
__module____qualname____firstlineno____doc__r   r0   r9   rH   rY   rh   r'   rr   rz   rw   r   __static_attributes__r   r   r   r   r      sE    /+
D,634	1("1H- -r   r   )__conditional_annotations__
__future__r   rB   rN   typingr   fsspec.utilsr   ujsonr&   ImportErrorcollections.abcr   r   r   r	   cachedr
   dictr    r   __annotations__r   )r   s   @r   <module>r      sg    " " 	    %
 (..)S#XFI&A- A-  s   A A4-A43A4