
    Evg*                         d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ  G d	 d
e
          Z G d d          Ze j        d             ZdS )    N)Counter)Path)apps)settings)ImproperlyConfigured)cached_property)import_stringc                       e Zd ZdS )InvalidTemplateEngineErrorN)__name__
__module____qualname__     R/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/django/template/utils.pyr   r      s        Dr   r   c                   >    e Zd ZddZed             Zd Zd Zd ZdS )EngineHandlerNc                 "    || _         i | _        dS )z|
        templates is an optional list of template engine definitions
        (structured like settings.TEMPLATES).
        N)
_templates_engines)self	templatess     r   __init__zEngineHandler.__init__   s    
 $r   c                 L   | j         t          j        | _         i }g }| j         D ]}	 |d                             dd          d         }nF# t          $ r9 |                    dd          }t          d                    |                    w xY w|g di d|}|||d	         <   |                    |d	                    t          |          }d
 |
                                D             }|r5t          d                    d                    |                              |S )NBACKEND.   z<not defined>zHInvalid BACKEND for a template engine: {}. Check your TEMPLATES setting.F)NAMEDIRSAPP_DIRSOPTIONSr   c                 $    g | ]\  }}|d k    |S )   r   ).0aliascounts      r   
<listcomp>z+EngineHandler.templates.<locals>.<listcomp>8   s"    RRRuPQ		e			r   zoTemplate engine aliases aren't unique, duplicates: {}. Set a unique NAME for each engine in settings.TEMPLATES.z, )r   r   	TEMPLATESrsplit	Exceptiongetr   formatappendr   most_commonjoin)r   r   backend_namestpldefault_nameinvalid_backendcounts
duplicatess           r   r   zEngineHandler.templates   sk   ?"&0DO	? 	. 	.C	  #9~44S!<<R@   "%'')_"E"E*..4f_.E.E   %!	 
 C &)Ic&k"  V----''RR0B0B0D0DRRR
 	&KKQ6IIj))L L   s   "A

ABc                 Z   	 | j         |         S # t          $ r 	 | j        |         }n0# t          $ r# t          d                    |                    w xY w|                                }|                    d          }t          |          } ||          }|| j         |<   |cY S w xY w)Nz4Could not find config for '{}' in settings.TEMPLATESr   )r   KeyErrorr   r   r-   copypopr	   )r   r&   paramsbackend
engine_clsengines         r   __getitem__zEngineHandler.__getitem__C   s    	='' 	 	 	.   0,,2F5MM   [[]]Fjj++G&w//JZ''F#)DM% MMM%	s$    
B*(B*-AAB*)B*c                 *    t          | j                  S N)iterr   r   s    r   __iter__zEngineHandler.__iter__Z   s    DN###r   c                        fd D             S )Nc                      g | ]
}|         S r   r   )r%   r&   r   s     r   r(   z%EngineHandler.all.<locals>.<listcomp>^   s    ...U...r   r   rC   s   `r   allzEngineHandler.all]   s    ........r   rA   )	r   r   r   r   r   r   r?   rD   rG   r   r   r   r   r      sq            ' ' _'R  .$ $ $/ / / / /r   r   c                 `      fdt          j                    D             }t          |          S )z
    Return an iterable of paths of directories to load app templates from.

    dirname is the name of the subdirectory containing templates inside
    installed applications.
    c                     g | ]I}|j         	t          |j                   z                                  2t          |j                   z  JS r   )pathr   is_dir)r%   
app_configdirnames     r   r(   z)get_app_template_dirs.<locals>.<listcomp>i   se       ? !%Z_ 5 5 ?GGIIZ_'  r   )r   get_app_configstuple)rM   template_dirss   ` r   get_app_template_dirsrQ   a   sD       .00  M r   )	functoolscollectionsr   pathlibr   django.appsr   django.confr   django.core.exceptionsr   django.utils.functionalr   django.utils.module_loadingr	   r   r   	lru_cacherQ   r   r   r   <module>r[      s                                     7 7 7 7 7 7 3 3 3 3 3 3 5 5 5 5 5 5	 	 	 	 	!5 	 	 	N/ N/ N/ N/ N/ N/ N/ N/b          r   