o
    iu	                     @  sh   d dl mZ d dlZd dlZd dlmZ G dd dejZG dd deZG dd	 d	eZ	dddZ
dS )    )annotationsN)make_path_posixc                   @  s4   e Zd ZdZejdddZdd
dZdddZdS )AbstractCacheMapperzUAbstract super-class for mappers from remote URLs to local cached
    basenames.
    pathstrreturnc                 C  s   d S N selfr   r	   r	   r/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/fsspec/implementations/cache_mapper.py__call__   s   zAbstractCacheMapper.__call__otherobjectboolc                 C  s   t |t| S r   )
isinstancetyper   r   r	   r	   r   __eq__   s   zAbstractCacheMapper.__eq__intc                 C  s   t t| S r   )hashr   r   r	   r	   r   __hash__   s   zAbstractCacheMapper.__hash__Nr   r   r   r   r   r   r   r   r   r   )	__name__
__module____qualname____doc__abcabstractmethodr   r   r   r	   r	   r	   r   r   	   s    
r   c                      sF   e Zd ZdZddddZdd
dZd fddZd fddZ  ZS )BasenameCacheMapperzCache mapper that uses the basename of the remote URL and a fixed number
    of directory levels above this.

    The default is zero directory levels, meaning different paths with the same
    basename will have the same cached basename.
    r   directory_levelsr   c                 C  s    |dk rt d|| _d| _d S )Nr   z>BasenameCacheMapper requires zero or positive directory_levelsz_@_)
ValueErrorr#   
_separator)r   r#   r	   r	   r   __init__$   s   
zBasenameCacheMapper.__init__r   r   r   c                 C  s2   t |}|d| jd ^}}|r| j|S |S )N/   )r   rsplitr#   r%   join)r   r   prefixbitsr	   r	   r   r   .   s
   zBasenameCacheMapper.__call__r   r   r   c                   s   t  |o| j|jkS r   )superr   r#   r   	__class__r	   r   r   6   s   zBasenameCacheMapper.__eq__c                   s   t   t| jA S r   )r-   r   r   r#   r   r.   r	   r   r   9   s   zBasenameCacheMapper.__hash__)r   )r#   r   r   r   r   )	r   r   r   r   r&   r   r   r   __classcell__r	   r	   r.   r   r"      s    

r"   c                   @  s   e Zd ZdZdddZdS )	HashCacheMapperz0Cache mapper that uses a hash of the remote URL.r   r   r   c                 C  s   t |  S r   )hashlibsha256encode	hexdigestr
   r	   r	   r   r   @   s   zHashCacheMapper.__call__Nr   )r   r   r   r   r   r	   r	   r	   r   r1   =   s    r1   
same_namesr   r   c                 C  s   | rt  S t S )zFactory method to create cache mapper for backward compatibility with
    ``CachingFileSystem`` constructor using ``same_names`` kwarg.
    )r"   r1   )r6   r	   r	   r   create_cache_mapperD   s   r7   )r6   r   r   r   )
__future__r   r    r2   Zfsspec.implementations.localr   ABCr   r"   r1   r7   r	   r	   r	   r   <module>   s    !