f :ddlZddlmZddlmZGddeZy)N)MutableMapping) lru_cachecNeZdZdZ d dZdZdZdZdZdZ d Z d Z d Z y) DirCachea 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 i_i_|rt|dzfd_|_|_|_y)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<jj|dSN)_cachepop)keyselfs X/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/fsspec/dircache.pyz#DirCache.__init__..3s4;;??3PT;UN)r _timesr_quse_listings_cachelistings_expiry_time max_paths)rrrrkwargss` r__init__zDirCache.__init__sE*  .i A ./UVDG"4$8!"rc |jL|jj|dtjz |j kr |j|=|j r|j ||j|S)Nr)rrgettimer rrritems r __getitem__zDirCache.__getitem__8sf  $ $ 0{{tQ'$))+59R9R8RRKK% >> GGDM{{4  rc8|jjyr )r clearrs rr zDirCache.clear@s rc,t|jSr )lenr r!s r__len__zDirCache.__len__Cs4;;rc. ||y#t$rYywxYw)NTF)KeyErrorrs r __contains__zDirCache.__contains__Fs#  J  s  c|jsy|jr|j|||j|<|j"t j |j |<yyr )rrrr rrr)rr values r __setitem__zDirCache.__setitem__MsS&&  >> GGCL  C  $ $ 0#yy{DKK  1rc|j|=yr )r )rr s r __delitem__zDirCache.__delitem__Vs KK rcDtj}fd|DS)Nc3,K|] }|vs| ywr ).0krs r z$DirCache.__iter__..\s0aa4i0s )listr )rentriess` r__iter__zDirCache.__iter__Yst{{#0700rcTt|j|j|jffSr )rrrrr!s r __reduce__zDirCache.__reduce__^s)   $ $d&?&? P  r)TNN) __name__ __module__ __qualname____doc__rrr r$r'r*r,r5r7r/rrrrs?, ! #:! +1  rr)rcollections.abcr functoolsrrr/rrr>s *\ ~\ r