
    &`i                     P    d dl Z d dlmZ d dlmZ e G d d                      ZdS )    N)List)DeveloperAPIc                   \    e Zd ZdZdefdZdefdZedee	j
                 fd            ZdS )Templatez+Class which provides basic HTML templating.filec                     t          t          j        t                    j        dz  |z  d          5 }|                                | _        d d d            d S # 1 swxY w Y   d S )N	templatesr)openpathlibPath__file__parentreadtemplate)selfr   fs      f/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/widgets/render.py__init__zTemplate.__init__   s    ',x((/+=DcJJ 	%aFFHHDM	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   AA!Areturnc                     | j         }|                                D ]O\  }}t          |t                    rd                    |          }|                    d|z   dz   |r|nd          }P|S )a  Render an HTML template with the given data.

        This is done by replacing instances of `{{ key }}` with `value`
        from the keyword arguments.

        Returns:
            HTML template with the keys of the kwargs replaced with corresponding
                values.
         z{{ z }})r   items
isinstancer   joinreplace)r   kwargsrenderedkeyvalues        r   renderzTemplate.render   sx     = ,,.. 	U 	UJC%&& '''e(;e=SUUQSTTHH    c                  j    t          j        t                    j        dz                      d          S )zList the available HTML templates.

        Returns:
            A list of files with .html.j2 extensions inside ../templates/
        r	   z	*.html.j2)r   r   r   r   glob r"   r   list_templateszTemplate.list_templates    s*     X&&-;AA+NNNr"   N)__name__
__module____qualname____doc__strr   r!   staticmethodr   r   r   r&   r%   r"   r   r   r      s        55%S % % % %#    " OD. O O O \O O Or"   r   )r   typingr   ray.util.annotationsr   r   r%   r"   r   <module>r/      sz           - - - - - - O O O O O O O O O Or"   