CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
cached.cpython-310.pyc347 linesDownload Raw Back to __pycache__
1o

2��Yi@��@shddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl3mZddlm
Z
mZmZddlmZddlmZddlmZdd	lmZmZdd4lmZddlmZddlmZdd
lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(e
r�ddlm)Z)e�*d�Z+Gdd�de&�Z,Gdd�de �Z-Gdd�de-�Z.Gdd�de.�Z/Gdd�d�Z0dS)�)�annotationsN)�Callable)�rmtree)�
TYPE_CHECKING�Any�ClassVar)�5filesystem)�DEFAULT_CALLBACK)�compr)�	BaseCache�	MMapCache)�BlocksizeMismatchError)�create_cache_mapper)�
CacheMetadata)�ChainedFileSystem)�LocalFileSystem)�AbstractBufferedFile)�Transaction)�infer_compression)�AbstractCacheMapperz
fsspec.cachedc@seZdZddd�ZdS)�WriteCachedTransactionTcCsVdd�|jD�}dd�|jD�}|r|j�||�|j��d|j_d|j_d|_dS)NcS�g|]}|j�qS���path��.0�frr��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\fsspec/implementations/cached.py�6<listcomp>"�z3WriteCachedTransaction.complete.<locals>.<listcomp>cSrr��fnrrrrr#r F)�files�fs�put�clear�_intransZ_transaction)�self�commit�rpaths�lpathsrrr�complete!s78zWriteCachedTransaction.completeN�T)�__name__�9__module__�__qualname__r,rrrrr srcs�eZdZUdZdZded<dZ						10					d<d=�fdd�
Zedd��Z	dd�Z11dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd>d!d"�Zd#d$�Z	%		&	d?d'd(�Zd)d*�Zd@d0d1�Zd2d3�ZdAd4d5�Z�fd6d7�Zd8d9�Zd:d;�Z�ZS)B�CachingFileSystemaSLocally caching filesystem, layer over any other FS12 13    This class implements chunk-wise local storage of remote files, for quick14    access after the initial download. The files are stored in a given15    directory with hashes of URLs for the filenames. If no directory is given,16    a temporary one is used, which should be cleaned up by the OS after the17    process ends. The files themselves are sparse (as implemented in18    :class:`~fsspec.caching.MMapCache`), so only the data which is accessed19    takes up space.20 21    Restrictions:22 23    - the block-size must be the same for each access of a given file, unless24      all blocks of the file have already been read25    - caching can only be applied to file-systems which produce files26      derived from fsspec.spec.AbstractBufferedFile ; LocalFileSystem is also27      allowed, for testing28    )Z29blockcache�cachedzClassVar[str | tuple[str, ...]]�protocol)�foN�TMP�30F�:	�31same_names�bool | None�cache_mapper�AbstractCacheMapper | Nonecstt�jd
i|��|dur|durtd��|du|duAs!td��|dkr5t��}|g}
t���j|�nt|t	�r>|g}
n|}
t32j|
ddd�|
�_|pOi�_
|�_|�_|�_|	�_d�_|durl|33durltd��|34durt|35�_nt|dur{|nd	��_t|t	�r�|n
t|jt	�r�|jn|jd36�_t�j��_���|dur�|nt|fi�j
���_�fdd�}|�_dS)a�37 38        Parameters39        ----------40        target_protocol: str (optional)41            Target filesystem protocol. Provide either this or ``fs``.42        cache_storage: str or list(str)43            Location to store files. If "TMP", this is a temporary directory,44            and will be cleaned up by the OS when this process ends (or later).45            If a list, each location will be tried in the order given, but46            only the last will be considered writable.47        cache_check: int48            Number of seconds between reload of cache metadata49        check_files: bool50            Whether to explicitly see if the UID of the remote file matches51            the stored one before using. Warning: some file systems such as52            HTTP cannot reliably give a unique hash of the contents of some53            path, so be sure to set this option to False.54        expiry_time: int55            The time in seconds after which a local copy is considered useless.56            Set to falsy to prevent expiry. The default is equivalent to one57            week.58        target_options: dict or None59            Passed to the instantiation of the FS, if fs is None.60        fs: filesystem instance61            The target filesystem to run against. Provide this or ``protocol``.62        same_names: bool (optional)63            By default, target URLs are hashed using a ``HashCacheMapper`` so64            that files from different backends with the same basename do not65            conflict. If this argument is ``true``, a ``BasenameCacheMapper``66            is used instead. Other cache mapper options are available by using67            the ``cache_mapper`` keyword argument. Only one of this and68            ``cache_mapper`` should be specified.69        compression: str (optional)70            To decompress on download. Can be 'infer' (guess from the URL name),71            one of the entries in ``fsspec.compression.compr``, or None for no72            decompression.73        cache_mapper: AbstractCacheMapper (optional)74            The object use to map from original filenames to cached filenames.75            Only one of this and ``same_names`` should be specified.76        Nz9Please provide filesystem instance(fs) or target_protocolz@Both filesystems (fs) and target_protocol may not be both given.r5�����T��exist_okzMCannot specify both same_names and cache_mapper in CachingFileSystem.__init__Frcs�j�t���|��S�N)r$�_strip_protocol�typer�r(rrr@��z3CachingFileSystem.__init__.<locals>._strip_protocolr)�super�__init__�77ValueError�tempfile�mkdtemp�weakref�finalize�_remove_tempdir�78isinstance�str�os�makedirs�storage�kwargs�cache_check�check_files�expiry�compression�_cache_size�_mapperrr3�target_protocolr�	_metadata�79load_cacherr$r@)r(rXZ
cache_storagerRrS�expiry_timeZtarget_optionsr$r8rUr:rQ�tempdirrPr@��	__class__rBrrECsT7��8081���� 82zCachingFileSystem.__init__cCs$zt|�WdStyYdSwr?)r�	Exception)r\rrrrK�s83�z!CachingFileSystem._remove_tempdircCstj|jddd�dS)Nr<Tr=)rNrOrPrBrrr�_mkcache�szCachingFileSystem._mkcachecCs.|jdur|jd}td�j|dd�|_|jS)z�Return size of cache in bytes.84 85        If more than one cache directory is in use, only the size of the last86        one (the writable cache directory) is returned.87        Nr<�fileT)Zwithdirs)rVrPrZdu)r(�	cache_dirrrr�88cache_size�s8990zCachingFileSystem.cache_sizecCs |j��|��t��|_dS)z#Read set of stored blocks from fileN)rY�loadr`�time�91last_cacherBrrrrZ��92zCachingFileSystem.load_cachecCs&|��|j��t��|_d|_dS)z#Save set of stored blocks from fileN)r`rY�savererfrVrBrrr�93save_cache�s949596zCachingFileSystem.save_cachecCsR|��|js	dSt��|j|jk}tdd�|jD��}|s!|s'|��dSdS)z0Reload caches if time elapsed or any disappearedNcss�|]	}tj�|�VqdSr?)rNr�exists)rrPrrr�	<genexpr>�s�z1CachingFileSystem._check_cache.<locals>.<genexpr>)r`rRrerf�allrPrZ)r(ZtimecondZ	existcondrrr�_check_cache�s�zCachingFileSystem._check_cachecCs |�|�}|��|j�||�S)z Is path in cache and still valid)r@rmrYZ97check_file�r(rrrr�_check_file�rgzCachingFileSystem._check_filecCs t|jd�|��d|_dS)z�Remove all files and metadata from the cache98 99        In the case of multiple cache locations, this clears only the last one,100        which is assumed to be the read/write one.101        r<N)rrPrZrVrBrrr�clear_cache�s102zCachingFileSystem.clear_cachecCsf|s|j}|��|j�|�\}}|D]
}tj�|�r t�|�q|r.t|j	d�|�103�d|_dS)a�Remove all expired files and metadata from the cache104 105        In the case of multiple cache locations, this clears only the last one,106        which is assumed to be the read/write one.107 108        Parameters109        ----------110        expiry_time: int111            The time in seconds after which a local copy is considered useless.112            If not defined the default is equivalent to the attribute from the113            file caching instantiation.114        r<N)rTrmrYZ
clear_expiredrNrrj�removerrPrZrV)r(r[Z
expired_filesZwritable_cache_emptyr"rrr�clear_expired_cache�s115�116z%CachingFileSystem.clear_expired_cachecCs2|�|�}|j�|�}|durt�|�d|_dS)z�Remove cached version of given file117 118        Deletes local copy of the given (remote) path. If it is found in a cache119        location which is not the last, it is assumed to be read-only, and120        raises PermissionError121        N)r@rYZpop_filerNrqrV)r(rr"rrr�pop_from_caches122123124125z CachingFileSystem.pop_from_cache�rbTc	s������j����d|vr�jj�f||||d����S����}|rH|\}}|d|d}	}126|127durAt�d��t||�St�d��n-����}	tj	�128�jd|	�}t�}129�|	|130t
�
��j���d	�}�j��|�t�d131��|�d�}����jj�f||||d|d
�����|dur��j|d<�j��|��jr��jdkr�t��n�j}t|�dd��d|vr�|d�jkr�td|d�d�j�d���n�j|d<���fdd�}
�jr�dn|
}t�j�j�j||132|d��_�j����fdd��_����S)a!Wrap the target _open133 134        If the whole file exists in the cache, just open it locally and135        return that.136 137        Otherwise, open the file on the target FS, and make it have a mmap138        cache pointing to the location which we determine, in our cache.139        The ``blocks`` instance is shared, so as the mmap cache instance140        updates, so does the entry in our ``cached_files`` attribute.141        We monkey-patch this file, so that when it closes, we call142        ``close_and_update`` to save the state of the blocks.143        �r)�mode�144block_size�145autocommit�
cache_optionsr"�blocksT�Opening local copy of %sz#Opening partially cached copy of %sr<��originalr"rzre�uidz!Creating local sparse file for %s�size�none)rvrwrxryZ146cache_typerN�inferrt�rv�	blocksizezDCached file must be reopened with same block size as original (old: z, new �)cs6�jj�gt|�dd�|D�dd�|D�fi���S)NcS�g|]}|d�qS)rr�rrurrrr��zBCachingFileSystem._open.<locals>._fetch_ranges.<locals>.<listcomp>cSr�)�rr�rrrr�r�)r$�147cat_ranges�len)�ranges)rQrr(rr�
_fetch_ranges~s��z.CachingFileSystem._open.<locals>._fetch_ranges)�
multi_fetchercs�����Sr?)�close_and_updater)�closerr(rr�<lambda>�sz)CachingFileSystem._open.<locals>.<lambda>)r@r$�_openro�logger�debug�openrWrNr�joinrP�setre�ukeyrY�update_file�getr`rrUrr148r�r
rZ_fetch_range�cacher�ri)r(rrvrwrxryrQ�detailr"�hashrzr�compr�r�r)r�rrQrr(rr�s�149���150151152153�154���155156������157�zCachingFileSystem._opencCs|j�|�Sr?)r$�_parentrnrrrr���zCachingFileSystem._parentrrM�argsr�returncGs158|�|�Sr?)rW)r(rr�rrr�	hash_name�s159zCachingFileSystem.hash_namecCs�|jrdS|�|j�}|j�||�zt�d�|��t�d�Wnty0t�d�Ynt	y=t�d�Ynw|�d|_dS)z9Called when a file is closing, so store the set of blocksNz
going to save�savedz&Cache saving failed while closing filez-Cache save failed due to interpreter shutdownT)160�closedr@rrYZon_close_cached_filer�r�ri�OSError�	NameError)r(rr�rrrrr��s161�162z"CachingFileSystem.close_and_updatecCs|j�||�Sr?)r$�ls)r(rr�rrrr��szCachingFileSystem.lscs��dvr��fdd�S�dvrt��dvrt��j���S�dvr(tt����S�dkr0t��St��d�}|�d	d�}�|vrD|�S|durw�|jvrR|j�St|�}t|��}t	�163|�set	�|�rut|d164�ro|j
duru|�||�S|St����S)N>,r�r��isfilerj�to_dict�	pipe_filersro�_make_local_detailsr�r��commit_manyrc�cat�to_jsonrm�tailrprEZend_transaction�165__reduce__Z_paths_from_pathZcat_file�	_cat_fileZ166read_blockri�167local_file�	open_manyr`rr�piper�Z168get_mapper�headr��__eq__�__hash__Zstart_transactionrZ�__getattribute__r��isdir�_cat_ranges�infocstt�������|i|��Sr?)�getattrrA�__get__)r��kw��itemr(rrr��s169��z4CachingFileSystem.__getattribute__.<locals>.<lambda>)�
__reduce_ex__)�transaction>�transaction_typer3�_cacher^�__dict__r$�__self__)�AttributeErrorrAr�r�r��objectr�r�r��inspect�170isfunction�isdatadescriptor�hasattrr�rD)r(r��dr$�cls�mr]r�rr��s40171172173�174z"CachingFileSystem.__getattribute__cCs~||urdSt|t|��sdS|j|jko>|j|jko>|j|jko>|j|jko>|j|jko>|j|jko>|j|jko>|j	|j	kS)zTest for equality.TF)175rLrArPrQrRrSrTrUrWrX)r(�otherrrrr��s&176�177�178�179�180�181�182�zCachingFileSystem.__eq__cCsXtt|j��tt|j��At|j�At|j�At|j�At|j�At|j	�At|j183�AS)zCalculate hash.)r��tuplerPrMrQrRrSrTrUrWrXrBrrrr�s ��������zCachingFileSystem.__hash__)184Nr5r6Fr7NNNNN)r8r9r:r;r?)rtNTN)rrMr�rr�rMr-)r.r/r0�__doc__r3�__annotations__Z_strip_tokenize_optionsrE�staticmethodrKr`rcrZrirmrorprrrsr�r�r�r�r�r�r�r��
__classcell__rrr]rr1,sL185�q186187 188189�s190191Sr1c@sJeZdZdZdZdZdd�Zdd�Zdd	�Zd192de	fdd
�Z193ddd�ZdS)�WholeFileCacheFileSystema
Caches whole remote files on first access194 195    This class is intended as a layer over any other file system, and196    will make a local copy of each file accessed, so that all subsequent197    reads are local. This is similar to ``CachingFileSystem``, but without198    the block-wise functionality and so can work even when sparse files199    are not allowed. See its docstring for definition of the init200    arguments.201 202    The class still needs access to the remote store for listing files,203    and may refresh cached files.204    �	filecacheTcsdd��D�}d�jvr���n���fdd�|D�S�jr!t��fdd�|D�}dd�t||�D�}�fdd�t||�D�}dd�t||�D�}|rq�j�||��fd	d�|D�}t||�D]\}	}205�j�|	|206�qa��	�d207d����fdd�t||�D�S)
NcSrrr)rZofrrrr/r z6WholeFileCacheFileSystem.open_many.<locals>.<listcomp>rucs>g|]}t�j|f�jtj��jd��|��d�����qS)r<�rvr")�
LocalTempFiler$rvrNrr�rPrW�rr)rQ�208open_filesr(rrr3s�����c�g|]}��|��qSr�ro)r�sprBrrr@�cS�g|]\}}|s|�qSrr�r�pr�rrrrA�cs*g|]\}}tj��jd��|���qS)r<)rNrr�rPrWr�rBrrrB���cSr�rr)rr"r�rrrrFr�c	s.g|]}|��|�dt���j�|�d��qS)Tr|)rWrer$r�r�rBrrrLs�209��cSst|t�r	|dS|S)Nr�)rLr�r!rrr�	firstpartZrCz5WholeFileCacheFileSystem.open_many.<locals>.firstpartcs*g|]\}}t|r
�|�n|�jd��qS)r�)r�rv)rZfn0Zfn1)r�r�rrr^r�)210rvr`rU�NotImplementedError�zipr$r�rYr�ri)r(r�rQ�paths�detailsZdownpathZdownfn0ZdownfnZ	newdetailrr�r)r�rQr�r(rr�.s4211212�213�214�215�z"WholeFileCacheFileSystem.open_manyc	Csf|j�dd�|D�dd�|D��dd�|D�|D]}zt�|j�Wqty-Yqwd|_dS)NcSrrr!rrrrrdr z8WholeFileCacheFileSystem.commit_many.<locals>.<listcomp>cSrrrrrrrrdr cSsg|]}|���qSr�r�rrrrrer�)r$r%rNrq�name�FileNotFoundErrorrV)r(r�rrrrr�cs"�216z$WholeFileCacheFileSystem.commit_manycCsX|�|�}tj�|jd|�}||dt��|j�|�d�}|j�	||�t217�d|�|S)Nr<Tr|�Copying %s to local cache)rWrNrr�rPrer$r�rYr�r�r�)r(rr�r"r�rrrr�ns218219�z,WholeFileCacheFileSystem._make_local_detailsF�raisecKs||j|||�d�d�}g}g}g}	i}220|��D]Q}z+|�|�}|s1|�|�}
|�|�|�|
�n
t|t�r8|nd|f\}}
|	�|
�Wqtyh}z|dkrQ�|dkrY||221|<|�	|�WYd}~qd}~ww|rv|j222�||�|��|�t
|��t||	�D]$\}}
t|
d��}|��|223|<Wd�n1s�wY|�d�q�t|t�r�t
|�dkr�|dur�|224|d}225|226S)	N�maxdepth)�	recursiver�r�r�rtr�Fr)Zexpand_pathr��copyror��appendrLr�r_rqr$riZset_sizer�r�r��readZrelative_updaterM)r(rr��on_error�callbackrQr�ZgetpathsZ227storepathsZfns�outr�r�r"�errrrr�|sH�228229230���zWholeFileCacheFileSystem.catrtc	Ks�|�|�}d|vr-|�|�}tj�|jd|�}dd�|��D�}t||f||d�|��S|�|�}|r`|\}}|d|d}}	|	durXt	�231d	|�t||�}232|�d233�|234_
|235Std|�d���|�|�}||d
<|��|jr�|jj|fi|���V}236t|d��A}t|237t�r�td|238jj|239j�|240_|jdkr�t|�n|j}t||241dd�}242d}
|
r�t|243dd�}|244�|�}
|�|
�|
s�Wd�n1s�wYWd�n1s�wYn|j�||�|� �|�||�S)Nrur<cS�i|]\}}|dvr||�qS�)rxrwryr�r�k�vrrr�245<dictcomp>�s246�z2WholeFileCacheFileSystem._open.<locals>.<dictcomp>r�r"rzTr{r}z&Attempt to open partially cached file z as a wholly cached filerv�wbrr�rtr�r��P)!r@rWrNrr�rP�itemsr�ror�r�r�r�r}rFr�r`rUr$r�rLrrr��fetcherrrr247r�r��write�get_fileri)r(rrvrQr�r"�user_specified_kwargsr��_rzr�f2r��data�blockrrrr��s\248249�250251252�253"254255��256257�����zWholeFileCacheFileSystem._openN�rt)r.r/r0r�r3r�r�r�r�r	r�r�rrrrr�s
5258�-r�cs�eZdZdZdZdZeZ�fdd�Zdd�Z	dd	�Z259d260d�Zd�fd
d�	Zd dd�Z
dd�Zddd�Zd!dd�Z	d"dd�Z	d"dd�Zd#dd�Z�ZS)$�SimpleCacheFileSystema�Caches whole remote files on first access261 262    This class is intended as a layer over any other file system, and263    will make a local copy of each file accessed, so that all subsequent264    reads are local. This implementation only copies whole files, and265    does not keep any metadata about the download time or file details.266    It is therefore safer to use in multi-threaded/concurrent situations.267 268    This is the only of the caching filesystems that supports write: you will269    be given a real local open file, and upon close and commit, it will be270    uploaded to the target filesystem; the writability or the target URL is271    not checked until that time.272 273    ZsimplecacheTcsV|��}dD]}d||<qt�jdi|��|jD]}tj�|�s(tj|dd�qdS)N)rRr[rSFTr=r)r�rDrErPrNrrjrO)r(rQr��keyrPr]rrrE�s274275��zSimpleCacheFileSystem.__init__cCsD|��|�|�}|jD]}tj�||�}tj�|�r|SqdSr?)rmrWrPrNrr�rj)r(r�sharPr"rrrros276277��z!SimpleCacheFileSystem._check_filecC�dSr?rrBrrrri278�z SimpleCacheFileSystem.save_cachecCr
r?rrBrrrrZ
rz SimpleCacheFileSystem.load_cacheNcsT|jr!|�|d��}|�|�Wd�dS1swYdSt��||�dS)Nr�)r'r�rrDr�)r(r�valuerQrr]rrr�s279"�zSimpleCacheFileSystem.pipe_filec280281KsH|�|�}g}z|jj|fddi|����}Wnty+}z|}WYd}~nd}~wwd}|jr�|�d�d}|jjD]R}|j	|krR|�282||jpL|��dd��q<|j	�
|�r�|j	�d�|�d�krs|�283|j	|jpm|��dd��q<d�|j	�d�d|�d�d��}	|�284|	ddd��q<|dur�|s�|�|r�|Std	d285�|D��S)Nr�T�/ra�r�rrAr�r�	directorycss�|]}|dVqdS)r�Nr�rrrrrrk5s�z+SimpleCacheFileSystem.ls.<locals>.<genexpr>)r@r$r�r�r�r'�rstripr�r#rr�r�tell�286startswith�countr��split�sorted)287r(rr�rQr�r��exZpath1rZdnamerrrr�sJ288������289��$�zSimpleCacheFileSystem.lscs�|����|jrD�fdd�|jjD�}|r/|djr#tj�|dj�n|d�	�}�|dd�St290�fdd�|jjD��}|rD�ddd�S|jj�fi|��S)	Ncsg|]	}|j�kr|�qSrrrrrrr:sz.SimpleCacheFileSystem.info.<locals>.<listcomp>rrarc3s �|]}|j��d�VqdS)rN)rrrrrrrk>s�z-SimpleCacheFileSystem.info.<locals>.<genexpr>r)
r@r'r�r#r�rNr�getsizer"r�anyr$r�)r(rrQrrrrrr�7s291(zSimpleCacheFileSystem.infocKsjt|t�r|j|�|�|fi|��dSt|t�r1|��D]\}}|j|�|�|fi|��qdStd��)Nzpath must be str or dict)rLrMr�r@�dictrrF)r(rrrQr�r�rrrr�Cs292293�zSimpleCacheFileSystem.pipec	�s��t�d|�|�|�}|�|�}|�|�}|s0tj�|jd|�}|j	j294||fi|��IdHt|d�� }|r=|�|�|durCdn||�
�}|�|�Wd�S1sXwYdS)Nzasync cat_file %sr<rt)r�r�r@rWrorNrr�rPr$Z	_get_filer��seekrr�)	r(r�start�endrQrr"rrrrrr�Ls�295296297298$�zSimpleCacheFileSystem._cat_filer�c�s��t�d|�g}t�}g}	g}299|D]2}|�|�}|dur?||vr?|�|�}
tj�|jd|
�}|	�	|�|�300|�|301�	|�|�	|�q|	rS|jj|302|	|d�IdHt
�j|||f||d�|��S)Nzasync cat ranges %sr<)r���max_gapr�)r�r�r�rorWrNrr�rPr��addr$�_getrr�)r(r��starts�endsr"r�rQr+Zrset�downloadr*r�r"rrrrr�\s0�303304305306307���z!SimpleCacheFileSystem._cat_rangesc	s�t�d|��fdd�|D�}dd�t||�D�}dd�t||�D�}�j�||��fdd�|D�}t�j|||f||d�|��S)Nz
cat ranges %scr�rr��rr�rBrrrxr�z4SimpleCacheFileSystem.cat_ranges.<locals>.<listcomp>cSsg|]308\}}|dur|�qS�Fr�r�lr�rrrry�cSsg|]309\}}|dur|�qSr)rr*rrrrzr,cr�rr�r(rBrrr|r�r!)r�r�r�r$r�rr�)	r(r�r%r&r"r�rQr+r*rrBrr�ts���z SimpleCacheFileSystem.cat_rangesrtc	Ks�|�|�}|�|�}d|vr0tj�|jd|�}dd�|��D�}t||f||j|d�|��S|�	|�}|r<t310||�Stj�|jd|�}t�d|�||d<|�
�d|_|jr�|jj|fi|���V}t311|d��A}t|t�rztd	|jj|j�|_|jd312kr�t|�n|j}	t|	|dd�}d
}313|314r�t|dd�}|�|�}315|�|316�|317s�Wd�n1s�wYWd�n1s�wYn|j�||�|�||�S)Nrur<cSr�r�rr�rrrr��s318�z/SimpleCacheFileSystem._open.<locals>.<dictcomp>)rvrxr"r�rvr�rr�rtr�Tr�r�)r@rWrNrr�rPrr�r'ror�r�r�r`rVrUr$r�rLrrr�rrrr319r�r�rr)r(rrvrQrr"rrrr�rrrrrr��s^320321����322323"324325��326327�����zSimpleCacheFileSystem._openr?r-)NN)Nr�r	)r.r/r0r�r3r�rr�rErorirZr�r�r�r�r�r�r�r�r�rrr]rr328�s&	329 330331	332�333�
r334c@sheZdZdZddd�Zdd�Zd	d335�Zdd�Zd
d�Zdd�Z	dd�Z336edd��Zddd�Z
dd�ZdS)r�z8A temporary local file, which will be uploaded on commitr�TrcKsP||_t||�|_||_|r|j�|�||_d|_||_d|_||_	||_337dS)NF)r"r��fhrvrrrr$r�rxrQ)r(r$rr"rvrxrrQrrrrE�s338zLocalTempFile.__init__cCs t|j|j|jd|j|��ffS)Nzr+b)r�r$rr"rxrrBrrrr��s�zLocalTempFile.__reduce__cC�|jSr?)r-rBrrr�	__enter__�szLocalTempFile.__enter__cCs|��dSr?r�)r(�exc_type�exc_val�exc_tbrrr�__exit__�r�zLocalTempFile.__exit__cCs0|jrdS|j��d|_|jr|��dSdS)NT)r�r-r�rxr)rBrrrr��s339�zLocalTempFile.closecCs|j��t�|j�dSr?)r-r�rNrqr"rBrrr�discard�s340zLocalTempFile.discardcCs$|jj|jg|jgfi|j��dSr?)r$r%r"rrQrBrrrr)�s$zLocalTempFile.commitcCr.r?r!rBrrrr��szLocalTempFile.namer�rMcCsd|j��S)NzLocalTempFile: rrBrrr�__repr__�r�zLocalTempFile.__repr__cCst|j|�Sr?)r�r-)r(r�rrr�__getattr__�r�zLocalTempFile.__getattr__N)r�Tr)r�rM)r.r/r0r�rEr�r/r3r�r4r)�propertyr�r5r6rrrrr��s341
	342343r�)1�344__future__rr��loggingrNrGrerI�collections.abcr�shutilr�typingrrrZfsspecrZfsspec.callbacksr	Zfsspec.compressionr345Zfsspec.corerrZfsspec.exceptionsr
Z#fsspec.implementations.cache_mapperrZ%fsspec.implementations.cache_metadatarZfsspec.implementations.chainedrZfsspec.implementations.localrZfsspec.specrZfsspec.transactionrZfsspec.utilsrr�	getLoggerr�rr1r�r346r�rrrr�<module>sF347tIO
Aluode/PerceptionLabPortable · CoolFace