Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/jinja2/__pycache__/ext.cpython-311.pyc

�

�܋fz}���UdZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddl
mZdd	l
mZdd
lmZddlmZddlmZdd
lmZddlmZejrFddlZddlmZddlmZddlmZGd�dej��Z Gd�de ��Z!ej"e e!fZ#dZ$ej%e&dfe'd<ej(d��Z)Gd�d��Z*ededej+dej+dej"ej+effd ���Z,d!ej-e&ge&fdej-de&ffd"�Z.d!ej-e&e&e/ge&fdej-de&ffd#�Z0d!ej-e&e&ge&fdej-de&ffd$�Z1d!ej-e&e&e&e/ge&fdej-de&ffd%�Z2Gd&�d'e*��Z3Gd(�d)e*��Z4Gd*�d+e*��Z5Gd,�d-e*��Z6Gd.�d/e*��Z7Gd0�d1e*��Z8e$d2fd3e
j9d4ej:e&d5e;dej<ej%e/e&ej"ej=e&ej%ej=e&dffffd6�Z>Gd7�d8��Z?d9ej@d:ej:e&d;ej:e&d<ejAe&ej+fdej<ej%e/e&ej"ej=e&ej%ej=e&dffejBe&ff
d=�ZCe3ZDe4ZEe5ZFe6ZGe7ZHe8ZIdS)>z2Extension API for adding custom tags and behavior.�N)�Markup�)�defaults)�nodes)�Environment)�TemplateAssertionError)�TemplateSyntaxError)�concat)�Context)�	Undefined)�
import_string)�pass_context)�Token)�TokenStream)�Parserc�6�eZdZdedefd�Zdedededefd�ZdS)	�_TranslationsBasic�message�returnc��dS�N�)�selfrs  �[/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/jinja2/ext.py�gettextz_TranslationsBasic.gettext����C��singular�plural�nc��dSrr)rrrr s    r�ngettextz_TranslationsBasic.ngettexts���DrN)�__name__�
__module__�__qualname__�strr�intr"rrrrrsf������	�3�	�3�	�	�	�	�	�S�	�#�	�#�	�#�	�	�	�	�	�	rrc
�>�eZdZdededefd�Zdededededef
d�Zd	S)
�_TranslationsContext�contextrrc��dSrr)rr*rs   r�pgettextz_TranslationsContext.pgettext"rrrrr c��dSrr)rr*rrr s     r�	npgettextz_TranslationsContext.npgettext%rrN)r#r$r%r&r,r'r.rrrr)r)!su������	�C�	�#�	�#�	�	�	�	�	�S�	�C�	��	��	�QT�	�	�	�	�	�	rr))�_rr"r,r..�GETTEXT_FUNCTIONSz\s*\n\s*c��eZdZUdZejeed<dd�Ze	��Z
ejeed<dZde
ddfd	�Zde
ddfd
�Z	ddedejed
ejedefd�Zdddejdejdffd�Zdddejejejejffd�Z	ddedejedejfd�Z					ddedejejejdejejejdejejdejejdejedejfd�ZdS) �	ExtensionagExtensions can be used to add extra functionality to the Jinja template
    system at the parser level.  Custom extensions are bound to an environment
    but may not store environment specific data on `self`.  The reason for
    this is that an extension can be bound to another environment (for
    overlays) by creating a copy and reassigning the `environment` attribute.

    As extensions are created by the environment they cannot accept any
    arguments for configuration.  One may want to work around that by using
    a factory function, but that is not possible as extensions are identified
    by their import name.  The correct way to configure the extension is
    storing the configuration values on the environment.  Because this way the
    environment ends up acting as central configuration storage the
    attributes may clash which is why extensions have to ensure that the names
    they choose for configuration are not too generic.  ``prefix`` for example
    is a terrible name, ``fragment_cache_prefix`` on the other hand is a good
    name as includes the name of the extension (fragment cache).
    �
identifierrNc�2�|j�d|j��|_dS)N�.)r$r#r3)�clss r�__init_subclass__zExtension.__init_subclass__Ls���N�;�;�S�\�;�;����r�tags�d�environmentc��||_dSr)r:)rr:s  r�__init__zExtension.__init__Ys��&����rc��tjtt�|j����}|j�|j��||_|S)z=Create a copy of this extension bound to another environment.)	�t�castr2�object�__new__�	__class__�__dict__�updater:)rr:�rvs   r�bindzExtension.bind\sE��
�V�I�v�~�~�d�n�=�=�
>�
>��
����4�=�)�)�)�$����	r�source�name�filenamec��|S)z�This method is called before the actual lexing and can be used to
        preprocess the source.  The `filename` is optional.  The return value
        must be the preprocessed source.
        r)rrGrHrIs    r�
preprocesszExtension.preprocesscs	���
r�streamrrc��|S)aIt's passed a :class:`~jinja2.lexer.TokenStream` that can be used
        to filter tokens returned.  This method has to return an iterable of
        :class:`~jinja2.lexer.Token`\s, but it doesn't have to return a
        :class:`~jinja2.lexer.TokenStream`.
        r)rrLs  r�
filter_streamzExtension.filter_streamls	���
r�parserrc��t���)aIf any of the :attr:`tags` matched this method is called with the
        parser as first argument.  The token the parser stream is pointing at
        is the name token that matched.  This method has to return one or a
        list of multiple nodes.
        )�NotImplementedError)rrOs  r�parsezExtension.parsevs��"�#�#�#r�linenoc�:�tj|j||���S)z�Return an attribute node for the current extension.  This is useful
        to pass constants on extensions to generated template code.

        ::

            self.attr('_my_attribute', lineno=lineno)
        �rS)r�ExtensionAttributer3)rrHrSs   r�attrzExtension.attr~s���'����f�M�M�M�Mr�args�kwargs�dyn_args�
dyn_kwargsc�p�|�g}|�g}tj|�||���|||||���S)zsCall a method of the extension.  This is a shortcut for
        :meth:`attr` + :class:`jinja2.nodes.Call`.
        NrU)r�CallrW)rrHrXrYrZr[rSs       r�call_methodzExtension.call_method�sS���<��D��>��F��z��I�I�d�6�I�*�*������

�
�
�	
r)rNr)NNNNN) r#r$r%�__doc__r>�ClassVarr&�__annotations__r7�setr8�Set�priorityrr<rF�OptionalrK�Union�IterablerNr�Node�ListrRr'rVrW�Expr�Keywordr]r^rrrr2r27s\���������$�
�3�����<�<�<�<��s�u�u�D�!�%��*�����H�'�K�'�D�'�'�'�'���������OS�����!"��C���<=�J�s�O��	������#��	
����
�7� 3�3�	4�����$�H�$�����Q�V�E�J�=O�1O�)P�$�$�$�$�48�
N�
N��
N�!"��C��
N�	�	!�
N�
N�
N�
N�04�48�+/�-1�"&�
�
��
��j����
�+�,�
��
�1�6�%�-�0�1�	
�
�*�U�Z�(�
��J�u�z�*�

��
�3��
�
��
�
�
�
�
�
rr2�	__contextrXrYrc�J�|j|�d��g|�Ri|��S)Nr)�call�resolve)rlrXrYs   r�_gettext_aliasrp�s4���9�>�)�+�+�I�6�6�H��H�H�H��H�H�Hr�funcc	�p��tdtdtdtjdtf�fd���}|S)Nrl�__string�	variablesrc�p��|��|��}|jjrt|��}||zSr)rn�eval_ctx�
autoescaper)rlrsrtrErqs    �rrz"_make_new_gettext.<locals>.gettext�s;���
�^�^�D�(�
+�
+����(�	�����B��I�~�r�rrr&r>�Any)rqrs` r�_make_new_gettextrz�sP�����7��c�����#�������\���Nrc
���tdtdtdtdtdtjdtf�fd���}|S)Nrl�
__singular�__plural�__numrtrc���|�d|��|��|||��}|jjrt	|��}||zS)N�num��
setdefaultrnrvrwr)rlr|r}r~rtrErqs      �rr"z$_make_new_ngettext.<locals>.ngettext�sU���	���U�E�*�*�*�
�^�^�D�*�h��
>�
>����(�	�����B��I�~�r�rrr&r'r>ry)rqr"s` r�_make_new_ngettextr��sl������������	�
�U��

�
������\���Orc�~��tdtdtdtdtjdtf
�fd���}|S)Nrl�__string_ctxrsrtrc���|�d|��|��||��}|jjrt	|��}||zS)Nr*r�)rlr�rsrtrErqs     �rr,z$_make_new_pgettext.<locals>.pgettext�sU���	���Y��5�5�5�
�^�^�D�,��
9�
9����(�	�����B��I�~�rrx)rqr,s` r�_make_new_pgettextr��s\����
��
�*-�
�9<�
�KL�5�
�	�
�
�
�
�
��\�
��Orc���tdtdtdtdtdtdtjdtf�fd���}|S)	Nrlr�r|r}r~rtrc����|�d|��|�d|��|��||||��}|jjrt	|��}||zS)Nr*r�r�)rlr�r|r}r~rtrErqs       �rr.z&_make_new_npgettext.<locals>.npgettext�so���	���Y��5�5�5����U�E�*�*�*�
�^�^�D�,�
�H�e�
L�
L����(�	�����B��I�~�rr�)rqr.s` r�_make_new_npgettextr��sy������������	�
���U�
�

�������\��$�rc���eZdZdZdhZdeddf�fd�Z	d%ddd	eje	ddfd
�Z
d%d	eje	ddfd�Z			d&deje
ge
fd
eje
e
ege
fd	eje	dejeje
e
ge
fdejeje
e
e
ege
fddfd�Zd'd�Zefdeje
ejfdeje
dejejee
ejeje
ejeje
dffffd�Zdddejejejejffd�Zefde
deje
de
fd�Zddde	dejeje
e
ffd�Zde
deje
d ej e
ej!fd!ejej!d"e	d#e	dej"fd$�Z#�xZ$S)(�InternationalizationExtensionz-This extension adds gettext support to Jinja.�transr:rNc����t���|��t|jd<|�|j|j|j|j|j	d���dS)Nr/F)�install_gettext_translations�install_null_translations�install_gettext_callables�uninstall_gettext_translations�extract_translations�newstyle_gettext)
�superr<rp�globals�extend�_install�
_install_null�_install_callables�
_uninstall�_extract�rr:rBs  �rr<z&InternationalizationExtension.__init__sm���
������%�%�%�#1���C� ����)-��&*�&8�&*�&=�+/�?�!%��"�
	�	
�	
�	
�	
�	
r�translations�_SupportedTranslations�newstylec���t|dd��}|�|j}t|dd��}|�|j}t|dd��}t|dd��}|�|||||���dS)N�ugettext�	ungettextr,r.)r�r,r.)�getattrrr"r�)rr�r�rr"r,r.s       rr�z&InternationalizationExtension._installs���
�,�
�D�9�9���?�"�*�G��<��d�;�;����#�,�H��<��T�:�:���L�+�t�<�<�	�����X��8�y�	 �	
�	
�	
�	
�	
rc
�^�ddl}|���}t|d��r|j}ndtdtdtfd�}t|d��r|j}n'dtdtdtd	tdtf
d
�}|�|j|j|||���dS)Nrr,�c�src��|Srr)r�r�s  rr,z=InternationalizationExtension._install_null.<locals>.pgettext*s���rr.�pr c��|dkr|n|S)Nrr)r�r�r�r s    rr.z>InternationalizationExtension._install_null.<locals>.npgettext1s����F�F�q�q��)r)rr"r�r,r.)	r�NullTranslations�hasattrr,r&r.r'r�r")rr�rr�r,r.s      rr�z+InternationalizationExtension._install_null s��������/�/�1�1���<��,�,�	�#�,�H�H�
�C�
�C�
�C�
�
�
�
��<��-�-�	*�$�.�I�I�
*�S�
*�S�
*�S�
*�S�
*�S�
*�
*�
*�
*�	
��� �(�!�*����	 �	
�	
�	
�	
�	
rrr"r,r.c��|�||j_|jjr@t|��}t|��}|�t	|��}|�t|��}|jj�||||���dS�N)rr"r,r.)r:r�rzr�r�r�r�rD)rrr"r�r,r.s      rr�z0InternationalizationExtension._install_callables<s�����08�D��-���,�	;�'��0�0�G�)�(�3�3�H��#�-�h�7�7���$�/�	�:�:�	��� �'�'��h��Y�	(�	
�	
�	
�	
�	
rc�P�dD]"}|jj�|d���#dSr�)r:r��pop)rr��keys   rr�z(InternationalizationExtension._uninstallTs:��C�	4�	4�C���$�(�(��d�3�3�3�3�	4�	4rrG�gettext_functions.c��t|t��r|j�|��}t	||��Sr)�
isinstancer&r:rR�extract_from_ast)rrGr�s   rr�z&InternationalizationExtension._extractXs=���f�c�"�"�	4��%�+�+�F�3�3�F���(9�:�:�:rrOrc	�l�t|j��j}d}d}d}i}d}|jjjdk�r�|r|j�d��|j�d��r�nX|j�d��}|j|vr+|�d|j�d�|jt�	��|jjjd
kr3t|j��|�
��x||j<}	n;|�|jdvr|jdk}��tj|jd
��x||j<}	|�ot|	tj��rHtjdd
��}|||j<tjtjdd��|	��}n|	}|jdk}|jjjdk���|j�d��d}
d}t!��}|�|d��\}
}|
r>|�|
��|�'tj|
dd
��}|
ddk}|jj�d��r�d}t|j��|jjjdkrf|j�d��}|j|vr+|�d|j�d�|jt�	��||j}|jdk}|j�d��|�|d��\}}
t|j��|�|��nt|j��|D]}||vrtj|d
��||<�|sd}n|�|�d|��|�|jjd}|r,|�|��}|
r|�|
��}
|�||
||t1|��|o|��}|�|��|�||gS|S)zParse a translatable tag.FN�	block_end�comma�colonrHztranslatable variable z defined twice.)�exc�assign)�trimmed�	notrimmedr��load�_trans�storer�Tr�name:pluralizezunknown variable z for pluralizationzpluralize without variables�ext.i18n.trimmed)�nextrLrS�current�type�expect�skip_if�value�failr�parse_expressionr�Namer�r]�Assignrb�_parse_blockrD�testr:�policies�_trim_whitespace�
_make_node�bool�
set_lineno)rrOrS�num_called_num�plural_expr�plural_expr_assignmentrtr��token�varr�have_plural�
referenced�singular_namesr�plural_namesrH�nodes                  rrRz#InternationalizationExtension.parsecs����f�m�$�$�+����
/3��;?��-/�	����m�#�(�K�7�7��
.��
�$�$�W�-�-�-��}�$�$�W�-�-�
���M�(�(��0�0�E��{�i�'�'����K�U�[�K�K�K��L�.������}�$�)�X�5�5��V�]�#�#�#�/5�/F�/F�/H�/H�H�	�%�+�&�����U�[�4L�%L�%L��+��2���/4�z�%�+�v�/N�/N�N�	�%�+�&���"��c�5�:�.�.�&�"'�*�X�v�">�">�K�-8�I�e�k�*�-2�\��
�8�W�5�5�s�.�.�*�*�#&�K�!&���!5��G�m�#�(�K�7�7�J	�
���[�)�)�)������U�U�
�$(�#4�#4�V�T�#B�#B� ����	<����n�-�-�-��"�#�j���):�F�C�C��!/��!2�e�!;���=� �%�%�&6�7�7�	 ��K��������}�$�)�[�8�8��
�,�,�V�4�4���;�i�/�/��K�K�M�E�K�M�M�M���2� ����
(���4��!&���!5���M� � ��-�-�-�#'�#4�#4�V�U�#C�#C� �L�&����������l�+�+�+�+��������	;�	;�D��9�$�$�"'�*�T�6�":�":�	�$����	?��K�K�
�
 ��K�K�5�v�>�>�>��?��&�/�0B�C�G��	7��,�,�X�6�6�H��
7��.�.�v�6�6��������������*�{�

�
��	
�������!�-�*�D�1�1��Kr�string�_ws_rec�R�|�d|�����S)N� )�sub�strip)rr�r�s   rr�z.InternationalizationExtension._trim_whitespace�s���z�z�#�v�|�|�~�~�.�.�.r�allow_pluralizec��g}g}	|jjjdkrN|�|jjj�dd����t
|j���nX|jjjdkr|t
|j��|j�d��j}|�|��|�d|�d���|j�d	��n�|jjjd
kr�t
|j��|jj�d��rn�|jj�d��r|rn^|�	d
��|�	d��n1|jj
r|�	d��ntd������|t|��fS)z1Parse until the next block tag with a given name.T�data�%�%%�variable_beginrHz%(z)s�variable_end�block_beginz
name:endtransr�z:a translatable section can have only one pluralize sectionz;control structures in translatable sections are not allowedzunclosed translation blockzinternal parser error)
rLr�r��appendr��replacer�r�r�r��eos�RuntimeErrorr
)rrOr�r��bufrHs      rr�z*InternationalizationExtension._parse_block�s����
���	<��}�$�)�V�3�3��
�
�6�=�0�6�>�>�s�D�I�I�J�J�J��V�]�#�#�#�#���&�+�/?�?�?��V�]�#�#�#��}�+�+�F�3�3�9���!�!�$�'�'�'��
�
�=��=�=�=�)�)�)��
�$�$�^�4�4�4�4���&�+�}�<�<��V�]�#�#�#��=�(�-�-�o�>�>����]�*�/�/�0@�A�A��&����K�K�T�������Q�������"�
<����8�9�9�9�9�"�#:�;�;�;�5	<�8�6�#�;�;�&�&rrrrtr��vars_referencedr�c�.�|jj}|s0|s.|�dd��}|r|�dd��}|�Atjdd��}tj|tj|��ggdd��}	nTtjdd��}
tj|
tj|��tj|��|ggdd��}	|rQ|���D];\}}|r|dkr�|	j�	tj
||�����<nYtj|	��}	|rCtj|	tj
d�|���D������}	tj|	g��S)	z/Generates a useful node from the data provided.r�r�Nrr�r"r�c�b�g|],\}}tjtj|��|����-Sr)r�Pair�Const)�.0r�r�s   r�
<listcomp>z<InternationalizationExtension._make_node.<locals>.<listcomp>6sB����� *��U�"�J�u�{�3�'7�'7��?�?���r)r:r�r�rr�r]r��itemsrYr�rk�MarkSafeIfAutoescape�Mod�Dict�Output)
rrrrtr�r�r�r�rr�r"r�r�s
             rr�z(InternationalizationExtension._make_node�s����#�4��
�	3�x�	3��'�'��c�2�2�H��
3�����c�2�2�����j��F�3�3�G��:�g���H�(=�(=�'>��D�$�O�O�D�D��z�*�f�5�5�H��:����X�&�&���F�(;�(;�[�I������D��	�'�o�o�/�/�
>�
>�
��U�"��c�U�l�l����"�"�5�=��e�#<�#<�=�=�=�=�
>��-�d�3�3�D��	
��y���J���.7�o�o�.?�.?����������|�T�F�#�#�#rr)NNN)r�r�rN)%r#r$r%r_r8rr<r>rer�r�r��Callabler&r'r�r�r0rfr�Template�Sequence�Iterator�Tupler�rhrirRr��Patternr�r�r�rjr�r��
__classcell__�rBs@rr�r��sK�������7�7��9�D�

�K�

�D�

�

�

�

�

�

�TX�
�
�4�
�@A�
�4�@P�
�	
�
�
�
�
�$
�
�a�j��&6�
�$�
�
�
�
�@&*�<@�GK�

�
���S�E�3�J�'�
��*�c�3��_�c�1�2�
��*�T�"�	
�
�*�Q�Z��c�
�C��8�9�
��:�a�j�#�s�C��)=�s�)B�C�D�

�
�
�
�
�
�04�4�4�4�.?�	;�	;����U�^�+�,�	;��:�c�?�	;�
��	���S�!�'�!�*�S�/�1�7�1�:�c�?�C�;O�3P�"P�Q�Q�R�
�		;�	;�	;�	;�q�H�q�����Q�V�E�J�=O�1O�)P�q�q�q�q�fFL�/�/�s�/�A�I�c�N�/�PS�/�/�/�/�#'��#'�15�#'�	
������c�!�	"�#'�#'�#'�#'�J>$��>$��
�3��>$��6�#�u�z�/�*�	>$�
�Z��
�+�>$��
>$��>$�
��>$�>$�>$�>$�>$�>$�>$�>$rr�c�2�eZdZdZdhZdddejfd�ZdS)�ExprStmtExtensionzrAdds a `do` tag to Jinja that works like the print statement just
    that it doesn't print the return value.
    �dorOrrc��tjt|j��j���}|���|_|S)NrU)r�ExprStmtr�rLrS�parse_tupler�)rrOr�s   rrRzExprStmtExtension.parseFs9���~�T�&�-�%8�%8�%?�@�@�@���&�&�(�(��	��rN)r#r$r%r_r8rr
rRrrrrr?sK��������
�6�D��H���������rrc�X�eZdZdZddhZdddejejej	ffd�Z
dS)	�LoopControlExtensionz/Adds break and continue to the template engine.�break�continuerOrrc��t|j��}|jdkrtj|j���Stj|j���S)NrrU)r�rLr�r�BreakrS�Continue)rrOr�s   rrRzLoopControlExtension.parseQsH���V�]�#�#���;�'�!�!��;�e�l�3�3�3�3��~�U�\�2�2�2�2rN)r#r$r%r_r8r>rfrrrrRrrrr
r
LsV������9�9��Z� �D�3�H�3�����e�n�1L�)M�3�3�3�3�3�3rr
c�(��eZdZdeddf�fd�Z�xZS)�
WithExtensionr:rNc���t���|��tjdtd���dS)NzZThe 'with' extension is deprecated and will be removed in Jinja 3.1. This is built in now.���
stacklevel�r�r<�warnings�warn�DeprecationWarningr�s  �rr<zWithExtension.__init__YsI���
������%�%�%��
�
0���		
�	
�	
�	
�	
�	
r�r#r$r%rr<rrs@rrrX�K�������
�K�
�D�
�
�
�
�
�
�
�
�
�
rrc�(��eZdZdeddf�fd�Z�xZS)�AutoEscapeExtensionr:rNc���t���|��tjdtd���dS)Nz`The 'autoescape' extension is deprecated and will be removed in Jinja 3.1. This is built in now.rrrr�s  �rr<zAutoEscapeExtension.__init__dsI���
������%�%�%��
�
;���		
�	
�	
�	
�	
�	
rrrs@rr r crrr c�B�eZdZdZdhZdddejfd�Zdede	fd�Z
d	S)
�DebugExtensiona�A ``{% debug %}`` tag that dumps the available variables,
    filters, and tests.

    .. code-block:: html+jinja

        <pre>{% debug %}</pre>

    .. code-block:: text

        {'context': {'cycler': <class 'jinja2.utils.Cycler'>,
                     ...,
                     'namespace': <class 'jinja2.utils.Namespace'>},
         'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd',
                     ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'],
         'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined',
                   ..., 'odd', 'sameas', 'sequence', 'string', 'undefined', 'upper']}

    .. versionadded:: 2.11.0
    �debugrOrrc���|j�d��j}tj��}|�d|g|���}tj|g|���S)Nz
name:debug�_renderrU)rLr�rSr�ContextReferencer^r�)rrOrSr*�results     rrRzDebugExtension.parse�s[����%�%�l�3�3�:���(�*�*���!�!�)�g�Y�v�!�F�F���|�V�H�V�4�4�4�4rr*c��|���t|jj�����t|jj�����d�}t
j|dd���S)N)r*�filters�testsrT)�depth�compact)�get_all�sortedr:r*�keysr+�pprint�pformat)rr*r(s   rr&zDebugExtension._render�sn�����(�(��d�.�6�;�;�=�=�>�>��D�,�2�7�7�9�9�:�:�
�
���~�f�A�t�<�<�<�<rN)r#r$r%r_r8rr�rRrr&r&rrrr#r#nsm��������(
�9�D�5�H�5���5�5�5�5�=�w�=�3�=�=�=�=�=�=rr#T�astr��babel_stylec#�K�|�tj��D�]Y}t|jtj��r|jj|vr�1g}|jD]f}t|tj��r5t|j	t��r|�|j	���Q|�d���g|jD]}|�d���|j
�|�d��|j�|�d��|std�|D����}|s��n+t!|��dkr	|d}nt|��}|j|jj|fV���[dS)a�Extract localizable strings from the given template node.  Per
    default this function returns matches in babel style that means non string
    parameters as well as keyword arguments are returned as `None`.  This
    allows Babel to figure out what you really meant if you are using
    gettext functions that allow keyword arguments for placeholder expansion.
    If you don't want that behavior set the `babel_style` parameter to `False`
    which causes only strings to be returned and parameters are always stored
    in tuples.  As a consequence invalid gettext calls (calls without a single
    string parameter or string parameters after non-string parameters) are
    skipped.

    This example explains the behavior:

    >>> from jinja2 import Environment
    >>> env = Environment()
    >>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}')
    >>> list(extract_from_ast(node))
    [(1, '_', 'foo'), (1, '_', ()), (1, 'ngettext', ('foo', 'bar', None))]
    >>> list(extract_from_ast(node, babel_style=False))
    [(1, '_', ('foo',)), (1, 'ngettext', ('foo', 'bar'))]

    For every string found this function yields a ``(lineno, function,
    message)`` tuple, where:

    * ``lineno`` is the number of the line on which the string was found,
    * ``function`` is the name of the ``gettext`` function used (if the
      string was extracted from embedded Python code), and
    *   ``message`` is the string, or a tuple of strings for functions
         with multiple string arguments.

    This extraction function operates on the AST and is because of that unable
    to extract any comments.  For comment support you have to use the babel
    extraction interface or extract comments yourself.
    Nc3�K�|]}|�|V��	dSrr)r��xs  r�	<genexpr>z#extract_from_ast.<locals>.<genexpr>�s"����<�<�a�a�m��m�m�m�m�<�<rrr)�find_allrr]r�r�r�rHrXr�r�r&r�rYrZr[�tuple�lenrS)r3r�r4r��strings�argr/�outs        rr�r��s�����V���U�Z�(�(�!/�!/���4�9�e�j�1�1�	��y�~�%6�6�6��+-���9�	%�	%�C��#�u�{�+�+�
%�
�3�9�c�0J�0J�
%����s�y�)�)�)�)����t�$�$�$�$���	!�	!�A��N�N�4� � � � ��=�$��N�N�4� � � ��?�&��N�N�4� � � ��		%��<�<�7�<�<�<�<�<�C��
��
��7�|�|�q� � ��a�j����G�n�n���k�4�9�>�3�.�.�.�.�.�C!/�!/rc��eZdZdZdejejeeefdejeddfd�Z	dedej
efd�Zd	edej
efd
�ZdS)�_CommentFinderz�Helper class to find comments in a token stream.  Can only
    find comments for gettext calls forwards.  Once the comment
    from line 4 is found, a comment for line 1 will not return a
    usable value.
    �tokens�comment_tagsrNc�>�||_||_d|_d|_dS)Nr)rArB�offset�last_lineno)rrArBs   rr<z_CommentFinder.__init__�s(�����(����������rrDc�*�	t|j|j|���D]\\}}}|dvrR	|�dd��\}}n#t$rY�1wxYw||jvr|���gc||_S�]g||_S#||_wxYw)N)�comment�linecommentr)�reversedrArD�split�
ValueErrorrB�rstrip)rrDr/�
token_type�token_value�prefixrGs       r�find_backwardsz_CommentFinder.find_backwards�s���
	!�.6���D�K�&�0�1�/�/�	
2�	
2�*��:�{��!;�;�;�!�*5�*;�*;�D�!�*D�*D������%�!�!�!� ��!������!2�2�2� '��� 0� 0�1�1�1�!�D�K�K��� �D�K�K��&�D�K� � � � s4�+B	�A�B	�
A�B	�A�"B	�?B	�		BrSc��|jr|j|krgSt|j|jd���D].\}\}}}||kr|�|j|z��cS�/|�t
|j����Sr)rBrE�	enumeraterArDrPr;)rrS�idx�token_linenor/s     r�
find_commentsz_CommentFinder.find_commentss���� �	�D�$4�v�$=�$=��I�)2�4�;�t�{�}�}�3M�)N�)N�	>�	>�%�C�%�,��1��f�$�$��*�*�4�;��+<�=�=�=�=�=�%��"�"�3�t�{�#3�#3�4�4�4r)
r#r$r%r_r>rrr'r&r<rirPrUrrrr@r@�s�����������j����c�3��!7�8��HI�
�SV���	
�����!�S�!�Q�V�C�[�!�!�!�!� 5�C�5�A�F�3�K�5�5�5�5�5�5rr@�fileobj�keywordsrB�optionsc#�@K�i}|�dd���d��D]+}|���}|s�d|t|��<�,t|vr
d|t<ddt
jttfdtdtd	tfd
�}||dd��}t|�d
tj��|�dtj��|�dtj
��|�dtj��|�dtj��|�dtj��|�d��ptj|�d��ptj||dtj��||dtj��tj||dtj��t/|��dd���}||d��r
d|jd<||d��rd|_|����|�dd����}		|�|	��}
t;|�|�|	������}n#t@$r|s�YdSwxYwtC||��}tE|
|��D]!\}
}}|
|||�#|
��fV��"dS) aBabel extraction method for Jinja templates.

    .. versionchanged:: 2.3
       Basic support for translation comments was added.  If `comment_tags`
       is now set to a list of keywords for extraction, the extractor will
       try to find the best preceding comment that begins with one of the
       keywords.  For best results, make sure to not have more than one
       gettext call in one line of code and the matching comment in the
       same line or the line before.

    .. versionchanged:: 2.5.1
       The `newstyle_gettext` flag can be set to `True` to enable newstyle
       gettext calls.

    .. versionchanged:: 2.7
       A `silent` option can now be provided.  If set to `False` template
       syntax errors are propagated instead of being ignored.

    :param fileobj: the file-like object the messages should be extracted from
    :param keywords: a list of keywords (i.e. function names) that should be
                     recognized as translation functions
    :param comment_tags: a list of translator tags to search for and include
                         in the results.
    :param options: a dictionary of additional options (optional)
    :return: an iterator over ``(lineno, funcname, message, comments)`` tuples.
             (comments will be empty currently)
    �
extensions��,NFrXr��defaultrc�p�|�|t|�������dvS)N>�1�on�yes�true)�getr&�lower)rXr�r]s   r�getboolzbabel_extract.<locals>.getbool?s.���{�{�3��G���-�-�3�3�5�5�9S�S�Sr�silentT�block_start_string�block_end_string�variable_start_string�variable_end_string�comment_start_string�comment_end_string�line_statement_prefix�line_comment_prefix�trim_blocks�
lstrip_blocks�keep_trailing_newliner)�
cache_size�auto_reloadr�r�r��encodingzutf-8)F)$rcrJr�r
r�r>�Mappingr&r�rr�BLOCK_START_STRING�BLOCK_END_STRING�VARIABLE_START_STRING�VARIABLE_END_STRING�COMMENT_START_STRING�COMMENT_END_STRING�LINE_STATEMENT_PREFIX�LINE_COMMENT_PREFIX�TRIM_BLOCKS�
LSTRIP_BLOCKS�NEWLINE_SEQUENCE�KEEP_TRAILING_NEWLINEr:r�r��read�decoderR�list�lexrKr	r@r�rU)rVrWrBrXrZ�extension_namererfr:rGr�rA�finderrSrqrs                r�
babel_extractr�
s2����J35�J�!�+�+�l�B�7�7�=�=�c�B�B�9�9��'�-�-�/�/���	��48�
�=��0�0�1�1�$�J�6�6�48�
�0�1�T�T���3��8�,�T�3�T��T�RV�T�T�T�T��W�W�h��
-�
-�F�����(�(�*E�F�F����&��(A�B�B����+�X�-K�L�L����)�8�+G�H�H����*�H�,I�J�J����(�(�*E�F�F����+�,�,�N��0N����)�*�*�J�h�.J������(<�=�=�����(�*@�A�A��!����0�(�2P�Q�Q�
�j��������K�$�w�w�	�"�"�8�37���/�0��w�w�*�+�+�,�'+��$�
�\�\�^�^�
"�
"�7�;�;�z�7�#C�#C�
D�
D�F��� � ��(�(���k�o�o�k�&<�&<�V�&D�&D�E�E�F�F���������	�����	�����F�L�
1�
1�F�!1�$��!A�!A�B�B����g��d�G�V�%9�%9�&�%A�%A�A�A�A�A�A�B�Bs�=A
K�
K�K)Jr_r1�re�typingr>r�
markupsaferr[rrr:r�
exceptionsrr	�runtimer
rr�utilsr
r�
TYPE_CHECKING�typing_extensions�te�lexerrrrOr�Protocolrr)rfr�r0rr&ra�compiler�r2ryrpr�rzr'r�r�r�r�rr
rr r#r�rr�rrer�r@�BinaryIOr�rir��i18nr�loopcontrols�with_rwr$rrr�<module>r�s��8�8�8�
�
�
�
�	�	�	�	���������������������������$�$�$�$�$�$�.�.�.�.�.�.�+�+�+�+�+�+������������������� � � � � � ��������?�O�"�"�"�"�������"�"�"�"�"�"������������R�[���������1�����W�%7�9M�%M�N��
(��1�7�3��8�$����
���K�	 �	 ��j
�j
�j
�j
�j
�j
�j
�j
�Z�I��I� �u�I�01��I��W�Q�U�I�
��I�I�I���I��A�J��u�c�z�2��q�z�#�s�(�7K������Q�Z��c�3���(<�=��!�*�S�RU�X�BV�����&�Q�Z��c�
�C��8��Q�Z��S��=Q�����"�
�*�c�3��S�)�3�.�
/���Z��S�������2F$�F$�F$�F$�F$�I�F$�F$�F$�R

�
�
�
�
�	�
�
�
�	3�	3�	3�	3�	3�9�	3�	3�	3�
�
�
�
�
�I�
�
�
�
�
�
�
�
�)�
�
�
�%=�%=�%=�%=�%=�Y�%=�%=�%=�T*;��L/�L/�	��L/��z�#��L/��L/��Z��G�C��a�g�a�j��o�q�w�q�z�#���7K�/L�L�M�M�N��	L/�L/�L/�L/�^%5�%5�%5�%5�%5�%5�%5�%5�PYB�
�Z�YB��j��o�YB��*�S�/�YB��V�C���J�
�	YB�
�Z��G��S�!�'�!�*�S�/�1�7�1�:�c�?�C�3G�+H�H�I�1�6�RU�;�V���YB�YB�YB�YB�z%����#����
 �
����r

Hacked By AnonymousFox1.0, Coded By AnonymousFox