
    3~hM                     >    d Z ddlZddlmZ ddlmZmZ d Zd Zd Z	y)	z
Functions responsible for returning filenames for the given image generator.
Users are free to define their own functions; these are just some some sensible
choices.

    N)settings   )format_to_extensionsuggest_extensionc                    t        | j                  dd      }|t        j                  j	                  |      rt
        j                  }nNt        j                  j                  t
        j                  t        j                  j                  |      d         }t        |xs d| j                        }t        j                  j                  t        j                  j                  || j                         |            S )a\  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/photos/thumbnails/bulldog/5ff3233527c5ac3e4b596343b440ff67.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    nameNr    )getattrsourceospathisabsr   IMAGEKIT_CACHEFILE_DIRjoinsplitextr   formatnormpathget_hash)	generatorsource_filenamedirexts       c/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/imagekit/cachefiles/namers.pysource_name_as_pathr      s     i..=O"''--"@-- ggll8::77++O<Q?A O1r93C3C
DC77BGGLL3<3E3E3G)MO P P    c           
         t        | j                  dd      }|t        j                  j	                  |      rt
        j                  }nKt        j                  j                  t
        j                  t        j                  j                  |            }t        |xs d| j                        }t        j                  j                  |      }t        j                  j                  t        j                  j                  |t        j                  j                  |      d   d| j                         dd |            S )aH  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/photos/thumbnails/bulldog.5ff3233527c5.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    r   Nr	   r   .   )r
   r   r   r   r   r   r   r   dirnamer   r   basenamer   r   r   )r   r   r   r   r    s        r   source_name_dot_hashr!   -   s     i..=O"''--"@-- ggll8::77???;= O1r93C3C
DCww0H77BGGLLGGX&q)9+=+=+?+Dc/K L M Mr   c                     t        | dd      }|rt        |      nd}t        j                  j	                  t        j                  j                  t        j                  | j                         |            S )aB  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/5ff3233527c5ac3e4b596343b440ff67.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    r   Nr	   )	r
   r   r   r   r   r   r   r   r   )r   r   r   s      r   hashr#   L   sc     Y$/F)/
f
%RC77BGGLL)H)H3<3E3E3G)MO P Pr   )
__doc__r   django.confr   utilsr   r   r   r!   r#    r   r   <module>r(      s'    
   :P<M>Pr   