
    h-                        S r SSKrSSKJr  SSKJr  SSKJr  \R                  (       a  SSK	J
r
   " S S	\5      rS
\R                  S\R                  \   4S jr\R                   \R"                  \R$                  \R&                  4r\R*                  \R                   \R"                  \R$                  \R&                  4   rS
\R                  S\R.                  \R0                  \      4S jrg)z_Functions that expose information about templates that might be
interesting for introspection.
    N   )nodes)CodeGenerator)Frame)Environmentc                   Z   ^  \ rS rSrSrSU 4S jjrS\SS4S jrS\SS4U 4S	 jjr	S
r
U =r$ )TrackingCodeGenerator   z.We abuse the code generator for introspection.returnNc                 F   > [         TU ]  USS5        [        5       U l        g )Nz<introspection>)super__init__setundeclared_identifiers)selfenvironment	__class__s     C/var/www/auris/envauris/lib/python3.13/site-packages/jinja2/meta.pyr   TrackingCodeGenerator.__init__   s     &79JK25%#    xc                     g)zDon't write.N )r   r   s     r   writeTrackingCodeGenerator.write   s    r   framec                    > [         TU ]  U5        UR                  R                  R	                  5        HF  u  nu  p4US:X  d  M  X@R
                  R                  ;  d  M+  U R                  R                  U5        MH     g)z$Remember all undeclared identifiers.resolveN)	r   enter_framesymbolsloadsitemsr   globalsr   add)r   r   _actionparamr   s        r   r   !TrackingCodeGenerator.enter_frame   sa    E""'--"5"5";";"=A"u4D4D4L4L'L++//6 #>r   )r   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   strr   r   r   __static_attributes____classcell__)r   s   @r   r	   r	      s6    88s t 7 74 7 7r   r	   astr   c                 f    [        U R                  5      nUR                  U 5        UR                  $ )a  Returns a set of all variables in the AST that will be looked up from
the context at runtime.  Because at compile time it's not known which
variables will be used depending on the path the execution takes at
runtime, all variables are returned.

>>> from jinja2 import Environment, meta
>>> env = Environment()
>>> ast = env.parse('{% set foo = 42 %}{{ bar + foo }}')
>>> meta.find_undeclared_variables(ast) == {'bar'}
True

.. admonition:: Implementation

   Internally the code generator is used for finding undeclared variables.
   This is good to know because the code generator might raise a
   :exc:`TemplateAssertionError` during compilation and as a matter of
   fact this function can currently raise that exception as well.
)r	   r   visitr   )r1   codegens     r   find_undeclared_variablesr5   "   s*    & $COO4GMM#)))r   c              #   (  #    U R                  [        5       GHt  nUR                  n[        U[        R
                  5      (       d  [        U[        R                  [        R                  45      (       ah  UR                   HW  n[        U[        R
                  5      (       a1  [        UR                  [        5      (       a  UR                  v   MQ  MS  Sv   MY     OSv   M  [        UR                  [        5      (       a  UR                  v   M  [        U[        R                  5      (       aV  [        UR                  [        [        45      (       a1  UR                   H  n[        U[        5      (       d  M  Uv   M      GMp  Sv   GMw     g7f)a6  Finds all the referenced templates from the AST.  This will return an
iterator over all the hardcoded template extensions, inclusions and
imports.  If dynamic inheritance or inclusion is used, `None` will be
yielded.

>>> from jinja2 import Environment, meta
>>> env = Environment()
>>> ast = env.parse('{% extends "layout.html" %}{% include helper %}')
>>> list(meta.find_referenced_templates(ast))
['layout.html', None]

This function is useful for dependency tracking.  For example if you want
to rebuild parts of the website after a layout template has changed.
N)find_all
_ref_typestemplate
isinstancer   ConstTupleListr"   valuer.   Includetuplelist)r1   noder9   template_names       r   find_referenced_templatesrD   >   s    " Z(#}}(EKK00(U[[%**$=>>%-^^M "-==%m&9&93??"/"5"55 @ #
 &4 
hnnc**..  emm,,NNUDM2
 2
 "*mS11'' "0
 JC )s   E7F=F)r-   typingt r   compilerr   r   TYPE_CHECKINGr   r   r	   TemplateSetr.   r5   Extends
FromImportImportr?   r8   Union_RefTypeIteratorOptionalrD   r   r   r   <module>rS      s      # ??(7M 7&*5>> *aeeCj *0 mmU--u||U]]K
775==%"2"2ELL%--OP25>> 2ajjC6Q 2r   