Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
meta.cpython-313.pyc53 linesDownload Raw Back to __pycache__
1�

2��j-����SrSSKrSSKJr SSKJr SSKJr \R(aSSK	J3r4 "SS	\5rS5\RS\R\4Sjr\R \R"\R$\R&4r\R*\R \R"\R$\R&4rS6\RS\R.\R0\4S
jrg)z_Functions that expose information about templates that might be7interesting for introspection.8�N�)�nodes)�
CodeGenerator)�Frame)�Environmentc�Z^�\rSrSrSrSU4SjjrS\SS4SjrS\SS4U4S	jjr	S9r10U=r$)�TrackingCodeGenerator�z.We abuse the code generator for introspection.�returnNc�F>�[TU]USS5 [5Ulg)Nz<introspection>)�super�__init__�set�undeclared_identifiers)�self�environment�	__class__s  ��QD:\code\apps\devtools\python\user_packages\Python313\site-packages\jinja2/meta.pyr�TrackingCodeGenerator.__init__s ���
����&7�9J�K�25�%��#��xc��g)zDon't write.N�)rrs  r�write�TrackingCodeGenerator.writes�r�framec�>�[TU]U5 URRR	5HFunup4US:XdMX@R11R;dM+URRU5 MH g)z$Remember all undeclared identifiers.�resolveN)	r
�enter_frame�symbols�loads�itemsr�globalsr�add)rr�_�action�paramrs     �rr�!TrackingCodeGenerator.enter_framesa���
���E�"�"'�-�-�"5�"5�";�";�"=��A�����"�u�4D�4D�4L�4L�'L��+�+�/�/��6�#>r)r)rrrN)�__name__�12__module__�__qualname__�__firstlineno__�__doc__r�strrrr�__static_attributes__�
__classcell__)rs@rr	r	s6���8�8��s��t��7��7�4�7�7rr	�astrc�f�[UR5nURU5 UR$)a�Returns a set of all variables in the AST that will be looked up from13the context at runtime.  Because at compile time it's not known which14variables will be used depending on the path the execution takes at15runtime, all variables are returned.16 17>>> from jinja2 import Environment, meta18>>> env = Environment()19>>> ast = env.parse('{% set foo = 42 %}{{ bar + foo }}')20>>> meta.find_undeclared_variables(ast) == {'bar'}21True22 23.. admonition:: Implementation24 25   Internally the code generator is used for finding undeclared variables.26   This is good to know because the code generator might raise a27   :exc:`TemplateAssertionError` during compilation and as a matter of28   fact this function can currently raise that exception as well.29)r	r�visitr)r1�codegens  r�find_undeclared_variablesr5"s*��&$�C�O�O�4�G��M�M�#���)�)�)rc#�(# �UR[5GHtnURn[U[R305(d�[U[R[R45(ahURHWn[U[R315(a1[UR[5(aURv� MQMSSv� MY OSv� M�[UR[5(aURv� M�[U[R5(aV[UR[[45(a1URHn[U[5(dMUv� M  GMpSv� GMw g7f)a6Finds all the referenced templates from the AST.  This will return an32iterator over all the hardcoded template extensions, inclusions and33imports.  If dynamic inheritance or inclusion is used, `None` will be34yielded.35 36>>> from jinja2 import Environment, meta37>>> env = Environment()38>>> ast = env.parse('{% extends "layout.html" %}{% include helper %}')39>>> list(meta.find_referenced_templates(ast))40['layout.html', None]41 42This function is useful for dependency tracking.  For example if you want43to rebuild parts of the website after a layout template has changed.44N)�find_all�45_ref_types�template�46isinstancer�Const�Tuple�Listr"�valuer.�Include�tuple�list)r1�noder9�
template_names    r�find_referenced_templatesrD>s���"���Z�(��#�}�}���(�E�K�K�0�0��(�U�[�[�%�*�*�$=�>�>�%-�^�^�M�"�-����=�=�%�m�&9�&9�3�?�?�"/�"5�"5�5�@�#�47�&4��48���h�n�n�c�*�*��.�.� ���e�m�m�
,�
,���N�N�U�D�M�249�250�"*���
��m�S�1�1�'�'�"0�51�J�C)�s�E7F�=F)r-�typing�t�r�compilerrr�
TYPE_CHECKINGrrr	�Template�Setr.r5�Extends�52FromImport�Importr?r8�Union�_RefType�Iterator�OptionalrDrrr�<module>rSs������#���?�?�(�7�M�7�&*�5�>�>�*�a�e�e�C�j�*�0�m�m�U�-�-�u�|�|�U�]�]�
K�53��7�7�5�=�=�%�"2�"2�E�L�L�%�-�-�O�P��2�5�>�>�2�a�j�j����C��6Q�2r
codekingpro/portable-devtools · Team Ai