
    7Th
                     :    S SK r S SKJr  S SKJr   " S S\5      rg)    N)MutableMapping)	lru_cachec                   X    \ rS rSrSr   SS jrS rS rS rS r	S	 r
S
 rS rS rSrg)DirCache   aV  
Caching of directory listings, in a structure like::

    {"path0": [
        {"name": "path0/file0",
         "size": 123,
         "type": "file",
         ...
        },
        {"name": "path0/file1",
        },
        ...
        ],
     "path1": [...]
    }

Parameters to this class control listing expiry or indeed turn
caching off
Nc                    ^  0 T l         0 T l        U(       a  [        US-   5      " U 4S j5      T l        UT l        UT l        UT l        g)a  

Parameters
----------
use_listings_cache: bool
    If False, this cache never returns items, but always reports KeyError,
    and setting items has no effect
listings_expiry_time: int or float (optional)
    Time in seconds that a listing is considered valid. If None,
    listings do not expire.
max_paths: int (optional)
    The number of most recent listings that are considered valid; 'recent'
    refers to when the entry was set.
   c                 <   > TR                   R                  U S 5      $ N)_cachepop)keyselfs    G/var/www/auris/envauris/lib/python3.13/site-packages/fsspec/dircache.py<lambda>#DirCache.__init__.<locals>.<lambda>3   s    4;;??3PT;U    N)r   _timesr   _quse_listings_cachelistings_expiry_time	max_paths)r   r   r   r   kwargss   `    r   __init__DirCache.__init__   sC    * 	A./UVDG"4$8!"r   c                    U R                   bN  U R                  R                  US5      [        R                  " 5       -
  U R                   * :  a  U R                  U	 U R
                  (       a  U R                  U5        U R                  U   $ )Nr   )r   r   gettimer   r   r   r   items     r   __getitem__DirCache.__getitem__8   sf    $$0{{tQ'$))+59R9R8RRKK%>>GGDM{{4  r   c                 8    U R                   R                  5         g r   )r   clearr   s    r   r$   DirCache.clear@   s    r   c                 ,    [        U R                  5      $ r   )lenr   r%   s    r   __len__DirCache.__len__C   s    4;;r   c                 .     X     g! [          a     gf = f)NTF)KeyErrorr   s     r   __contains__DirCache.__contains__F   s!    	J 		s    
c                     U R                   (       d  g U R                  (       a  U R                  U5        X R                  U'   U R                  b#  [
        R
                  " 5       U R                  U'   g g r   )r   r   r   r   r   r   r   )r   r   values      r   __setitem__DirCache.__setitem__M   sQ    &&>>GGCL C$$0#yy{DKK 1r   c                     U R                   U	 g r   )r   )r   r   s     r   __delitem__DirCache.__delitem__V   s    KKr   c                 F   ^  [        T R                  5      nU 4S jU 5       $ )Nc              3   6   >#    U  H  oT;   d  M
  Uv   M     g 7fr    ).0kr   s     r   	<genexpr>$DirCache.__iter__.<locals>.<genexpr>\   s     07a4i7s   		)listr   )r   entriess   ` r   __iter__DirCache.__iter__Y   s    t{{#0700r   c                 T    [         U R                  U R                  U R                  44$ r   )r   r   r   r   r%   s    r   
__reduce__DirCache.__reduce__^   s)    $$d&?&?P
 	
r   )r   r   r   r   r   r   )TNN)__name__
__module____qualname____firstlineno____doc__r   r!   r$   r)   r-   r1   r4   r?   rB   __static_attributes__r8   r   r   r   r      s?    ,  !	#:! +1

r   r   )r   collections.abcr   	functoolsr   r   r8   r   r   <module>rL      s     * \
~ \
r   