Ë
    øÿæiœl  ã                   ój  — d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ  G d„ d«      Z G d„ d	e	«      Z
 G d
„ d«      Z e«       ZdZ G d„ d«      Z G d„ d«      Z G d„ d«      Z G d„ d«      Z G d„ de«      Z G d„ de«      Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd'd „Zd(d!„Zd"„ Zd#„ Zd$„ Zd)d%„Z d&„ Z!y)*zdprovides runtime services for templates, including Context,
Namespace, and various helper functions.é    N)Úcompat)Ú
exceptions)Úutilc                   ó’   — e Zd ZdZd„ Zd„ Zed„ «       Zed„ «       Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚContextz­Provides runtime namespace, output buffer, and various
    callstacks for templates.

    See :ref:`runtime_toplevel` for detail on the usage of
    :class:`.Context`.

    c                 ó   — |g| _         || _        |j                  «       | _        d | _        d | _        i | _        t        j                  t        | «      | j                  d<   t        «       x| _        | j                  d<   y )NÚcaptureÚcaller)Ú_buffer_stackÚ_dataÚcopyÚ_kwargsÚ_with_templateÚ_outputting_as_unicodeÚ
namespacesÚ	functoolsÚpartialr	   ÚCallerStackÚcaller_stack)ÚselfÚbufferÚdatas      úa/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/mako/runtime.pyÚ__init__zContext.__init__   sn   € Ø$˜XˆÔàˆŒ
à—y‘y“{ˆŒØ"ˆÔØ&*ˆÔ#ØˆŒô !*× 1Ñ 1´'¸4Ó @ˆ�
‰
�9Ñô 4?³=Ð@ˆÔ˜DŸJ™J xÒ0ó    c                 ó®   — || _         |j                  j                  | j                  «      }|r't	        j
                  ddj                  |«      z  «      ‚y )Nz%Reserved words passed to render(): %sz, )r   Úreserved_namesÚintersectionr   r   ÚNameConflictErrorÚjoin)r   ÚtÚillegal_namess      r   Ú_set_with_templatezContext._set_with_template.   sS   € ØˆÔØ×(Ñ(×5Ñ5°d·j±jÓAˆÙÜ×.Ñ.Ø7Ø—)‘)˜MÓ*ñ+óð ð r   c                 ó.   — | j                   j                  S )z]Return the :class:`.TemplateLookup` associated
        with this :class:`.Context`.

        )r   Úlookup©r   s    r   r%   zContext.lookup7   s   € ð ×"Ñ"×)Ñ)Ð)r   c                 ó6   — | j                   j                  «       S )a]  Return the dictionary of top level keyword arguments associated
        with this :class:`.Context`.

        This dictionary only includes the top-level arguments passed to
        :meth:`.Template.render`.  It does not include names produced within
        the template execution such as local variable names or special names
        such as ``self``, ``next``, etc.

        The purpose of this dictionary is primarily for the case that
        a :class:`.Template` accepts arguments via its ``<%page>`` tag,
        which are normally expected to be passed via :meth:`.Template.render`,
        except the template is being called in an inheritance context,
        using the ``body()`` method.   :attr:`.Context.kwargs` can then be
        used to propagate these arguments to the inheriting template::

            ${next.body(**context.kwargs)}

        )r   r   r&   s    r   ÚkwargszContext.kwargs?   s   € ð( �|‰|× Ñ Ó"Ð"r   c                 ó:   — | j                   j                  |«       y)zQPush a ``caller`` callable onto the callstack for
        this :class:`.Context`.N)r   Úappend)r   r
   s     r   Úpush_callerzContext.push_callerU   s   € ð 	×Ñ× Ñ  Õ(r   c                 ó   — | j                   d= y)zPPop a ``caller`` callable onto the callstack for this
        :class:`.Context`.éÿÿÿÿN)r   r&   s    r   Ú
pop_callerzContext.pop_caller[   s   € ð ×Ñ˜bÑ!r   c                 óH   — t        | j                  j                  «       «      S )zAReturn a list of all names established in this :class:`.Context`.)Úlistr   Úkeysr&   s    r   r1   zContext.keysa   s   € ô �D—J‘J—O‘OÓ%Ó&Ð&r   c                 ób   — || j                   v r| j                   |   S t        j                  |   S ©N)r   ÚbuiltinsÚ__dict__©r   Úkeys     r   Ú__getitem__zContext.__getitem__f   s-   € Ø�$—*‘*ÑØ—:‘:˜c‘?Ð"ä×$Ñ$ SÑ)Ð)r   c                 óx   — t        j                  «       }| j                  j                  |«       |j                  S )zUpush a capturing buffer onto this Context and return
        the new writer function.)r   ÚFastEncodingBufferr   r*   Úwrite©r   Úbufs     r   Ú_push_writerzContext._push_writerl   s0   € ô ×%Ñ%Ó'ˆØ×Ñ×!Ñ! #Ô&Ø�y‰yÐr   c                 ól   — | j                   j                  «       }|| j                   d   j                  fS )zupop the most recent capturing buffer from this Context
        and return the current writer after the pop.

        r-   )r   Úpopr;   r<   s     r   Ú_pop_buffer_and_writerzContext._pop_buffer_and_writert   s4   € ð × Ñ ×$Ñ$Ó&ˆØ�D×&Ñ& rÑ*×0Ñ0Ð0Ð0r   c                 ó$   — | j                  «        y)z*push a capturing buffer onto this Context.N)r>   r&   s    r   Ú_push_bufferzContext._push_buffer}   s   € ð 	×ÑÕr   c                 ó6   — | j                   j                  «       S )z7pop the most recent capturing buffer from this Context.)r   r@   r&   s    r   Ú_pop_bufferzContext._pop_buffer‚   s   € ð ×!Ñ!×%Ñ%Ó'Ð'r   Nc                 óv   — | j                   j                  |t        j                  j                  ||«      «      S )z+Return a value from this :class:`.Context`.)r   Úgetr4   r5   )r   r7   Údefaults      r   rG   zContext.get‡   s,   € ð �z‰z�~‰~˜c¤8×#4Ñ#4×#8Ñ#8¸¸gÓ#FÓGÐGr   c                 ó@   — | j                   d   j                  |«       y)zSWrite a string to this :class:`.Context` object's
        underlying output buffer.r-   N©r   r;   )r   Ústrings     r   r;   zContext.writeŒ   s   € ð 	×Ñ˜2Ñ×$Ñ$ VÕ,r   c                 ó4   — | j                   d   j                  S )z#Return the current writer function.r-   rJ   r&   s    r   ÚwriterzContext.writer’   s   € ð ×!Ñ! "Ñ%×+Ñ+Ð+r   c                 óB  — t         j                  t         «      }| j                  |_        | j                  j	                  «       |_        | j
                  |_        | j                  |_        | j                  |_        | j                  |_        | j                  |_	        |S r3   )
r   Ú__new__r   r   r   r   r   r   r   r   )r   Úcs     r   Ú_copyzContext._copy—   ss   € Ü�O‰OœGÓ$ˆØ×,Ñ,ˆŒØ—*‘*—/‘/Ó#ˆŒØ—L‘LˆŒ	Ø×.Ñ.ˆÔØ#'×#>Ñ#>ˆÔ Ø—‘ˆŒØ×*Ñ*ˆŒØˆr   c                 ód   — |s| S | j                  «       }|j                  j                  |«       |S )zßCreate a new :class:`.Context` with a copy of this
        :class:`.Context`'s current state,
        updated with the given dictionary.

        The :attr:`.Context.kwargs` collection remains
        unaffected.


        )rQ   r   Úupdate)r   ÚdrP   s      r   Ú_localszContext._locals¢   s,   € ñ ØˆKØ�J‰J‹LˆØ	�‰�‰�qÔØˆr   c                 óª   — | j                  «       }|j                  }|j                  dd«       |j                  dd«       |j                  dd«       |S )zfcreate a new copy of this :class:`.Context`. with
        tokens related to inheritance state removed.r   NÚparentÚnext)rQ   r   r@   )r   rP   Úxs      r   Ú_clean_inheritance_tokensz!Context._clean_inheritance_tokens³   sG   € ð �J‰J‹LˆØ�G‰GˆØ	�‰ˆf�dÔØ	�‰ˆh˜ÔØ	�‰ˆf�dÔØˆr   r3   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r#   Úpropertyr%   r(   r+   r.   r1   r8   r>   rA   rC   rE   rG   r;   rM   rQ   rU   rZ   © r   r   r   r      s�   „ ñòAò"ð ñ*ó ð*ð ñ#ó ð#ò*)ò"ò'ò
*òò1òò
(ó
Hò
-ò,ò
	òó"	r   r   c                   ó6   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	r   c                 ó   — d | _         y r3   )Ú
nextcallerr&   s    r   r   zCallerStack.__init__À   s	   € Øˆ�r   c                 ó"   — | j                  «       S r3   ©Ú__bool__r&   s    r   Ú__nonzero__zCallerStack.__nonzero__Ã   ó   € Ø�}‰}‹Ðr   c                 óL   — t        | «      xr | j                  «       xr dxs dS )NTF)ÚlenÚ_get_callerr&   s    r   rf   zCallerStack.__bool__Æ   s$   € Ü�4‹yÒ8˜T×-Ñ-Ó/Ò8°DÒA¸EÐAr   c                 ó   — | d   S ©Nr-   r`   r&   s    r   rk   zCallerStack._get_callerÉ   s   € ð �B‰xˆr   c                 ó6   — t        | j                  «       |«      S r3   )Úgetattrrk   r6   s     r   Ú__getattr__zCallerStack.__getattr__Î   s   € Ü�t×'Ñ'Ó)¨3Ó/Ð/r   c                 óV   — | j                   xs d }| j                  |«       d | _         |S r3   )rc   r*   )r   Úframes     r   Ú_push_framezCallerStack._push_frameÑ   s(   € Ø—‘Ò' 4ˆØ�‰�EÔØˆŒØˆr   c                 ó.   — | j                  «       | _        y r3   )r@   rc   r&   s    r   Ú
_pop_framezCallerStack._pop_frame×   s   € ØŸ(™(›*ˆ�r   N)
r[   r\   r]   r   rg   rf   rk   rp   rs   ru   r`   r   r   r   r   ¿   s&   „ òòòBòò
0òó%r   r   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)Ú	Undefinedz¥Represents an undefined value in a template.

    All template modules have a constant value
    ``UNDEFINED`` present which is an instance of this
    object.

    c                 ó   — t        d«      ‚)Nrw   )Ú	NameErrorr&   s    r   Ú__str__zUndefined.__str__å   s   € Ü˜Ó$Ð$r   c                 ó"   — | j                  «       S r3   re   r&   s    r   rg   zUndefined.__nonzero__è   rh   r   c                  ó   — y)NFr`   r&   s    r   rf   zUndefined.__bool__ë   s   € Ør   N)r[   r\   r]   r^   rz   rg   rf   r`   r   r   rw   rw   Û   s   „ ñò%òór   rw   Ú c                   óJ   — e Zd ZdZd„ Zd„ Zd„ Zed„ «       Zd„ Z	d„ Z
d„ Zd	„ Zy
)Ú	LoopStackzŒa stack for LoopContexts that implements the context manager protocol
    to automatically pop off the top of the stack on context exit
    c                 ó   — g | _         y r3   ©Ústackr&   s    r   r   zLoopStack.__init__ù   s	   € Øˆ�
r   c                 ó<   — | j                  |«       | j                  S r3   )Ú_pushÚ_top©r   Úiterables     r   Ú_enterzLoopStack._enterü   s   € Ø�
‰
�8ÔØ�y‰yÐr   c                 ó:   — | j                  «        | j                  S r3   )Ú_popr…   r&   s    r   Ú_exitzLoopStack._exit   s   € Ø�	‰	ŒØ�y‰yÐr   c                 ó<   — | j                   r| j                   d   S | S rm   r�   r&   s    r   r…   zLoopStack._top  s   € à�:Š:Ø—:‘:˜b‘>Ð!àˆKr   c                 ó6   — | j                   j                  «       S r3   )r‚   r@   r&   s    r   rŠ   zLoopStack._pop  s   € Ø�z‰z�~‰~ÓÐr   c                 óŽ   — t        |«      }| j                  r| j                  d   |_        | j                  j                  |«      S rm   )ÚLoopContextr‚   rW   r*   )r   r‡   Únews      r   r„   zLoopStack._push  s7   € Ü˜(Ó#ˆØ�:Š:ØŸ™ B™ˆCŒJØ�z‰z× Ñ  Ó%Ð%r   c                 ó,   — t        j                  d«      ‚)NzNo loop context is established)r   ÚRuntimeExceptionr6   s     r   rp   zLoopStack.__getattr__  s   € Ü×)Ñ)Ð*JÓKÐKr   c                 ó,   — t        | j                  «      S r3   )Úiterr…   r&   s    r   Ú__iter__zLoopStack.__iter__  s   € Ü�D—I‘I‹Ðr   N)r[   r\   r]   r^   r   rˆ   r‹   r_   r…   rŠ   r„   rp   r•   r`   r   r   r   r   ó   s?   „ ñòòòð ñó ðò ò&òLór   r   c                   ó–   — e Zd ZdZd„ Zd„ Zej                  d„ «       Ze	d„ «       Z
e	d„ «       Ze	d„ «       Ze	d„ «       Ze	d	„ «       Zd
„ Zy)r�   a¶  A magic loop variable.
    Automatically accessible in any ``% for`` block.

    See the section :ref:`loop_context` for usage
    notes.

    :attr:`parent` -> :class:`.LoopContext` or ``None``
        The parent loop, if one exists.
    :attr:`index` -> `int`
        The 0-based iteration count.
    :attr:`reverse_index` -> `int`
        The number of iterations remaining.
    :attr:`first` -> `bool`
        ``True`` on the first iteration, ``False`` otherwise.
    :attr:`last` -> `bool`
        ``True`` on the last iteration, ``False`` otherwise.
    :attr:`even` -> `bool`
        ``True`` when ``index`` is even.
    :attr:`odd` -> `bool`
        ``True`` when ``index`` is odd.
    c                 ó.   — || _         d| _        d | _        y ©Nr   )Ú	_iterableÚindexrW   r†   s     r   r   zLoopContext.__init__3  s   € Ø!ˆŒØˆŒ
Øˆ�r   c              #   ó`   K  — | j                   D ]  }|–— | xj                  dz  c_        Œ y ­w©Né   )r™   rš   )r   Úis     r   r•   zLoopContext.__iter__8  s&   è ø€ Ø—”ˆAØŠGØ�JŠJ˜!‰OŽJñ  ùs   ‚,.c                 ó,   — t        | j                  «      S r3   )rj   r™   r&   s    r   Ú__len__zLoopContext.__len__=  s   € ä�4—>‘>Ó"Ð"r   c                 ó8   — t        | «      | j                  z
  dz
  S rœ   )rj   rš   r&   s    r   Úreverse_indexzLoopContext.reverse_indexA  s   € ä�4‹y˜4Ÿ:™:Ñ%¨Ñ)Ð)r   c                 ó    — | j                   dk(  S r˜   )rš   r&   s    r   ÚfirstzLoopContext.firstE  s   € à�z‰z˜Q‰Ðr   c                 ó8   — | j                   t        | «      dz
  k(  S rœ   )rš   rj   r&   s    r   ÚlastzLoopContext.lastI  s   € à�z‰zœS ›Y¨™]Ñ*Ð*r   c                 ó   — | j                    S r3   )Úoddr&   s    r   ÚevenzLoopContext.evenM  s   € à—8‘8ˆ|Ðr   c                 ó2   — t        | j                  dz  «      S )Né   )Úboolrš   r&   s    r   r¨   zLoopContext.oddQ  s   € ä�D—J‘J ‘NÓ#Ð#r   c                 óR   — |st        d«      ‚|| j                  t        |«      z     S )z,Cycle through values as the loop progresses.z(You must provide values to cycle through)Ú
ValueErrorrš   rj   )r   Úvaluess     r   ÚcyclezLoopContext.cycleU  s)   € áÜÐGÓHÐHØ�d—j‘j¤3 v£;Ñ.Ñ/Ð/r   N)r[   r\   r]   r^   r   r•   r   Úmemoized_instancemethodr    r_   r¢   r¤   r¦   r©   r¨   r°   r`   r   r   r�   r�     s”   „ ñò,ò
ð
 
×!Ñ!ñ#ó "ð#ð ñ*ó ð*ð ñó ðð ñ+ó ð+ð ñó ðð ñ$ó ð$ó0r   r�   c                   ó   — e Zd Zd„ Zd„ Zy)Ú_NSAttrc                 ó   — || _         y r3   )Ú_NSAttr__parent)r   rW   s     r   r   z_NSAttr.__init__]  s	   € Øˆ�r   c                 óª   — | j                   }|r;t        |j                  |«      rt        |j                  |«      S |j                  }|rŒ;t        |«      ‚r3   )rµ   ÚhasattrÚmodulero   ÚinheritsÚAttributeError)r   r7   Únss      r   rp   z_NSAttr.__getattr__`  sH   € Ø�]‰]ˆÙÜ�r—y‘y #Ô&Ü˜rŸy™y¨#Ó.Ð.à—[‘[�ò	 ô
 ˜SÓ!Ð!r   N)r[   r\   r]   r   rp   r`   r   r   r³   r³   \  s   „ òó"r   r³   c                   ó¤   — e Zd ZdZ	 	 	 	 dd„ZdZdZ	 dZ	 dZ	 dZ		 dZ
	 dZej                  d„ «       Zd„ Zd„ Zd„ Zed	„ «       Zd
„ Zd„ Zd„ Zd„ Zy)Ú	Namespacea‹  Provides access to collections of rendering methods, which
    can be local, from other templates, or from imported modules.

    To access a particular rendering method referenced by a
    :class:`.Namespace`, use plain attribute access:

    .. sourcecode:: mako

      ${some_namespace.foo(x, y, z)}

    :class:`.Namespace` also contains several built-in attributes
    described here.

    Nc                 ó~   — || _         || _        || _        |�!|D �ci c]  }|j                  |“Œ c}| _        y y c c}w r3   )ÚnameÚcontextr¹   r[   Ú	callables)r   r¿   rÀ   rÁ   r¹   Úpopulate_selfÚcalling_urirP   s           r   r   zNamespace.__init__{  sE   € ð ˆŒ	ØˆŒØ ˆŒØÐ Ù5>Ó?±Y°˜aŸj™j¨!™m°YÑ?ˆD�Nð !ùÚ?s   œ:r`   c                 ó   — t        | «      S )a-  Access module level attributes by name.

        This accessor allows templates to supply "scalar"
        attributes which are particularly handy in inheritance
        relationships.

        .. seealso::

            :ref:`inheritance_attr`

            :ref:`namespace_attr_for_includes`

        )r³   r&   s    r   ÚattrzNamespace.attr¼  s   € ô �t‹}Ðr   c                 ó  — | |f}|| j                   j                  v r| j                   j                  |   S t        || j                   j                  «       || j                  ¬«      }|| j                   j                  |<   |S )a]  Return a :class:`.Namespace` corresponding to the given ``uri``.

        If the given ``uri`` is a relative URI (i.e. it does not
        contain a leading slash ``/``), the ``uri`` is adjusted to
        be relative to the ``uri`` of the namespace itself. This
        method is therefore mostly useful off of the built-in
        ``local`` namespace, described in :ref:`namespace_local`.

        In
        most cases, a template wouldn't need this function, and
        should instead use the ``<%namespace>`` tag to load
        namespaces. However, since all ``<%namespace>`` tags are
        evaluated before the body of a template ever runs,
        this method can be used to locate namespaces using
        expressions that were generated within the body code of
        the template, or to conditionally use a particular
        namespace.

        )ÚtemplateurirÃ   )rÀ   r   ÚTemplateNamespacerQ   Ú_templateuri)r   Úurir7   r»   s       r   Úget_namespacezNamespace.get_namespaceÍ  sx   € ð( �SˆkˆØ�$—,‘,×)Ñ)Ñ)Ø—<‘<×*Ñ*¨3Ñ/Ð/ÜØØ�L‰L×ÑÓ ØØ×)Ñ)ô	
ˆð (*ˆ�‰×Ñ Ñ$Øˆ	r   c                 óD   — t        | j                  || j                  «      S )z¹Return a :class:`.Template` from the given ``uri``.

        The ``uri`` resolution is relative to the ``uri`` of this
        :class:`.Namespace` object's :class:`.Template`.

        )Ú_lookup_templaterÀ   rÉ   )r   rÊ   s     r   Úget_templatezNamespace.get_templateí  s   € ô   §¡¨c°4×3DÑ3DÓEÐEr   c                 ó<   —  | j                   j                  |fi |¤ŽS )a�  Return a value from the :class:`.Cache` referenced by this
        :class:`.Namespace` object's :class:`.Template`.

        The advantage to this method versus direct access to the
        :class:`.Cache` is that the configuration parameters
        declared in ``<%page>`` take effect here, thereby calling
        up the same configured backend as that configured
        by ``<%page>``.

        )ÚcacherG   )r   r7   r(   s      r   Ú
get_cachedzNamespace.get_cachedö  s   € ð ˆt�z‰z�~‰~˜cÑ, VÑ,Ð,r   c                 ó.   — | j                   j                  S )zReturn the :class:`.Cache` object referenced
        by this :class:`.Namespace` object's
        :class:`.Template`.

        )ÚtemplaterÐ   r&   s    r   rÐ   zNamespace.cache  s   € ð �}‰}×"Ñ"Ð"r   c                 óH   — t        | j                  || j                  fi |¤Ž y)z$Include a file at the given ``uri``.N)Ú_include_filerÀ   rÉ   )r   rÊ   r(   s      r   Úinclude_filezNamespace.include_file  s   € ô 	�d—l‘l C¨×):Ñ):ÑE¸fÓEr   c                 óv   — |D ]4  }|dk(  r| j                  «       D ]
  \  }}|||<   Œ Œ&t        | |«      ||<   Œ6 y )NÚ*)Ú	_get_starro   )r   rT   ÚlÚidentÚkÚvs         r   Ú	_populatezNamespace._populate  sC   € ÛˆEØ˜Š|Ø ŸN™NÖ,‘D�A�qØ�A�a’Dñ -ô # 4¨Ó/��%’ñ r   c              #   ón   K  — | j                   r%| j                   D ]  }|| j                   |   f–— Œ y y ­wr3   )rÁ   r6   s     r   rÙ   zNamespace._get_star  s4   è ø€ Ø�>Š>Ø—~”~�Ø˜DŸN™N¨3Ñ/Ð0Ó0ñ &ð ùs   ‚35c                 óÚ   — || j                   v r| j                   |   }n?| j                  rt        | j                  |«      }nt        d| j                  ›d|›d�«      ‚t        | ||«       |S ©NzNamespace 'z' has no member 'Ú')rÁ   r¹   ro   rº   r¿   Úsetattr)r   r7   Úvals      r   rp   zNamespace.__getattr__  s_   € Ø�$—.‘.Ñ Ø—.‘. Ñ%‰CØ�]Š]Ü˜$Ÿ-™-¨Ó-‰Cå Ø7;·y³yÂ#ÐFóð ô 	��c˜3ÔØˆ
r   ©NNTN)r[   r\   r]   r^   r   rÁ   r¸   rÓ   rÀ   ÚfilenamerÊ   rÉ   r   Úmemoized_propertyrÅ   rË   rÎ   rÑ   r_   rÐ   rÖ   rÞ   rÙ   rp   r`   r   r   r½   r½   j  sµ   „ ñð& ØØØó@ð €Ià€Fðð €Hðð
 €Gðð €Hðð €Cðð €Là	×Ññó ðò ò@Fò-ð ñ#ó ð#òFò
0ò1ó

r   r½   c                   ó`   — e Zd ZdZ	 	 	 	 	 	 d	d„Zed„ «       Zed„ «       Zed„ «       Zd„ Z	d„ Z
y)
rÈ   z@A :class:`.Namespace` specific to a :class:`.Template` instance.Nc	                 óŒ  — || _         || _        || _        |� |D �	ci c]  }	|	j                  |	“Œ c}	| _        |�8t        |||«      | _        | j                  j                  j                  | _	        n0|�#|| _        |j                  j                  | _	        nt        d«      ‚|rt        || j                  | ¬«      \  }
}y y c c}	w )Nz 'template' argument is required.)Úself_ns)r¿   rÀ   r¹   r[   rÁ   rÍ   rÓ   r¸   Ú_template_urirÉ   Ú	TypeErrorÚ_populate_self_namespace)r   r¿   rÀ   rÓ   rÇ   rÁ   r¹   rÂ   rÃ   rP   ÚlclcallableÚ
lclcontexts               r   r   zTemplateNamespace.__init__0  s¾   € ð ˆŒ	ØˆŒØ ˆŒØÐ Ù5>Ó?±Y°˜aŸj™j¨!™m°YÑ?ˆDŒNàÐ"Ü,¨W°kÀ;ÓOˆDŒMØ $§¡× 4Ñ 4× BÑ BˆDÕØÐ!Ø$ˆDŒMØ (§¡× =Ñ =ˆDÕäÐ>Ó?Ð?áÜ&>Ø˜Ÿ™°ô'Ñ#ˆK™ð ùò @s   œCc                 ó.   — | j                   j                  S )zõThe Python module referenced by this :class:`.Namespace`.

        If the namespace references a :class:`.Template`, then
        this module is the equivalent of ``template.module``,
        i.e. the generated module for the template.

        )rÓ   r¸   r&   s    r   r¸   zTemplateNamespace.moduleO  s   € ð �}‰}×#Ñ#Ð#r   c                 ó.   — | j                   j                  S ©zhThe path of the filesystem file used for this
        :class:`.Namespace`'s module or template.
        )rÓ   ræ   r&   s    r   ræ   zTemplateNamespace.filenameZ  s   € ð
 �}‰}×%Ñ%Ð%r   c                 ó.   — | j                   j                  S )z¿The URI for this :class:`.Namespace`'s template.

        I.e. whatever was sent to :meth:`.TemplateLookup.get_template()`.

        This is the equivalent of :attr:`.Template.uri`.

        )rÓ   rÊ   r&   s    r   rÊ   zTemplateNamespace.uria  s   € ð �}‰}× Ñ Ð r   c              #   óÚ   ‡ K  — ‰ j                   r$‰ j                   D ]  }|‰ j                   |   f–— Œ ˆ fd„}‰ j                  j                  j                  D ]  }| ||«      f–— Œ y ­w)Nc                 óz   •— ‰j                   j                  | «      }t        j                  |‰j                  «      S r3   )rÓ   Ú_get_def_callabler   r   rÀ   )r7   Ú	callable_r   s     €r   rG   z(TemplateNamespace._get_star.<locals>.getq  s.   ø€ ØŸ™×7Ñ7¸Ó<ˆIÜ×$Ñ$ Y°·±Ó=Ð=r   )rÁ   rÓ   r¸   Ú_exports)r   r7   rG   rÜ   s   `   r   rÙ   zTemplateNamespace._get_starl  s_   øè ø€ Ø�>Š>Ø—~”~�Ø˜DŸN™N¨3Ñ/Ð0Ó0ð &ô	>ð —‘×%Ñ%×.Ô.ˆAØ‘c˜!“f�+Óñ /ùs   ƒA(A+c                 óˆ  — || j                   v r| j                   |   }n–| j                  j                  |«      r<| j                  j                  |«      }t	        j
                  || j                  «      }n?| j                  rt        | j                  |«      }nt        d| j                  ›d|›d�«      ‚t        | ||«       |S rá   )rÁ   rÓ   Úhas_defrö   r   r   rÀ   r¹   ro   rº   r¿   rã   ©r   r7   rä   r÷   s       r   rp   zTemplateNamespace.__getattr__x  s�   € Ø�$—.‘.Ñ Ø—.‘. Ñ%‰CØ�]‰]×"Ñ" 3Ô'ØŸ™×7Ñ7¸Ó<ˆIÜ×#Ñ# I¨t¯|©|Ó<‰CØ�]Š]Ü˜$Ÿ-™-¨Ó-‰Cõ !Ø7;·y³yÂ#ÐFóð ô 	��c˜3ÔØˆ
r   )NNNNTN)r[   r\   r]   r^   r   r_   r¸   ræ   rÊ   rÙ   rp   r`   r   r   rÈ   rÈ   ,  sd   „ áJð ØØØØØóð> ñ$ó ð$ð ñ&ó ð&ð ñ!ó ð!ò
ór   rÈ   c                   ó<   — e Zd ZdZ	 	 	 	 dd„Zed„ «       Zd„ Zd„ Zy)ÚModuleNamespacez;A :class:`.Namespace` specific to a Python module instance.Nc                 óê   — || _         || _        || _        |� |D �ci c]  }|j                  |“Œ c}| _        t        |«      }	|j                  d«      dd  D ]  }
t        |	|
«      }	Œ |	| _        y c c}w )NÚ.r�   )	r¿   rÀ   r¹   r[   rÁ   Ú
__import__Úsplitro   r¸   )r   r¿   rÀ   r¸   rÁ   r¹   rÂ   rÃ   rP   ÚmodÚtokens              r   r   zModuleNamespace.__init__�  sz   € ð ˆŒ	ØˆŒØ ˆŒØÐ Ù5>Ó?±Y°˜aŸj™j¨!™m°YÑ?ˆDŒNä˜Ó ˆØ—\‘\ #Ó& q rÓ*ˆEÜ˜#˜uÓ%‰Cð +àˆ�ùò @s   œA0c                 ó.   — | j                   j                  S rò   )r¸   Ú__file__r&   s    r   ræ   zModuleNamespace.filename¢  s   € ð
 �{‰{×#Ñ#Ð#r   c              #   ó>  K  — | j                   r$| j                   D ]  }|| j                   |   f–— Œ t        | j                  «      D ]Q  }|d   dk7  sŒt        | j                  |«      }t	        |«      sŒ.|t        j                  || j                  «      f–— ŒS y ­w)Nr   Ú_)rÁ   Údirr¸   ro   Úcallabler   r   rÀ   )r   r7   r÷   s      r   rÙ   zModuleNamespace._get_star©  s�   è ø€ Ø�>Š>Ø—~”~�Ø˜DŸN™N¨3Ñ/Ð0Ó0ð &ä�t—{‘{Ö#ˆCØ�1‰v˜‹}Ü# D§K¡K°Ó5�	Ü˜IÕ&Øœy×0Ñ0°¸D¿L¹LÓIÐIÓIñ	 $ùs   ‚ABÁ!BÁ6'Bc                 ót  — || j                   v r| j                   |   }nŒt        | j                  |«      r7t        | j                  |«      }t	        j
                  || j                  «      }n?| j                  rt        | j                  |«      }nt        d| j                  ›d|›d�«      ‚t        | ||«       |S rá   )rÁ   r·   r¸   ro   r   r   rÀ   r¹   rº   r¿   rã   rû   s       r   rp   zModuleNamespace.__getattr__³  s“   € Ø�$—.‘.Ñ Ø—.‘. Ñ%‰CÜ�T—[‘[ #Ô&Ü §¡¨SÓ1ˆIÜ×#Ñ# I¨t¯|©|Ó<‰CØ�]Š]Ü˜$Ÿ-™-¨Ó-‰Cå Ø7;·y³yÂ#ÐFóð ô 	��c˜3ÔØˆ
r   rå   )	r[   r\   r]   r^   r   r_   ræ   rÙ   rp   r`   r   r   rý   rý   ‰  s7   „ áEð ØØØóð* ñ$ó ð$òJór   rý   c                 ó   ‡ — ˆ fd„}|S )zŒApply a caller_stack compatibility decorator to a plain
    Python function.

    See the example in :ref:`namespaces_python_modules`.

    c                 óÄ   •— | j                   j                  «        	  ‰| g|¢­i |¤Ž| j                   j                  «        S # | j                   j                  «        w xY wr3   )r   rs   ru   )rÀ   Úargsr(   Úfuncs      €r   Úwrap_stackframez(supports_caller.<locals>.wrap_stackframeË  sQ   ø€ Ø×Ñ×(Ñ(Ô*ð	.Ù˜Ð1 $Ò1¨&Ñ1à× Ñ ×+Ñ+Õ-øˆG× Ñ ×+Ñ+Õ-ús   �A ÁAr`   )r  r  s   ` r   Úsupports_callerr  Ã  s   ø€ ô.ð Ðr   c                 óÞ   — t        |«      st        j                  d«      ‚| j                  «        	  ||i |¤Ž | j	                  «       }|j                  «       S # | j	                  «       }w xY w)z‡Execute the given template def, capturing the output into
    a buffer.

    See the example in :ref:`namespaces_python_modules`.

    z[capture() function expects a callable as its argument (i.e. capture(func, *args, **kwargs)))r	  r   r’   rC   rE   Úgetvalue)rÀ   r÷   r  r(   r=   s        r   r	   r	   Õ  sq   € ô �IÔÜ×)Ñ)ðAó
ð 	
ð ×ÑÔð$Ù�4Ð"˜6Ò"à×!Ñ!Ó#ˆØ�<‰<‹>Ðøð ×!Ñ!Ó#‰ús   ²A ÁA,c                 ó   ‡ — ˆ fd„}|S )Nc                 ó   •‡ — ˆˆ fd„}|S )Nc                 ó~   •‡ — ˆ ˆfd„}	 ‰j                   dd  |_           ‰|«      ‰ g|¢­i |¤ŽS # t        $ r Y Œw xY w)Nc                  ó   •—  ‰‰g| ¢­i |¤ŽS r3   r`   )r  ÚkwrÀ   Ú	render_fns     €€r   ÚyzB_decorate_toplevel.<locals>.decorate_render.<locals>.go.<locals>.yí  s   ø€ Ù  Ð6¨4Ò6°2Ñ6Ð6r   é   )r[   rì   )rÀ   r  r  r  Úfnr  s   `   €€r   Úgoz7_decorate_toplevel.<locals>.decorate_render.<locals>.goì  sR   ù€ õ7ðØ&×/Ñ/°°Ð3�”
ð ‘2�a“5˜Ð. 4Ò.¨2Ñ.Ð.øô ò áðús   Š0 °	<»<r`   )r  r  r  s   ` €r   Údecorate_renderz+_decorate_toplevel.<locals>.decorate_renderë  s   ù€ õ		/ð ˆ	r   r`   )r  r  s   ` r   Ú_decorate_toplevelr  ê  s   ø€ ôð Ðr   c                 ó   ‡ ‡— ˆ ˆfd„}|S )Nc                 ó&   •‡—  ‰| «      Šˆˆfd„}|S )Nc                  ó   •—  ‰‰g| ¢­i |¤ŽS r3   r`   )r  r  rÀ   Údecs     €€r   r  z5_decorate_inline.<locals>.decorate_render.<locals>.go   s   ø€ Ù�wÐ, Ò,¨Ñ,Ð,r   r`   )r  r  r"  rÀ   r  s     @€€r   r  z)_decorate_inline.<locals>.decorate_renderý  s   ù€ Ù�‹mˆõ	-ð ˆ	r   r`   )rÀ   r  r  s   `` r   Ú_decorate_inliner#  ü  s   ù€ õð Ðr   c                 ó2  — t        | ||«      }t        | j                  «       |«      \  }}t        || j                  fi |¤Ž}|j
                  r	  ||fi |¤Ž y ||fi |¤Ž y# t        $ r* |j                  |t        j                  «       «      }|s‚ Y yw xY w)zPlocate the template from the given uri and include it in
    the current output.N)	rÍ   rí   rZ   Ú_kwargs_for_includer   Úinclude_error_handlerÚ	Exceptionr   Úexception_as)rÀ   rÊ   rÃ   r(   rÓ   r÷   ÚctxÚresults           r   rÕ   rÕ     s§   € ô   ¨¨kÓ:€HÜ/Ø×)Ñ)Ó+¨XóÑ€Y�ô ! ¨G¯M©MÑD¸VÑD€FØ×%Ò%ð	Ù�cÑ$˜VÓ$ñ 	�#Ñ ˜Ó øô ò 	Ø×3Ñ3°C¼×9LÑ9LÓ9NÓOˆFÙØñ ð	ús   Á	A# Á#0BÂBc                 óÜ  — |€yt        | ||«      }| d   }|}|j                  �|j                  }|j                  �Œ| j                  d|i«      }t        d|j                  z  ||d¬«      |_        |j                  x| j
                  d<   |j
                  d<   t        |j                  d	d«      }|� |||«      }|r|S t        |j                  d
d«      }	|	� |	| «       |j                  |fS )z�called by the _inherit method in template modules to set
    up the inheritance chain at the start of a template's
    execution.Nr   rX   úself:%sF©rÓ   rÂ   rW   ÚlocalÚ_mako_inheritÚ_mako_generate_namespaces)	rÍ   r¹   rU   rÈ   rÊ   r   ro   r¸   r÷   )
rÀ   rÊ   rÃ   rÓ   rê   Úihrï   r÷   ÚretÚgen_nss
             r   Ú_inherit_fromr4    sû   € ð
 €{ØÜ ¨¨kÓ:€HØ�f‰o€GØ	€BØ
�+‰+Ð
!Ø�[‰[ˆð �+‰+Ñ
!à—‘ &¨" Ó.€JÜ#Ø�H—L‘LÑ ØØØô	€B„Kð ;=¿+¹+ÐE€G‡M�M�(Ñ˜j×.Ñ.¨wÑ7Ü˜Ÿ™¨¸$Ó?€IØÐÙ˜ *Ó-ˆÙØˆJä�X—_‘_Ð&AÀ4ÓH€FØÐÙˆwŒØ×Ñ 
Ð+Ð+r   c                 ój  — | j                   j                  }|€,t        j                  d| j                   j                  z  «      ‚|j                  ||«      }	 |j                  |«      S # t        j                  $ r6}t        j                  t        t        j                  «       «      «      |‚d }~ww xY w)Nz.Template '%s' has no TemplateLookup associated)r   r%   r   ÚTemplateLookupExceptionrÊ   Ú
adjust_urirÎ   ÚTopLevelLookupExceptionÚstrr   r(  )rÀ   rÊ   Ú
relativetor%   Úes        r   rÍ   rÍ   <  s©   € Ø×#Ñ#×*Ñ*€FØ€~Ü×0Ñ0Ø<Ø×$Ñ$×(Ñ(ñ)ó
ð 	
ð ×
Ñ
˜C Ó
,€CðØ×"Ñ" 3Ó'Ð'øÜ×-Ñ-ò Ü×0Ñ0Ü”×#Ñ#Ó%Ó&ó
àð	ûðús   ÁA) Á)B2Á<1B-Â-B2c                 ó  — |€t        d|j                  z  | |d¬«      }|x| j                  d<   | j                  d<   t        |j                  d«      r |j                  j                  || «      }|r|S |j                  | fS )Nr,  Fr-  r   r.  r/  )rÈ   rÊ   r   r·   r¸   r/  r÷   )rÀ   rÓ   rê   r2  s       r   rí   rí   L  s�   € Ø€Ü#Ø˜Ÿ™Ñ$ØØØô	
ˆð 6=Ð<€G‡M�M�&Ñ˜GŸM™M¨'Ñ2Üˆx�‰ Ô0Ø�o‰o×+Ñ+¨H°gÓ>ˆÙØˆJØ×Ñ Ð(Ð(r   c                 ó@  — |rt        j                  «       }n+t        j                  | j                  | j                  ¬«      }t	        |fi |¤Ž}||_        |j                  | «       t        | ||g|¢­i t        ||«      ¤Ž |j                  «       j                  «       S )z^create a Context and return the string
    output of the given template and template callable.)ÚencodingÚerrors)r   r:   Úoutput_encodingÚencoding_errorsr   r   r#   Ú_render_contextÚ_kwargs_for_callablerE   r  )rÓ   r÷   r  r   Ú
as_unicoder=   rÀ   s          r   Ú_renderrE  \  s£   € ñ Ü×%Ñ%Ó'‰ä×%Ñ%Ø×-Ñ-°h×6NÑ6Nô
ˆô �cÑ"˜TÑ"€GØ%/€GÔ"Ø×Ñ˜xÔ(äØØØðð 
ò	ô
 ˜y¨$Ó
/òð ×ÑÓ ×)Ñ)Ó+Ð+r   c                 óÂ   — t        j                  | «      }|d   r|S |d   |dd D �cg c]  }|€Œ|‘Œ	 c}z   }i }|D ]  }|dk7  sŒ	||v sŒ||vsŒ||   ||<   Œ |S c c}w )Nr«   r   r�   é   rÀ   ©r   Úinspect_getargspec)r÷   r   ÚargspecrÝ   Ú	namedargsr(   Úargs          r   rC  rC  t  s…   € Ü×'Ñ'¨	Ó2€Gàˆq‚zØˆð ˜‘
¨°°1©ÓG© A¸¹ša¨ÑGÑG€IØ€FÛˆØ�)Ó  t¢°¸6Ò0AØ˜s™)ˆF�3ŠKð ð €Mùò Hs
   ¨A°Ac                 ó°   — t        j                  | «      }|d   |dd D �cg c]  }|€Œ|‘Œ	 c}z   }|D ]  }|dk7  sŒ	||v sŒ||vsŒ||   ||<   Œ |S c c}w )Nr   r�   rG  rÀ   rH  )r÷   r   r(   rJ  rÝ   rK  rL  s          r   r%  r%  ƒ  sr   € Ü×'Ñ'¨	Ó2€GØ˜‘
¨°°1©ÓG© A¸¹ša¨ÑGÑG€IÛˆØ�)Ó  t¢°¸6Ò0AØ˜s™)ˆF�3ŠKð ð €Mùò	 Hs
   ¡A©Ac                 óÊ   — dd l m} t        | |j                  «      st	        || «      \  }}t        ||||¬«       y t	        || j                  «      \  }}t        ||||¬«       y )Nr   )r  r(   )Úmako.templaterÓ   Ú
isinstanceÚDefTemplaterí   Ú_exec_templaterW   )Útmplr÷   rÀ   r  r(   rÓ   Úinheritrï   s           r   rB  rB  Œ  s[   € Ý$ô �d˜H×0Ñ0Ô1ä 8¸À$Ó GÑˆ�*Ü�w 
°¸fÖEô !9¸À$Ç+Á+Ó NÑˆ�*Ü�y '°¸VÖDr   c                 ó,  — |j                   }|�&|j                  s|j                  r	  | |g|¢­i |¤Ž y | |g|¢­i |¤Ž y# t        $ r" t	        ||t        j                  «       «       Y y t        j                  «       d   }t	        |||«       Y yxY w)zûexecute a rendering callable given the callable, a
    Context, and optional explicit arguments

    the contextual Template will be located if it exists, and
    the error handling options specified on that Template will
    be interpreted here.
    Nr   )	r   Úformat_exceptionsÚerror_handlerr'  Ú_render_errorr   r(  ÚsysÚexc_info)r÷   rÀ   r  r(   rÓ   r;  s         r   rR  rR  ›  s”   € ð ×%Ñ%€HØÐØ×"Ò" h×&<Ò&<ð	0Ù�gÐ/ Ò/¨Ó/ñ 	�'Ð+˜DÒ+ FÓ+øô ò 	DÜ˜( G¬V×-@Ñ-@Ó-BÖCð	0Ü—‘“˜qÑ!ˆAÜ˜( G¨QÖ/ús   ¨A Á(BÁ,%Bc                 óâ  — | j                   rD| j                  ||«      }|s/t        j                  «       \  }}}|r|r|j                  |«      ‚|‚y t	        j
                  «       }|j                  r#t        j                  «       g|j                  d d  n8t        j                  |j                  |j                  «      g|j                  d d  |j                  |«       |j                  ||¬«       y )N)Úerror)rW  rY  rZ  Úwith_tracebackr   Úhtml_error_templater   r   r:   r   r@  rA  r#   Úrender_context)rÓ   rÀ   r\  r*  ÚtpÚvalueÚtbÚerror_templates           r   rX  rX  ²  sÝ   € Ø×ÒØ×'Ñ'¨°Ó7ˆÙÜŸL™L›N‰MˆB��rÙ™Ø×*Ñ*¨2Ó.Ð.à�ð ô $×7Ñ7Ó9ˆØ×)Ò)Ü(,×(?Ñ(?Ó(AÐ'BˆG×!Ñ!¡!Ñ$ô ×'Ñ'Ø"×2Ñ2Ø"×2Ñ2óð(ˆG×!Ñ!¡!Ð$ð 	×"Ñ" >Ô2Ø×%Ñ% g°UÐ%Õ;r   r3   )F)NN)"r^   r4   r   rY  Úmakor   r   r   r   r0   r   rw   Ú	UNDEFINEDÚSTOP_RENDERINGr   r�   r³   r½   rÈ   rý   r  r	   r  r#  rÕ   r4  rÍ   rí   rE  rC  r%  rB  rR  rX  r`   r   r   Ú<module>rg     sà   ðñ,ó Û Û 
å Ý Ý ÷iñ iôX%�$ô %÷8ñ ñ( ‹K€	Ø€÷%ñ %÷P>0ñ >0÷B"ñ "÷ñ ôDZ˜	ô Zôz7�iô 7òtò$ò*ò$	ò!ò(,ò@ó )ó ,ò0òòEó,ó.<r   