Ë
    T]j   ã                   ó2   — d dl mZ  G d„ d«      Z e«       Zy)é    )Úsettingsc                   óJ   — e Zd ZdZdd„Zd„ Zdd„Zdd„Zdd„Zd„ Z	dd	„Z
d
„ Zy)ÚAliasesz_
    A container which stores and retrieves named easy-thumbnail options
    dictionaries.
    c                 ó8   — i | _         |r| j                  «        yy)zÏ
        Initialize the Aliases object.

        :param populate_from_settings: If ``True`` (default) then populate the
            initial aliases from settings. See :meth:`populate_from_settings`.
        N)Ú_aliasesÚpopulate_from_settings)Úselfr   s     úL/var/www/zogu/zoguvenv/lib/python3.12/site-packages/easy_thumbnails/alias.pyÚ__init__zAliases.__init__
   s   € ð ˆŒÙ!Ø×'Ñ'Õ)ð "ó    c                 ó´   — t         j                  }|rF|j                  «       D ]2  \  }}| j                  j	                  |i «      }|j                  |«       Œ4 yy)zN
        Populate the aliases from the ``THUMBNAIL_ALIASES`` setting.
        N)r   ÚTHUMBNAIL_ALIASESÚitemsr   Ú
setdefaultÚupdate)r	   Úsettings_aliasesÚtargetÚaliasesÚtarget_aliasess        r
   r   zAliases.populate_from_settings   sX   € ô $×5Ñ5ÐÙØ#3×#9Ñ#9Ó#;ò /‘�˜Ø!%§¡×!9Ñ!9¸&À"Ó!E�Ø×%Ñ% gÕ.ñ/ð r   Nc                 óp   — | j                  |«      xs d}| j                  j                  |i «      }|||<   y)a%  
        Add an alias.

        :param alias: The name of the alias to add.
        :param options: The easy-thumbnails options dictonary for this alias
            (should include ``size``).
        :param target: A field, model, or app to limit this alias to
            (optional).
        Ú N)Ú_coerce_targetr   r   )r	   ÚaliasÚoptionsr   r   s        r
   ÚsetzAliases.set   s9   € ð ×$Ñ$ VÓ,Ò2°ˆØŸ™×1Ñ1°&¸"Ó=ˆØ 'ˆ�uÒr   c                 ó„   — t        t        | j                  |«      «      «      D ]  }| j                  ||«      }|sŒ|c S  y)zî
        Get a dictionary of aliased options.

        :param alias: The name of the aliased options.
        :param target: Get alias for this specific target (optional).

        If no matching alias is found, returns ``None``.
        N)ÚreversedÚlistÚ_get_targetsÚ_get)r	   r   r   Útarget_partr   s        r
   ÚgetzAliases.get-   s@   € ô $¤D¨×):Ñ):¸6Ó)BÓ$CÓDò 	ˆKØ—i‘i ¨UÓ3ˆGÚØ’ñ	r   c                 óŽ   — i }| j                  ||«      D ]-  }|j                  | j                  j                  |i «      «       Œ/ |S )a©  
        Get a dictionary of all aliases and their options.

        :param target: Include aliases for this specific field, model or app
            (optional).
        :param include_global: Include all non target-specific aliases
            (default ``True``).

        For example::

            >>> aliases.all(target='my_app.MyModel')
            {'small': {'size': (100, 100)}, 'large': {'size': (400, 400)}}
        )r   r   r   r"   )r	   r   Úinclude_globalr   r!   s        r
   ÚallzAliases.all;   sG   € ð ˆØ×,Ñ,¨V°^ÓDò 	?ˆKØ�N‰N˜4Ÿ=™=×,Ñ,¨[¸"Ó=Õ>ð	?àˆr   c                 ó\   — || j                   vry| j                   |   j                  |«      S )z:
        Internal method to get a specific alias.
        N)r   r"   )r	   r   r   s      r
   r    zAliases._getN   s-   € ð ˜Ÿ™Ñ&ØØ�}‰}˜VÑ$×(Ñ(¨Ó/Ð/r   c              #   óÆ   K  — | j                  |«      }|rd–— |sy|j                  d«      }t        t        |«      «      D ]  }dj	                  |d|dz    «      –— Œ y­w)a  
        Internal iterator to split up a complete target into the possible parts
        it may match.

        For example::

            >>> list(aliases._get_targets('my_app.MyModel.somefield'))
            ['', 'my_app', 'my_app.MyModel', 'my_app.MyModel.somefield']
        r   Nú.é   )r   ÚsplitÚrangeÚlenÚjoin)r	   r   r$   Útarget_bitsÚis        r
   r   zAliases._get_targetsV   sg   è ø€ ð ×$Ñ$ VÓ,ˆÙØŠHÙØØ—l‘l 3Ó'ˆÜ”s˜;Ó'Ó(ò 	0ˆAØ—(‘(˜; v¨¨A©Ð.Ó/Ó/ñ	0ùs   ‚AA!c                 óè   — |rt        |t        «      r|S t        |d«      sy|j                  j                  }|j
                  j                  ›d|j                  ›d|j                  j                  ›�S )z¶
        Internal method to coerce a target to a string.

        The assumption is that if it is not ``None`` and not a string, it is
        a Django ``FieldFile`` object.
        ÚinstanceNr(   )
Ú
isinstanceÚstrÚhasattrr1   Ú	__class__Ú_metaÚ	app_labelÚ__name__ÚfieldÚname)r	   r   Úmodels      r
   r   zAliases._coerce_targeti   s\   € ñ œ F¬CÔ0ØˆMÜ�v˜zÔ*ØØ—‘×)Ñ)ˆà�K‰K×!Ó!Ø�N‹NØ�L‰L×Òð
ð 	
r   )T)N)NT)r8   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r"   r%   r    r   r   © r   r
   r   r      s/   „ ñó
	*ò/ó(óóò&0ó0ó&
r   r   N)Úeasy_thumbnails.confr   r   r   r?   r   r
   ú<module>rA      s   ðÝ )÷u
ñ u
ñp ‹)�r   