CoolFace
Apppublic

Aluode/PerceptionLabPortable

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

2��Yiu	�@shddlmZddlZddlZddlmZGdd�dej�ZGdd�de�ZGdd	�d	e�Z	dd
d�Z3dS)�)�annotationsN)�make_path_posixc@s4eZdZdZejddd��Zdd4d�Zdd
d�ZdS)�AbstractCacheMapperzUAbstract super-class for mappers from remote URLs to local cached5    basenames.6    �path�str�returncCsdS�N���selfrr	r	��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\fsspec/implementations/cache_mapper.py�__call__szAbstractCacheMapper.__call__�other�object�boolcCst|t|��Sr)�7isinstance�type�rrr	r	r�__eq__szAbstractCacheMapper.__eq__�intcCstt|��Sr)�hashr�rr	r	r�__hash__szAbstractCacheMapper.__hash__N�rrrr�rrrr�rr)	�__name__�8__module__�__qualname__�__doc__�abc�abstractmethodr
rrr	r	r	rr	s9rcsFeZdZdZdddd�Zdd10d�Zd�fdd�Zd�fdd�Z�ZS)�BasenameCacheMapperz�Cache mapper that uses the basename of the remote URL and a fixed number11    of directory levels above this.12 13    The default is zero directory levels, meaning different paths with the same14    basename will have the same cached basename.15    r�directory_levelsrcCs |dkrtd��||_d|_dS)Nrz>BasenameCacheMapper requires zero or positive directory_levelsz_@_)�16ValueErrorr#�17_separator)rr#r	r	r�__init__$s�18zBasenameCacheMapper.__init__rrrcCs2t|�}|�d|jd�^}}|r|j�|�S|S)N�/�)r�rsplitr#r%�join)rr�prefix�bitsr	r	rr
.s19zBasenameCacheMapper.__call__rrrcst��|�o|j|jkSr)�superrr#r��	__class__r	rr6szBasenameCacheMapper.__eq__cst���t|j�ASr)r-rrr#rr.r	rr9szBasenameCacheMapper.__hash__)r)r#rrrr)	rrrrr&r
rr�
__classcell__r	r	r.rr"s20 21r"c@seZdZdZddd�ZdS)	�HashCacheMapperz0Cache mapper that uses a hash of the remote URL.rrrcCst�|�����Sr)�hashlib�sha256�encode�	hexdigestr22r	r	rr
@szHashCacheMapper.__call__Nr)rrrrr
r	r	r	rr1=sr1�23same_namesrrcCs|rt�St�S)z�Factory method to create cache mapper for backward compatibility with24    ``CachingFileSystem`` constructor using ``same_names`` kwarg.25    )r"r1)r6r	r	r�create_cache_mapperDsr7)r6rrr)�26__future__rr r2Zfsspec.implementations.localr�ABCrr"r1r7r	r	r	r�<module>s!
Aluode/PerceptionLabPortable · CoolFace