o �J�h\��@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZmZmZddlmZmZmZmZmZddlmZmZmZdZ d d �Z!Gd d �d e"�Z#d eiZ$dd�Z%d$dd�Z&dd�Z'e�(�Z)Gdd�de�Z*Gdd�de+�Z,Gdd�de+�Z-Gdd�de-�Z.Gdd�de�Z/Gdd�de/�Z0Gd d!�d!e�Z1 d%d"d#�Z2dS)&zo A context object for caching a function's return value each time it is called with the same input arguments. �N�)�hashing)� CacheWarning�FileSystemStoreBackend�StoreBackendBase)� filter_args� format_call�format_signature� get_func_code� get_func_name)�Logger� format_time�pformatz # first line:cCsR|�t�r#|�d�}t|dtt�d��}d�|dd��}||fSd}||fS)zUExtract the first line information from the function code text if available. � rNr�����)� startswith�FIRST_LINE_TEXT�split�int�len�join)� func_code� first_line�r�KC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\joblib\memory.py�extract_first_line9s  �rc@seZdZdZdS)�JobLibCollisionWarningz@Warn that there might be a collision between names of functions.N)�__name__� __module__� __qualname__�__doc__rrrrrFsr�localcCsDt|t�s td�|���|dust|t�std�|���|t|<dS)a�Extend available store backends. The Memory, MemorizeResult and MemorizeFunc objects are designed to be agnostic to the type of store used behind. By default, the local file system is used but this function gives the possibility to extend joblib's memory pattern with other types of storage such as cloud storage (S3, GCS, OpenStack, HadoopFS, etc) or blob DBs. Parameters ---------- backend_name: str The name identifying the store backend being registered. For example, 'local' is used with FileSystemStoreBackend. backend: StoreBackendBase subclass The name of a class that implements the StoreBackendBase interface. z3Store backend name should be a string, '{0}' given.Nz;Store backend should inherit StoreBackendBase, '{0}' given.)� isinstance�str� ValueError�format� issubclassr�_STORE_BACKENDS)� backend_name�backendrrr�register_store_backendMs ��� r*cCs�|duri}t|tj�rt|�}t|t�r|St|t�rJd}tj�|�}t� �D] \}}||kr3|�}q(|dur@t d� ||���|j |||d�|S|durYt �d� |jj�t�dS)z7Return the correct store object for the given location.Nz#Unknown location {0} or backend {1}��verbose�backend_optionszdInstantiating a backend using a {} as a location is not supported by joblib. Returning None instead.)r"�pathlib�Pathr#r�os�path� expanduserr'�items� TypeErrorr%� configure�warnings�warn� __class__r� UserWarning)r)�locationr,r-�objZ backend_keyZ backend_objrrr�_store_backend_factoryms8    � ���r<cCs"t|�\}}tjjg|�|�R�S)z:Build a roughly unique identifier for the cached function.)r r0r1r)�func�modules�funcnamerrr�_build_func_identifier�s r@c@sheZdZdZ     ddd�Zedd��Zed d ��Zed d ��Zd d�Z dd�Z dd�Z dd�Z dS)�MemorizedResultalObject representing a cached value. Attributes ---------- location: str The location of joblib cache. Depends on the store backend used. func: function or str function whose output is cached. The string case is intended only for instantiation based on the output of repr() on another instance. (namely eval(repr(memorized_instance)) works). argument_hash: str hash of the function arguments. backend: str Type of store backend for reading/writing cache files. Default is 'local'. mmap_mode: {None, 'r+', 'r', 'w+', 'c'} The memmapping mode used when loading from cache numpy arrays. See numpy.load for the meaning of the different values. verbose: int verbosity level (0 means no message). timestamp, metadata: string for internal use only. r!NrcCsft�|�||_t|||d�|_||_|dur||_n|j�|j�|_|j�dd�|_ ||_ ||_ dS)N�r,�duration) r �__init__�_call_idr<� store_backend� mmap_mode�metadata� get_metadata�getrCr,� timestamp)�selfr:�call_idr)rGr,rKrHrrrrD�s  zMemorizedResult.__init__cCs|jS�N)�func_id�rLrrrr=�szMemorizedResult.funccC� |jdS�Nr�rErPrrrrO�� zMemorizedResult.func_idcCrQ)NrrSrPrrr�args_id�rTzMemorizedResult.args_idc Csbz|jj|j|j|j|jd�WSty0}ztd�t j j |jj g|j�R���}||�d}~ww)z$Read value from cache and return it.)rKrHr,zaError while trying to load a MemorizedResult's value. It seems that this folder is corrupted : {}N) rF� load_itemrErKrHr,r$�KeyErrorr%r0r1rr:)rL�exc�new_excrrrrJ�s"�����zMemorizedResult.getcCs|j�|j�dS)zClear value from cacheN)rF� clear_itemrErPrrr�clear�szMemorizedResult.clearcCsdj|jj|jjg|j�R�S)Nz*{}(location="{}", func="{}", args_id="{}"))r%r8rrFr:rErPrrr�__repr__s  ��zMemorizedResult.__repr__cCs|j��}d|d<|S)NrK��__dict__�copy�rL�staterrr� __getstate__s zMemorizedResult.__getstate__)r!NrNN) rrrr rD�propertyr=rOrUrJr[r\rbrrrrrA�s$" �    rAc@sDeZdZdZdZdd�Zdd�Zdd�Zd d �Zd d �Z d d�Z dS)�NotMemorizedResultzxClass representing an arbitrary value. This class is a replacement for MemorizedResult when there is no cache. ��value�validcCs||_d|_dS)NTre)rLrfrrrrD� zNotMemorizedResult.__init__cCs|jr|jStd��)NzNo value stored.)rgrfrWrPrrrrJszNotMemorizedResult.getcCsd|_d|_dS�NF�rgrfrPrrrr[rhzNotMemorizedResult.clearcCs*|jrdj|jjt|j�d�S|jjdS)Nz{class_name}({value}))� class_namerfz with no value)rgr%r8rrrfrPrrrr\!s � zNotMemorizedResult.__repr__cCs|j|jd�S)NrjrjrPrrrrb*szNotMemorizedResult.__getstate__cCs|d|_|d|_dS)Nrgrfrjr`rrr� __setstate__-s zNotMemorizedResult.__setstate__N) rrrr � __slots__rDrJr[r\rbrlrrrrrd s rdc@sJeZdZdZdd�Zdd�Zdd�Zdd �Zdd d �Zd d�Z dd�Z dS)�NotMemorizedFuncaNo-op object decorating a function. This class replaces MemorizedFunc when there is no cache. It provides an identical API but does not write anything on disk. Attributes ---------- func: callable Original undecorated function. cCs ||_dSrN�r=)rLr=rrrrDBs zNotMemorizedFunc.__init__cOs|j|i|��SrNro�rL�args�kwargsrrr�__call__EszNotMemorizedFunc.__call__cOst|j|i|���SrN�rdr=rprrr�call_and_shelveH�z NotMemorizedFunc.call_and_shelvecCsd�|jj|j�S)Nz {0}(func={1}))r%r8rr=rPrrrr\KszNotMemorizedFunc.__repr__TcCsdSrNr�rLr7rrrr[NszNotMemorizedFunc.clearcOs|j|i|��ifSrNrorprrr�callRrvzNotMemorizedFunc.callcOsdSrirrprrr�check_call_in_cacheUsz$NotMemorizedFunc.check_call_in_cacheN�T) rrrr rDrsrur\r[rxryrrrrrn5s   rnc@seZdZdd�ZdS)�AsyncNotMemorizedFuncc�s�t|j|i|��IdH�SrNrtrprrrru]s�z%AsyncNotMemorizedFunc.call_and_shelveN)rrrrurrrrr{\s r{c@s�eZdZdZ       d6dd�Zdd �Zd d �Zed d ��Zdd�Z dd�Z dd�Z dd�Z dd�Z dd�Zdd�Zd7dd�Zd8d d!�Zd"d#�Zd9d$d%�Zd&d'�Zd(d)�Zd:d+d,�Zd;d-d.�Zd;d/d0�Zd<d2d3�Zd4d5�ZdS)=� MemorizedFuncajCallable object decorating a function for caching its return value each time it is called. Methods are provided to inspect the cache or clean it. Attributes ---------- func: callable The original, undecorated, function. location: string The location of joblib cache. Depends on the store backend used. backend: str Type of store backend for reading/writing cache files. Default is 'local', in which case the location is the path to a disk storage. ignore: list or None List of variable names to ignore when choosing whether to recompute. mmap_mode: {None, 'r+', 'r', 'w+', 'c'} The memmapping mode used when loading from cache numpy arrays. See numpy.load for the meaning of the different values. compress: boolean, or integer Whether to zip the stored data on disk. If an integer is given, it should be between 1 and 9, and sets the amount of compression. Note that compressed arrays cannot be read by memmapping. verbose: int, optional The verbosity flag, controls messages that are issued as the function is evaluated. cache_validation_callback: callable, optional Callable to check if a result in cache is valid or is to be recomputed. When the function is called with arguments for which a cache exists, the callback is called with the cache entry's metadata as its sole argument. If it returns True, the cached result is returned, else the cache for these arguments is cleared and the result is recomputed. r!NFrc Cst�|�||_||_||_| |_t|�|_|dur|ng|_||_ t |||t ||d�d�|_ |j dur<|j � |jg�|durB|nt��|_zt�||�Wn tyXYnwt�|�rtt���|�} | �ddd�} t�dd| �} n|j} d| |_d|_d|_dS) N��compressrGr+rz rz.�zMemoized version of %s)r rDrGr~r=�cache_validation_callbackr@rO�ignore�_verboser<�dictrF�store_cached_func_code�timerK� functools�update_wrapper� Exception�inspect� isfunction�pydoc�TextDoc�document�replace�re�subr �_func_code_info� _func_code_id) rLr=r:r)r�rGr~r,rKr��docrrrrD�s<   �  �   zMemorizedFunc.__init__cCsT|jdd�sdS|j�|�sdS|j�|�}|jdur(|�|�s(|j�|�dSdS)a�Check if the function call is cached and valid for given arguments. - Compare the function code with the one from the cached function, asserting if it has changed. - Check if the function call is present in the cache. - Call `cache_validation_callback` for user define cache validation. Returns True if the function call is in cache and can be used, and returns False otherwise. ��� stacklevelFNT)�_check_previous_func_coderF� contains_itemrIr�rZ�rLrMrHrrr�_is_in_cache_and_valid�s    � z$MemorizedFunc._is_in_cache_and_validc Csr|j|i|��}|j|f}t|j�\}}|j�|jg�}|d} |jdkrOtjtj d�t |jg|�Ri|��\}} |� t � d|�d| �d|�d| �d� ��|�|�r�|r]|�|�ifSzt��} |�|�} |jd krw|jt��| d d �| ifWSty�t |jg|�Ri|��\}} |�d �| t����Ynw|jd kr�|�d|�d|�d| ���|�||||�S)a�Call wrapped function and cache result, or read cache if available. This function returns the wrapped function output or a reference to the cached result. Arguments: ---------- args, kwargs: list and dict input arguments for wrapped function shelving: bool True when called via the call_and_shelve function. Returns ------- output: Output of the wrapped function if shelving is false, or a MemorizedResult reference to the value if shelving is true. metadata: dict containing the metadata associated with the call. r:�)�levelz" Querying z( with signature z*. (argument hash z1) The store location is z. r�z cache loaded )�contextz*Exception while loading results for {} {}� zComputing func z, argument hash z in location )� _get_args_idrOr r=rF�get_cached_func_infor��logging� basicConfig�INFOr �info�textwrap�dedentr��_get_memorized_resultr�� _load_item�_print_durationr�r7r%� traceback� format_exc�_call) rLrqrr�shelvingrUrM�_� func_nameZ func_infor:� signature� start_time�outputrrr� _cached_call�s^  ������    �  ��� ��zMemorizedFunc._cached_callcCsZt|jd�r|jdurt|jj�|_n t|jj�|jkrd|_|jdur*t|j�|_|jS)N�__code__)�hasattrr=r��idr�r�r rPrrr�func_code_info4s    zMemorizedFunc.func_code_infocO�|j||dd�dS)a\Call wrapped function, cache result and return a reference. This method returns a reference to the cached result instead of the result itself. The reference object is small and picklable, allowing to send or store it easily. Call .get() on reference object to get result. Returns ------- cached_result: MemorizedResult or NotMemorizedResult reference to the value returned by the wrapped function. The class "NotMemorizedResult" is used when there is no cache activated (e.g. location=None in Memory). T�r�r�r�rprrrruKszMemorizedFunc.call_and_shelvecOr��NFr�rr�rprrrrs]szMemorizedFunc.__call__cCs$|j}|j��}d|d<d|d<|S)NrKr�)r�r^r_)rLr�rarrrrbas  zMemorizedFunc.__getstate__cOs |j|j|i|��f}|�|�S)aACheck if the function call is cached and valid for given arguments. Does not call the function or do any work besides function inspection and argument hashing. - Compare the function code with the one from the cached function, asserting if it has changed. - Check if the function call is present in the cache. - Call `cache_validation_callback` for user define cache validation. Returns ------- is_call_in_cache: bool Whether or not the function call is in cache and can be used. )rOr�r��rLrqrrrMrrrryqs z!MemorizedFunc.check_call_in_cachecOs"tjt|j|j||�|jdud�S)z,Return the input parameter hash of a result.N)� coerce_mmap)r�hashrr=r�rGrprrrr��s�zMemorizedFunc._get_args_idcCs(tt|jdd��}t|j�t|j�|fS)z'Hash a function to key the online cacher�N)r��getattrr=r�)rLZ func_code_hrrr� _hash_func�szMemorizedFunc._hash_funccCsndt||f}|j�|jg|�t|jd�o|jjdk}|r5|��}z|t|j<WdSt y4YdSwdS)z3Write the function code and the filename to a file.z%s %i %sr�<lambda>N) rrFr�rOr�r=rr��_FUNCTION_HASHESr4)rLrrZis_named_callable� func_hashrrr�_write_func_code�s� ��zMemorizedFunc._write_func_code�c Csz|jtvr|��}|t|jkrWdSWn tyYnw|j\}}}zt|j�|jg��\}}Wnt t fyE|� ||�YdSw||krLdSt |jddd�\}} ||kr`dksen| dkr|dksqd� | ||�} n| } tjtd� | ��|d�||ks�|d ur�tj�|�r�t |jdd �\}} t|�d ��} t�|��} | ��|d |d | d �} Wd �n1s�wYd �| �} | ��|��k}n|�d�}|r�tjtd| ||| ||f�|d�|jdk�rt |jdd �\}} |�d� | |j��|jdd�dS)zx stacklevel is the depth a which this function is called, to issue useful warnings to the user. TF)� resolv_aliasZwin_charactersrr�z {0} ({1}:{2})z0Cannot detect name collisions for function '{0}'r�N)r�rrrz <doctest zHPossible name collisions between functions '%s' (%s:%i) and '%s' (%s:%i)r�z-Function {0} (identified by {1}) has changed.)r7)r=r�r�r4r�rrF�get_cached_func_coderO�IOError�OSErrorr�r r%r6r7rr0r1�existsrr�tokenize�open� readlinesr�rstriprr�r[)rLr�r�r� source_filerZ old_func_codeZold_first_liner�r�Zfunc_description� num_lines�fZon_disk_func_codeZpossible_collisionrrrr��s� � �  � � �����  �� � ��� � �� z'MemorizedFunc._check_previous_func_codeTcCsL|j}|jdkr|r|�d|�|j�|g�|j\}}}|�||�dS)zEmpty the function's cache.rz(Clearing function cache identified by %sN)rOr�r7rF� clear_pathr�r�)rLr7rOrr�rrrrr[s�� zMemorizedFunc.clearcOs$|j|j|i|��f}|�|||�S)aForce the execution of the function with the given arguments. The output values will be persisted, i.e., the cache will be updated with any new values. Parameters ---------- *args: arguments The arguments. **kwargs: keyword arguments Keyword arguments. Returns ------- output : object The output of the function call. metadata : dict The metadata associated with the call. )rOr�r�r�rrrrx#szMemorizedFunc.callcCs8|�||�t��}|j|i|��}|�||||||�SrN�� _before_callr�r=� _after_call�rLrMrqrrr�r�r�rrrr�<s zMemorizedFunc._callcCs$|jdkrtt|j||��dSdSrR)r��printrr=rprrrr�Cs �zMemorizedFunc._before_callc Csv|jj|||jd�t��|}|jdkr|�|�|�||||�}|r,|�||�|fS|jdur7|�||�}||fS)NrBr) rF� dump_itemr�r�r��_persist_inputr�rGr�) rLrMrqrrr�r�r�rCrHrrrr�Gs     zMemorizedFunc._after_call��?c Cstt��}t|j|j||�}tdd�|��D��}|||d�} |j�|| �t��|} | |kr8tj d| dd�| S)a�Save a small summary of the call using json format in the output directory. output_dir: string directory where to write metadata. duration: float time taken by hashing input arguments, calling the wrapped function and persisting its output. args, kwargs: list and dict input arguments for wrapped function this_duration_limit: float Max execution time for this function before issuing a warning. css �|] \}}|t|�fVqdSrN)�repr)�.0�k�vrrr� <genexpr>js�z/MemorizedFunc._persist_input.<locals>.<genexpr>)rC� input_argsr�z�Persisting input arguments took %.2fs to run.If this happens often in your code, it can cause performance problems (results will be correct in all cases). The reason for this is probably some large input arguments for a wrapped function.�r�) r�rr=r�r�r3rF�store_metadatar6r7) rLrCrMrqrrZthis_duration_limitr�Z argument_dictZ input_reprrHZ this_durationrrrr�Vs"� �� zMemorizedFunc._persist_inputcCst|j|||j|jdd�S)Nr�rHrKr,)rArFrKr�r�rrrr��s�z#MemorizedFunc._get_memorized_resultcCs|jj|||j|jd�S)Nr�)rFrVrKr�r�rrrr��s �zMemorizedFunc._load_itemrcCsHt|j�\}}|�d|�dt|���}ttddt|��d|�dS)N� z- r�Pr�)r r=r r��maxr)rLrCr�r��name�msgrrrr��s"zMemorizedFunc._print_durationcCsdj|jj|j|jjd�S)Nz.{class_name}(func={func}, location={location}))rkr=r:)r%r8rr=rFr:rPrrrr\�s �zMemorizedFunc.__repr__)r!NNFrNN)r�rz�F)r�rN)r)rrrr rDr�r�rcr�rursrbryr�r�r�r�r[rxr�r�r�r�r�r�r�r\rrrrr|ds@5 �3M   i   2  r|cs6eZdZdd�Zdd�Z�fdd�Zd dd �Z�ZS) �AsyncMemorizedFuncc��2�|j||dd�}t�|�r|IdHn|}|dSr��r��asyncio� iscoroutine�rLrqrr�outrrrrs���zAsyncMemorizedFunc.__call__c�r�)NTr�rr�r�rrrru�r�z"AsyncMemorizedFunc.call_and_shelvec�s,�t�j|i|��}t�|�r|IdHS|SrN)�superrxr�r�r��r8rrrx�s�zAsyncMemorizedFunc.callFc�s@�|�||�t��}|j|i|��IdH}|�||||||�SrNr�r�rrrr��s � zAsyncMemorizedFunc._callr�)rrrrsrurxr�� __classcell__rrr�rr��s  r�c@sfeZdZdZ      ddd�Z     ddd �Zdd d �Zdd d�Zdd�Zdd�Z dd�Z dS)�Memorya�A context object for caching a function's return value each time it is called with the same input arguments. All values are cached on the filesystem, in a deep directory structure. Read more in the :ref:`User Guide <memory>`. Parameters ---------- location: str, pathlib.Path or None The path of the base directory to use as a data store or None. If None is given, no caching is done and the Memory object is completely transparent. This option replaces cachedir since version 0.12. backend: str, optional, default='local' Type of store backend for reading/writing cache files. The 'local' backend is using regular filesystem operations to manipulate data (open, mv, etc) in the backend. mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional The memmapping mode used when loading from cache numpy arrays. See numpy.load for the meaning of the arguments. compress: boolean, or integer, optional Whether to zip the stored data on disk. If an integer is given, it should be between 1 and 9, and sets the amount of compression. Note that compressed arrays cannot be read by memmapping. verbose: int, optional Verbosity flag, controls the debug messages that are issued as functions are evaluated. backend_options: dict, optional Contains a dictionary of named parameters used to configure the store backend. Nr!Frc Cs�t�|�||_||_t��|_||_||_|duri}||_|r,|dur,t j ddd�||_ t |t �r;tj�|d�}t|||jtd||d�|��d�|_dS)Nz&Compressed results cannot be memmappedr�r��joblibr}r+r)r rDr�rGr�rKr)r~r-r6r7r:r"r#r0r1rr<r�rF)rLr:r)rGr~r,r-rrrrD�s0    �� �zMemory.__init__c Cs�|durt|�std|�d���|durtj|j||||d�S|jdur1t�|�r+tnt }||�S|dur8|j }|dur?|j }t |t �rG|j}t�|�rNtnt }|||j|j|||j||j|d� S)a�Decorates the given function func to only compute its return value for input arguments not cached on disk. Parameters ---------- func: callable, optional The function to be decorated ignore: list of strings A list of arguments name to ignore in the hashing verbose: integer, optional The verbosity mode of the function. By default that of the memory object is used. mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional The memmapping mode used when loading from cache numpy arrays. See numpy.load for the meaning of the arguments. By default that of the memory object is used. cache_validation_callback: callable, optional Callable to validate whether or not the cache is valid. When the cached function is called with arguments for which a cache exists, this callable is called with the metadata of the cached result as its sole argument. If it returns True, then the cached result is returned, else the cache for these arguments is cleared and recomputed. Returns ------- decorated_func: MemorizedFunc object The returned object is a MemorizedFunc object, that is callable (behaves like a function), but offers extra methods for cache lookup and management. See the documentation for :class:`joblib.memory.MemorizedFunc`. Nz4cache_validation_callback needs to be callable. Got �.)r�rGr,r�F)r:r)r�rGr~r,rKr�)�callabler$r��partial�cacherFr��iscoroutinefunctionr{rnr�rGr"r|r=r�r)r~rK)rLr=r�r,rGr��clsrrrr�sP (���� �� �z Memory.cacheTcCs2|r|�d�|jdur|j��t��dSdS)z#Erase the complete cache directory.zFlushing completely the cacheN)r7rFr[r�rwrrrr[gs     �z Memory.clearcCs>|jdurdS|dur|dur|durdS|j�|||�dS)aORemove cache elements to make the cache fit its limits. The limitation can impose that the cache size fits in ``bytes_limit``, that the number of cache items is no more than ``items_limit``, and that all files in cache are not older than ``age_limit``. Parameters ---------- bytes_limit: int | str, optional Limit in bytes of the size of the cache. By default, the size of the cache is unlimited. When reducing the size of the cache, ``joblib`` keeps the most recently accessed items first. If a str is passed, it is converted to a number of bytes using units { K | M | G} for kilo, mega, giga. items_limit: int, optional Number of items to limit the cache to. By default, the number of items in the cache is unlimited. When reducing the size of the cache, ``joblib`` keeps the most recently accessed items first. age_limit: datetime.timedelta, optional Maximum age of items to limit the cache to. When reducing the size of the cache, any items last accessed more than the given length of time ago are deleted. Example: to remove files older than 5 days, use datetime.timedelta(days=5). Negative timedelta are not accepted. N)rF�enforce_store_limits)rL� bytes_limit� items_limit� age_limitrrr� reduce_sizets zMemory.reduce_sizecOs,|jdur ||i|��S|�|�|i|��S)z�Eval function func with arguments `*args` and `**kwargs`, in the context of the memory. This method works similarly to the builtin `apply`, except that the function is called only if the cache is not up to date. N)rFr�)rLr=rqrrrrr�eval�s z Memory.evalcCs(dj|jj|jdurdd�S|jjd�S)Nz!{class_name}(location={location}))rkr:)r%r8rrFr:rPrrrr\�s  ��zMemory.__repr__cCs|j��}d|d<|S)zaWe don't store the timestamp when pickling, to avoid the hash depending from it. NrKr]r`rrrrb�s zMemory.__getstate__)Nr!NFrN)NNNFNrz)NNN) rrrr rDr�r[rrr\rbrrrrr��s(/ �% � S ' r�c s(tj|||||||d���fdd�}|S)z�Helper cache_validation_callback to force recompute after a duration. Parameters ---------- days, seconds, microseconds, milliseconds, minutes, hours, weeks: numbers argument passed to a timedelta. )�days�seconds� microseconds� milliseconds�minutes�hours�weekscst��|d}|���kS)Nr�)r�� total_seconds)rHZcomputation_age��deltarrr��s z0expires_after.<locals>.cache_validation_callback)�datetime� timedelta)rrrrrrr r�rr r� expires_after�s � r)rN)rrrrrrr)3r r�r r�r�r�r0r.r�r�r�r�r�r�r6�weakrefrr�_store_backendsrrrZ func_inspectrrr r r �loggerr r rrrr9rr'r*r<r@�WeakKeyDictionaryr�rA�objectrdrnr{r|r�r�rrrrr�<module>sV    + d*'J�
Memory