
    "hmp              	      2   U d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
mZ d dlmZmZmZmZmZmZmZmZ erd dlZd dlmZ  ed      Zn ed      Z ed      Z ej4                  d      Zeeegef   Z G d	 d
      Z G d de      Z  G d de      Z! G d de      Z" G d de      Z# G d de      Z$ G d de      Z% G d de      Z& G d deeef         Z' G d de      Z(deiZ)de*d<   d d!dZ+ee e$e!e#e"e%e&e(f	D ]
  Z, e+e,        y)"    )annotationsN)FutureThreadPoolExecutor)TYPE_CHECKINGAnyCallableClassVarGeneric
NamedTupleOrderedDictTypeVar)	ParamSpecPTfsspecc                  0    e Zd ZU dZdZded<   ddZd	dZy)
	BaseCacheag  Pass-though cache: doesn't keep anything, calls every time

    Acts as base class for other cachers

    Parameters
    ----------
    blocksize: int
        How far to read ahead in numbers of bytes
    fetcher: func
        Function of the form f(start, end) which gets bytes from remote as
        specified
    size: int
        How big this file is
    noneClassVar[str]namec                .    || _         || _        || _        y N)	blocksizefetchersize)selfr   r   r   s       K/var/www/html/sandstorm/venv/lib/python3.12/site-packages/fsspec/caching.py__init__zBaseCache.__init__9   s    "	    c                t    |d}|| j                   }|| j                   k\  s||k\  ry| j                  ||      S Nr   r   )r   r   r   startstops      r   _fetchzBaseCache._fetch>   s@    =E<99DDII$||E4((r   Nr   intr   Fetcherr   r'   returnNoner#   
int | Noner$   r,   r)   bytes)__name__
__module____qualname____doc__r   __annotations__r   r%    r   r   r   r   '   s     !D- 
)r   r   c                  d     e Zd ZdZdZ	 	 d	 	 	 	 	 	 	 	 	 	 	 d	 fdZd
dZddZddZddZ	 xZ
S )	MMapCachezmemory-mapped sparse file cache

    Opens temporary file, which is filled blocks-wise when data is requested.
    Ensure there is enough disc space in the temporary location.

    This cache method might only work on posix
    mmapc                    t         |   |||       |
t               n|| _        || _        | j                         | _        y r   )superr   setblockslocation	_makefilecache)r   r   r   r   r;   r:   	__class__s         r   r   zMMapCache.__init__S   s:     	GT2%~ce6 ^^%
r   c                4   dd l }dd l}| j                  dk(  r
t               S | j                  )t
        j                  j                  | j                        s| j                   |j                         }t               | _
        nt        | j                  d      }|j                  | j                  dz
         |j                  d       |j                          nt        | j                  d      } |j                   |j                         | j                        S )Nr   zwb+      1zrb+)r6   tempfiler   	bytearrayr;   ospathexistsTemporaryFiler9   r:   openseekwriteflushfileno)r   r6   rB   fds       r   r<   zMMapCache._makefile`   s    99>; == t}}(E}}$++-!e$--/GGDIIM"HHTNHHJdmmU+Btyydii00r   c                   t         j                  d| d|        |d}|| j                  }|| j                  k\  s||k\  ry|| j                  z  }|| j                  z  }t	        ||dz         D cg c]  }|| j
                  vs| }}|r|j                  d      }|| j                  z  }t        || j                  z   | j                        }t         j                  d| d| d|        | j                  ||      | j                  || | j
                  j                  |       |r| j                  || S c c}w )NzMMap cache fetching -r   r   r@   zMMap get block #z ()loggerdebugr   r   ranger:   popminr   r=   add)	r   r#   endstart_block	end_blockineedsstartsends	            r   r%   zMMapCache._fetchv   s0   +E7!C59:=E;))CDII#t~~-4>>)	 i!m<Ua@TUU A'Fv.		:DLL+A3b$@A&*ll64&@DJJvd#KKOOA  zz%$$ Vs   2D;D;c                @    | j                   j                         }|d= |S )Nr=   )__dict__copyr   states     r   __getstate__zMMapCache.__getstate__   s     ""$'Nr   c                d    | j                   j                  |       | j                         | _        y r   )r^   updater<   r=   r`   s     r   __setstate__zMMapCache.__setstate__   s"    U#^^%
r   )NN)r   r'   r   r(   r   r'   r;   z
str | Noner:   zset[int] | Noner)   r*   )r)   zmmap.mmap | bytearrayr#   r,   rV   r,   r)   r-   r)   dict[str, Any]ra   rh   r)   r*   )r.   r/   r0   r1   r   r   r<   r%   rb   re   __classcell__r>   s   @r   r5   r5   H   sj     D  $"&&& & 	&
 &  & 
&1,%.&r   r5   c                  0     e Zd ZdZdZd fdZddZ xZS )ReadAheadCachea!  Cache which reads only when we get beyond a block of data

    This is a much simpler version of BytesCache, and does not attempt to
    fill holes in the cache or keep fragments alive. It is best suited to
    many small reads in a sequential order (e.g., reading lines from a file).
    	readaheadc                R    t         |   |||       d| _        d| _        d| _        y )Nr   r   )r8   r   r=   r#   rV   r   r   r   r   r>   s       r   r   zReadAheadCache.__init__   s)    GT2

r   c                   |d}||| j                   kD  r| j                   }|| j                   k\  s||k\  ry||z
  }|| j                  k\  r8|| j                  k  r)| j                  || j                  z
  || j                  z
   S | j                  |cxk  r| j                  k  r:n n7| j                  || j                  z
  d  }|t	        |      z  }| j                  }nd}t        | j                   || j                  z         }| j                  ||      | _        || _        | j                  t	        | j                        z   | _        || j                  d | z   S r!   )r   r#   rV   r=   lenrT   r   r   )r   r#   rV   lparts        r   r%   zReadAheadCache._fetch   s&   =E;#		/))CDII#%KDJJ3$((?::edjj033CDDZZ5+488+::edjj023DTNAHHE D$))S4>>12\\%-

::DJJ/djj!n$$r   r&   rf   r.   r/   r0   r1   r   r   r%   rj   rk   s   @r   rm   rm      s     D%r   rm   c                  0     e Zd ZdZdZd fdZddZ xZS )FirstChunkCachezCaches the first block of a file only

    This may be useful for file types where the metadata is stored in the header,
    but is randomly accessed.
    firstc                6    t         |   |||       d | _        y r   )r8   r   r=   rp   s       r   r   zFirstChunkCache.__init__   s    GT2#'
r   c                   |xs d}|xs | j                   }|| j                  k  r| j                  [|| j                  kD  r+| j                  d|      }|d | j                   | _        ||d  S | j                  d| j                        | _        | j                  || }|| j                  kD  r|| j                  | j                  |      z  }|S | j                  ||      S Nr   )r   r   r=   r   )r   r#   rV   datart   s        r   r%   zFirstChunkCache._fetch   s    
TYY4>>!zz!'<<3/D!%&6!7DJ<'!\\!T^^<
::eC(DT^^#T^^S99K<<s++r   r&   rf   ru   rk   s   @r   rw   rw      s     D(,r   rw   c                       e Zd ZdZdZ	 d	 	 	 	 	 	 	 	 	 d fdZddZd ZddZddZ	ddZ
d fd	Z	 	 	 	 	 	 	 	 	 	 dd
Z xZS )
BlockCachea  
    Cache holding memory as a set of blocks.

    Requests are only ever made ``blocksize`` at a time, and are
    stored in an LRU cache. The least recently accessed block is
    discarded when more than ``maxblocks`` are stored.

    Parameters
    ----------
    blocksize : int
        The number of bytes to store in each block.
        Requests are only ever made for ``blocksize``, so this
        should balance the overhead of making a request against
        the granularity of the blocks.
    fetcher : Callable
    size : int
        The total size of the file being cached.
    maxblocks : int
        The maximum number of blocks to cache for. The maximum memory
        use for this cache is then ``blocksize * maxblocks``.
    
blockcachec                    t         |   |||       t        j                  ||z        | _        || _         t        j                  |      | j                        | _	        y r   )
r8   r   mathceilnblocks	maxblocks	functools	lru_cache_fetch_block_fetch_block_cachedr   r   r   r   r   r>   s        r   r   zBlockCache.__init__   sR     	GT2yy	!12"#A9#6#6y#A$BSBS#T r   c                V    d| j                    d| j                   d| j                   dS )Nz<BlockCache blocksize=, size=
, nblocks=>r   r   r   r   s    r   __repr__zBlockCache.__repr__  s2    $T^^$4 5II;ja9	
r   c                6    | j                   j                         S z
        The statistics on the block cache.

        Returns
        -------
        NamedTuple
            Returned directly from the LRU Cache used internally.
        r   
cache_infor   s    r   r   zBlockCache.cache_info	       ''2244r   c                $    | j                   }|d= |S )Nr   r^   r`   s     r   rb   zBlockCache.__getstate__  s    '(r   c                    | j                   j                  |        t        j                  |d         | j                        | _        y )Nr   )r^   rd   r   r   r   r   r`   s     r   re   zBlockCache.__setstate__  s<    U##J9#6#6u[7I#J$
 r   c                    |d}|| j                   }|| j                   k\  s||k\  ry|| j                  z  }|| j                  z  }t        ||dz         D ]  }| j                  |        | j	                  ||||      S )Nr   r   r@   start_block_numberend_block_number)r   r   rR   r   _read_cache)r   r#   rV   r   r   block_numbers         r   r%   zBlockCache._fetch  s    =E;))CDII# #dnn4$..0 ""46F6JK 	3L$$\2	3 1-	   
 	
r   c                    || j                   kD  rt        d| d| j                    d      || j                  z  }|| j                  z   }t        j	                  d|       t
        |   ||      }|S )=
        Fetch the block of data for `block_number`.
        'block_number=(' is greater than the number of blocks ()zBlockCache fetching block %dr   
ValueErrorr   rP   infor8   r%   )r   r   r#   rV   block_contentsr>   s        r   r   zBlockCache._fetch_block6  s}     $,,&  /))-a9 
 t~~-dnn$2LAs3r   c                   || j                   z  }|| j                   z  }||k(  r| j                  |      }||| S g }|j                  | j                  |      |d        t        |dz   |      D ]"  }	|j                  | j                  |	             $ |j                  | j                  |      d|        dj	                  |      S z
        Read from our block cache.

        Parameters
        ----------
        start, end : int
            The start and end byte positions.
        start_block_number, end_block_number : int
            The start and end block numbers.
        Nr@   r   r   r   appendrR   join
r   r#   rV   r   r   	start_posend_posblockoutr   s
             r   r   zBlockCache._read_cacheF  s     DNN*	&!11334FGE7++ CJJt//0BCIJOP
 !&&81&<>N O C

433LABC JJt//0@A(7KL88C= r       
r   r'   r   r(   r   r'   r   r'   r)   r*   r)   strrg   ri   rf   )r   r'   r)   r-   
r#   r'   rV   r'   r   r'   r   r'   r)   r-   )r.   r/   r0   r1   r   r   r   r   rb   re   r%   r   r   rj   rk   s   @r   r~   r~      s    , D MOUU'.U69UFIU	U
	5


. "!"!""!8;"!OR"!	"!r   r~   c                  Z     e Zd ZU dZdZded<   	 d	 	 	 	 	 	 	 	 	 d	 fdZd
dZddZ xZ	S )
BytesCacheaK  Cache which holds data in a in-memory bytes object

    Implements read-ahead by the block size, for semi-random reads progressing
    through the file.

    Parameters
    ----------
    trim: bool
        As we read more data, whether to discard the start of the buffer when
        we are more than a blocksize ahead of it.
    r-   r   r   c                `    t         |   |||       d| _        d | _        d | _        || _        y )Nr   )r8   r   r=   r#   rV   trim)r   r   r   r   r   r>   s        r   r   zBytesCache.__init__z  s2     	GT2
!%
#	r   c                f   |d}|| j                   }|| j                   k\  s||k\  ry| j                  N|| j                  k\  r?| j                  3|| j                  k  r$|| j                  z
  }| j                  |||z   |z
   S | j                  r$t        | j                   || j                  z         }n|}||k(  s|| j                   kD  ry| j                  || j                  k  r;| j                  || j                  kD  r | j                  ||      | _        || _        nJ| j                  J | j                  J || j                  k  r| j                  | j                  |z
  | j                  kD  r| j                  ||      | _        || _        n| j                  || j                        }|| _        || j                  z   | _        n| j                  || j                  kD  r| j                  | j                   kD  rnk|| j                  z
  | j                  kD  r| j                  ||      | _        || _        n0| j                  | j                  |      }| j                  |z   | _        | j                  t        | j                        z   | _        || j                  z
  }| j                  |||z   |z
   }| j                  rq| j                  | j                  z
  | j                  dz   z  }|dkD  rC| xj                  | j                  |z  z  c_        | j                  | j                  |z  d  | _        |S )Nr   r   r@   )	r   r#   rV   r=   r   rT   r   rr   r   )r   r#   rV   offsetbendnewr   nums           r   r%   zBytesCache._fetch  s    =E;))CDII#JJ"#$dhh TZZ'F::fv|e';<<>>tyy#"67DD5=EDII-JJ%$**"4HHdhh eT2DJDJ::)))88'''tzz!88#txx#~'F!%eT!:DJ!&DJ,,udjj9C!&DJ!$tzz!1DJ%$/88dii'488^dnn4!%eT!:DJ!&DJ,,txx6C!%c!1DJ::DJJ/#jj&3,"679988djj(dnnq.@ACQw

dnns22
!ZZ(<(>?

r   c                ,    t        | j                        S r   )rr   r=   r   s    r   __len__zBytesCache.__len__  s    4::r   )T)
r   r'   r   r(   r   r'   r   boolr)   r*   rf   )r)   r'   )
r.   r/   r0   r1   r   r2   r   r%   r   rj   rk   s   @r   r   r   k  sS    
 "D-! IM'.69AE	?Br   r   c                  X     e Zd ZU dZdZded<   	 	 	 	 d	 	 	 	 	 	 	 	 	 d fdZd	dZ xZS )
AllBytesz!Cache entire contents of the fileallr   r   c                r    t         |   |||       || j                  d| j                        }|| _        y r{   )r8   r   r   r   r|   )r   r   r   r   r|   r>   s        r   r   zAllBytes.__init__  s6     	GT2<<<499-D	r   c                     | j                   || S r   )r|   r"   s      r   r%   zAllBytes._fetch  s    yyt$$r   )NNNN)
r   r,   r   zFetcher | Noner   r,   r|   zbytes | Noner)   r*   r+   	r.   r/   r0   r1   r   r2   r   r%   rj   rk   s   @r   r   r     sX    +D- !%"&!

  
 	

 
 

%r   r   c                  \     e Zd ZU dZdZded<   i df	 	 	 	 	 	 	 	 	 	 	 d fdZd	 fdZ xZS )
KnownPartsOfAFilea  
    Cache holding known file parts.

    Parameters
    ----------
    blocksize: int
        How far to read ahead in numbers of bytes
    fetcher: func
        Function of the form f(start, end) which gets bytes from remote as
        specified
    size: int
        How big this file is
    data: dict
        A dictionary mapping explicit `(start, stop)` file-offset tuples
        with known bytes.
    strict: bool, default True
        Whether to fetch reads that go beyond a known byte-range boundary.
        If `False`, any read that ends outside a known part will be zero
        padded. Note that zero padding will not be used for reads that
        begin outside a known byte-range.
    partsr   r   Tc                   t         |   |||       || _        |rt        |j	                               }|d   g}|j                  |d         g}	|dd  D ]m  \  }
}|d   \  }}|
|k(  r&||f|d<   |	dxx   |j                  |
|f      z  cc<   9|j                  |
|f       |	j                  |j                  |
|f             o t        t        ||	            | _	        y || _	        y )Nr   r@   )
r8   r   strictsortedkeysrS   r   dictzipr|   )r   r   r   r   r|   r   _old_offsetsoffsetsr:   r#   r$   start0stop0r>   s                 r   r   zKnownPartsOfAFile.__init__  s     	GT2  -K"1~&Ghh{1~./F*12 ;t 'E>#)4.GBK2J$((E4="99JNNE4=1MM$((E4="9:; S&12DIDIr   c                   |d}|| j                   }d}| j                  j                         D ]_  \  \  }}}||cxk  r|k  sn ||z
  }||||z   |z
   }| j                  r||cxk  r|k  rn n|d||z
  t	        |      z
  z  z  }|c S |} n | j
                  t        d||f d      t        j                  d||f d       t        j                  d| d|        |t        | 1  ||      z   S )	Nr   r       z&Read is outside the known file parts: z. z%. IO/caching performance may be poor!z!KnownPartsOfAFile cache fetching rO   )r   r|   itemsr   rr   r   r   warningswarnrP   rQ   r8   r%   )	r   r#   r$   r   loc0loc1r|   offr>   s	           r   r%   zKnownPartsOfAFile._fetch  s,   =E<99D"&))//"3 	LT4$ u#t#dl3te!34{{dd&:d&:
 7dUlSX&=>>CJ
 !E%	. <<Eudm_TVWXX 	4eT]O D2 3	
 	8qGHUW^E4000r   )r   r'   r   r(   r   r'   r|   zdict[tuple[int, int], bytes]r   r   r   r   r+   r   rk   s   @r   r   r     se    , "D-! .0  	
 +  <(1 (1r   r   c                  P    e Zd ZdZ G d de      Zd
ddZddZddZddZ	ddZ
y	)UpdatableLRUzg
    Custom implementation of LRU cache that allows updating keys

    Used by BackgroudBlockCache
    c                  6    e Zd ZU ded<   ded<   ded<   ded<   y)UpdatableLRU.CacheInfor'   hitsmissesmaxsizecurrsizeN)r.   r/   r0   r2   r3   r   r   	CacheInfor   F  s    	r   r   c                    t        j                         | _        || _        || _        d| _        d| _        t        j                         | _	        y r{   )
collectionsr   _cache_func	_max_size_hits_misses	threadingLock_lock)r   funcmax_sizes      r   r   zUpdatableLRU.__init__L  s<    +6+B+B+D
!
^^%
r   c                ^   |rt        d|j                                | j                  5  || j                  v rH| j                  j	                  |       | xj
                  dz  c_        | j                  |   cd d d        S 	 d d d         | j                  |i |}| j                  5  || j                  |<   | xj                  dz  c_        t        | j                        | j                  kD  r| j                  j                  d       d d d        |S # 1 sw Y   xY w# 1 sw Y   |S xY w)Nz Got unexpected keyword argument r@   Flast)	TypeErrorr   r   r   move_to_endr   r   r   rr   r   popitem)r   argskwargsresults       r   __call__zUpdatableLRU.__call__T  s    >v{{}oNOOZZ 	)t{{"''-

a
{{4(		) 	)"	) T,V,ZZ 	0 &DKKLLAL4;;$..0###/		0 	) 	)	0 s   AD)A#D"D"D,c                b    | j                   5  || j                  v cd d d        S # 1 sw Y   y xY wr   )r   r   )r   r   s     r   is_key_cachedzUpdatableLRU.is_key_cachedg  s*    ZZ 	'4;;&	' 	' 	's   %.c                    | j                   5  || j                  |<   t        | j                        | j                  kD  r| j                  j	                  d       d d d        y # 1 sw Y   y xY w)NFr   )r   r   rr   r   r   )r   r   r   s      r   add_keyzUpdatableLRU.add_keyk  sV    ZZ 	0 &DKK4;;$..0###/	0 	0 	0s   AA$$A-c                    | j                   5  | j                  | j                  t        | j                        | j
                  | j                        cd d d        S # 1 sw Y   y xY w)N)r   r   r   r   )r   r   r   rr   r   r   r   r   s    r   r   zUpdatableLRU.cache_infoq  sP    ZZ 	>>T[[)ZZ||	 " 	 	 	s   AAA&N)   )r   zCallable[P, T]r   r'   r)   r*   )r   zP.argsr   zP.kwargsr)   r   )r   r   r)   r   )r   r   r   r   r)   r*   r)   r   )r.   r/   r0   r1   r   r   r   r   r  r  r   r3   r   r   r   r   ?  s,    J &&'0r   r   c                       e Zd ZU dZdZded<   	 d	 	 	 	 	 	 	 	 	 d fdZddZddZddZ	dd	Z
dd
Zdd fdZ	 	 	 	 	 	 	 	 	 	 ddZ xZS )BackgroundBlockCachea  
    Cache holding memory as a set of blocks with pre-loading of
    the next block in the background.

    Requests are only ever made ``blocksize`` at a time, and are
    stored in an LRU cache. The least recently accessed block is
    discarded when more than ``maxblocks`` are stored. If the
    next block is not in cache, it is loaded in a separate thread
    in non-blocking way.

    Parameters
    ----------
    blocksize : int
        The number of bytes to store in each block.
        Requests are only ever made for ``blocksize``, so this
        should balance the overhead of making a request against
        the granularity of the blocks.
    fetcher : Callable
    size : int
        The total size of the file being cached.
    maxblocks : int
        The maximum number of blocks to cache for. The maximum memory
        use for this cache is then ``blocksize * maxblocks``.
    
backgroundr   r   c                   t         |   |||       t        j                  ||z        | _        || _        t        | j                  |      | _        t        d      | _
        d | _        d | _        t        j                         | _        y )Nr@   max_workers)r8   r   r   r   r   r   r   r   r   r   _thread_executor_fetch_future_block_number_fetch_futurer   r   _fetch_future_lockr   s        r   r   zBackgroundBlockCache.__init__  ss     	GT2yy	!12"#/0A0A9#M  2q A6:'37"+.."2r   c                V    d| j                    d| j                   d| j                   dS )Nz <BackgroundBlockCache blocksize=r   r   r   r   r   s    r   r   zBackgroundBlockCache.__repr__  s2    .t~~.> ?II;ja9	
r   c                6    | j                   j                         S r   r   r   s    r   r   zBackgroundBlockCache.cache_info  r   r   c                <    | j                   }|d= |d= |d= |d= |d= |S )Nr   r  r  r  r  r   r`   s     r   rb   z!BackgroundBlockCache.__getstate__  s<    '($%.//"&'r   c                    | j                   j                  |       t        | j                  |d         | _        t        d      | _        d | _        d | _        t        j                         | _        y )Nr   r@   r  )r^   rd   r   r   r   r   r  r  r  r   r   r  r`   s     r   re   z!BackgroundBlockCache.__setstate__  sZ    U##/0A0A5CU#V  2q A*.'!"+.."2r   c                   |d}|| j                   }|| j                   k\  s||k\  ry|| j                  z  }|| j                  z  }d }d }| j                  5  | j                  | j                  J | j                  j                         rbt        j                  d       | j                  j                  | j                  j                         | j                         d | _        d | _        nKt        || j                  cxk  xr |k  nc       }|r&| j                  }| j                  }d | _        d | _        d d d        |?t        j                  d       | j                  j                  |j                         |       t        ||dz         D ]  }| j                  |        |dz   }	| j                  5  | j                  ]|	| j                  k  rN| j                  j                  |	      s3|	| _        | j                  j!                  | j"                  |	d      | _        d d d        | j%                  ||||      S # 1 sw Y   xY w# 1 sw Y   +xY w)Nr   r   z3BlockCache joined background fetch without waiting.z(BlockCache waiting for background fetch.r@   asyncr   )r   r   r  r  r  donerP   r   r   r  r   r   rR   r   r  r  submitr   r   )
r   r#   rV   r   r   fetch_future_block_numberfetch_future	must_joinr   end_block_plus_1s
             r   r%   zBackgroundBlockCache._fetch  s^   =E;))CDII# #dnn4$..0$(!$$ 	2!!-66BBB%%**,KK UV,,44**113T5T5T 7;D3)-D& !%*::,+,!I
 ! 594S4S1'+'9'9 ;?7-1*7	2< #KKBC$$,,##%'@
 ""46F6JK 	3L$$\2	3
 ,a/$$ 		""*$400>>?OP2B/%)%:%:%A%A%%'7&"		 1-	   
 	
o	2 	2X		 		s   C"H>7A*I>IIc                    || j                   kD  rt        d| d| j                    d      || j                  z  }|| j                  z   }t        j	                  d||       t
        |   ||      }|S )r   r   r   r   z!BlockCache fetching block (%s) %dr   )r   r   log_infor#   rV   r   r>   s         r   r   z!BackgroundBlockCache._fetch_block  s     $,,&  /))-a9 
 t~~-dnn$7<Ps3r   c                   || j                   z  }|| j                   z  }||k(  r| j                  |      }||| S g }|j                  | j                  |      |d        t        |dz   |      D ]"  }	|j                  | j                  |	             $ |j                  | j                  |      d|        dj	                  |      S r   r   r   s
             r   r   z BackgroundBlockCache._read_cache"  s     DNN*	&!11,,-?@E7++ CJJt//0BCIJOP
 !&&81&<>N O C

433LABC JJt//0@A(7KL88C= r   r   r   r   r  rg   )r)   r*   rf   )sync)r   r'   r  r   r)   r-   r   )r.   r/   r0   r1   r   r2   r   r   r   rb   re   r%   r   r   rj   rk   s   @r   r  r  {  s    2 'D-& MO33'.3693FI3	3
	53J
X "!"!""!8;"!OR"!	"!r   r  z!dict[str | None, type[BaseCache]]cachesc                r    | j                   }|s |t        v rt        d|dt        |          | t        |<   y)z'Register' cache implementation.

    Parameters
    ----------
    clobber: bool, optional
        If set to True (default is False) - allow to overwrite existing
        entry.

    Raises
    ------
    ValueError
    zCache with name z is already known: N)r   r!  r   )clsclobberr   s      r   register_cacher%  M  s=     88Dtv~+D83Fvd|nUVVF4Lr   )F)r#  ztype[BaseCache]r$  r   r)   r*   )-
__future__r   r   r   loggingr   rD   r   r   concurrent.futuresr   r   typingr   r   r   r	   r
   r   r   r   r6   typing_extensionsr   r   r   	getLoggerrP   r'   r-   r(   r   r5   rm   rw   r~   r   r   r   r   r  r!  r2   r%  cr3   r   r   <module>r-     s_   "     	   9	 	 	 +#AACL 
		8	$
C:u$
%) )BN&	 N&b'%Y '%T,i ,>F! F!RZ Zz%y %*_1	 _1D971a4= 9xI!9 I!\ 	)-) ( 

 A 1r   