o
    &Zc™  ã                   @   sh   d dl Z d dlmZ ddlmZ ddlmZ G dd„ deƒZG dd	„ d	eƒZ	G d
d„ deƒZ
dd„ ZdS )é    N)Ú
LazyObjecté   )Ú
force_text)Úget_singletonc                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )Ú
JustInTimezL
    A strategy that ensures the file exists right before it's needed.

    c                 C   ó   |  ¡  d S ©N©Úgenerate©ÚselfÚfile© r   úS/var/www/jaguar/venv/lib/python3.10/site-packages/imagekit/cachefiles/strategies.pyÚon_existence_required   ó   z JustInTime.on_existence_requiredc                 C   r   r	   r
   r   r   r   r   Úon_content_required   r   zJustInTime.on_content_requiredN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    r   c                   @   r   )Ú
OptimisticzÈ
    A strategy that acts immediately when the source file changes and assumes
    that the cache files will not be removed (i.e. it doesn't ensure the
    cache file exists when it's accessed).

    c                 C   r   r	   r
   r   r   r   r   Úon_source_saved   r   zOptimistic.on_source_savedc                 C   s   dS )NFr   r   r   r   r   Úshould_verify_existence    s   z"Optimistic.should_verify_existenceN)r   r   r   r   r   r   r   r   r   r   r      s    r   c                   @   s   e Zd Zdd„ ZdS )ÚDictStrategyc                 C   s"   |  ¡ D ]
\}}t| ||ƒ qd S r	   )ÚitemsÚsetattr)r   Ú	callbacksÚkÚvr   r   r   Ú__init__%   s   ÿzDictStrategy.__init__N)r   r   r   r!   r   r   r   r   r   $   s    r   c                 C   sB   t | tjƒrt| dƒ} | S t | tƒrt| ƒ} | S t| ƒr| ƒ } | S )Nzcache file strategy)Ú
isinstanceÚsixÚstring_typesr   Údictr   Úcallable)Ústrategyr   r   r   Úload_strategy*   s   

üþr(   )r#   Údjango.utils.functionalr   Úlibr   Úutilsr   Úobjectr   r   r   r(   r   r   r   r   Ú<module>   s    