⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3.9
/
site-packages
/
jinja2
/
__pycache__
/
View File Name :
meta.cpython-39.pyc
a Ã`# ã @ sX d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd„ deƒZdd „ Z d d„ Z dS ) z_Functions that expose information about templates that might be interesting for introspection. é )Únodes)Ú iteritems)Ústring_types)Ú CodeGeneratorc @ s( e Zd ZdZdd„ Zdd„ Zdd„ ZdS ) ÚTrackingCodeGeneratorz.We abuse the code generator for introspection.c C s t | |dd¡ tƒ | _d S )Nz
)r Ú__init__ÚsetÚundeclared_identifiers)ÚselfÚenvironment© r ú//usr/lib/python3.9/site-packages/jinja2/meta.pyr s zTrackingCodeGenerator.__init__c C s dS )zDon't write.Nr )r Úxr r r Úwrite s zTrackingCodeGenerator.writec C sJ t | |¡ t|jjƒD ],\}\}}|dkr|| jjvr| j |¡ qdS )z$Remember all undeclared identifiers.ÚresolveN) r Úenter_framer ZsymbolsÚloadsr Úglobalsr Úadd)r ÚframeÚ_ÚactionZparamr r r r s z!TrackingCodeGenerator.enter_frameN)Ú__name__Ú __module__Ú__qualname__Ú__doc__r r r r r r r r s r c C s t | jƒ}| | ¡ |jS )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) == set(['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 Zvisitr )ÚastZcodegenr r r Úfind_undeclared_variables s r c c sä | tjtjtjtjf¡D ]Ä}t|jtjƒs€t|jtj tj fƒrx|jjD ],}t|tjƒrnt|jt ƒrt|jV qHdV qHqdV qt|jjt ƒrš|jjV qt|tjƒrØt|jjttfƒrØ|jjD ]}t|t ƒrÀ|V qÀqdV qdS )ab 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)Zfind_allr ZExtendsZ FromImportZImportZIncludeÚ isinstanceÚtemplateZConstÚTupleÚListÚitemsÚvaluer ÚtupleÚlist)r ZnodeZ template_namer r r Úfind_referenced_templates5 s* ÿ ÿ r&