Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/jinja2/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/jinja2/__pycache__/ext.cpython-310.pyc
o

�˝`z}�@sjUdZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddl
mZdd	l
mZdd
lmZddlmZddlmZdd
lmZddlmZejr�ddlZddlmZddlmZddlmZGdd�dej�Z Gdd�de �Z!ej"e e!fZ#dZ$ej%e&dfe'd<e�(d�Z)Gdd�d�Z*ededej+dej+dej"ej+effd d!��Z,d"ej-e&ge&fdej-de&ffd#d$�Z.d"ej-e&e&e/ge&fdej-de&ffd%d&�Z0d"ej-e&e&ge&fdej-de&ffd'd(�Z1d"ej-e&e&e&e/ge&fdej-de&ffd)d*�Z2Gd+d,�d,e*�Z3Gd-d.�d.e*�Z4Gd/d0�d0e*�Z5Gd1d2�d2e*�Z6Gd3d4�d4e*�Z7Gd5d6�d6e*�Z8e$d7fd8e
j9d9ej:e&d:e;dej<ej%e/e&ej"ej=e&ej%ej=e&dffffd;d<�Z>Gd=d>�d>�Z?d?ej@d@ej:e&dAej:e&dBejAe&ej+fdej<ej%e/e&ej"ej=e&ej%ej=e&dffejBe&ff
dCdD�ZCe3ZDe4ZEe5ZFe6ZGe7ZHe8ZIdS)Ez2Extension API for adding custom tags and behavior.�N)�Markup�)�defaults)�nodes)�Environment)�TemplateAssertionError)�TemplateSyntaxError)�concat)�Context)�	Undefined)�
import_string)�pass_context)�Token)�TokenStream)�Parserc@s8eZdZdedefdd�Zdedededefdd	�Zd
S)�_TranslationsBasic�message�returncC�dS�N�)�selfrrr�,/usr/lib/python3/dist-packages/jinja2/ext.py�gettext�z_TranslationsBasic.gettext�singular�plural�ncCrrr)rrrrrrr�ngettextrz_TranslationsBasic.ngettextN)�__name__�
__module__�__qualname__�strr�intrrrrrrsrc
@s@eZdZdededefdd�Zdededededef
d	d
�ZdS)�_TranslationsContext�contextrrcCrrr)rr%rrrr�pgettext"rz_TranslationsContext.pgettextrrrcCrrr)rr%rrrrrr�	npgettext%rz_TranslationsContext.npgettextN)rr r!r"r&r#r'rrrrr$!s"r$)�_rrr&r'.�GETTEXT_FUNCTIONSz\s*\n\s*c@s`eZdZUdZejeed<d%dd�Ze	�Z
ejeed<dZd	e
ddfd
d�Zd	e
ddfdd
�Z	d&dedejedejedefdd�Zdddejdejdffdd�Zdddejejejejffdd�Z	d&dedejedejfdd�Z					d'dedejejejd ejejejd!ejejd"ejejdejedejfd#d$�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).
    �
identifierrNcCs|j�d|j��|_dS)N�.)r rr+)�clsrrr�__init_subclass__L�zExtension.__init_subclass__�tags�d�environmentcCs
||_dSr)r2�rr2rrr�__init__Ys
zExtension.__init__cCs,t�tt�|j��}|j�|j�||_|S)z=Create a copy of this extension bound to another environment.)	�t�castr*�object�__new__�	__class__�__dict__�updater2)rr2�rvrrr�bind\szExtension.bind�source�name�filenamecC�|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)rr>r?r@rrr�
preprocesscszExtension.preprocess�streamrrcCrA)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)rrCrrr�
filter_streamlszExtension.filter_stream�parserrcCst��)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)rrErrr�parsevszExtension.parse�linenocCstj|j||d�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)
        �rH)r�ExtensionAttributer+)rr?rHrrr�attr~s
zExtension.attr�args�kwargs�dyn_args�
dyn_kwargscCs8|durg}|durg}tj|j||d�|||||d�S)zsCall a method of the extension.  This is a shortcut for
        :meth:`attr` + :class:`jinja2.nodes.Call`.
        NrI)r�CallrK)rr?rLrMrNrOrHrrr�call_method�s�zExtension.call_method)rNr)NNNNN) rr r!�__doc__r5�ClassVarr"�__annotations__r.�setr0�Set�priorityrr4r=�OptionalrB�Union�IterablerDr�Node�ListrGr#rJrK�Expr�KeywordrPrQrrrrr*7sh

����
�	�
�&
	���
�����
�
���r*�	__contextrLrMrcOs|j|�d�g|�Ri|��S)Nr)�call�resolve)r_rLrMrrr�_gettext_alias�srb�funcc	s(tdtdtdtjdtf�fdd��}|S)Nr_�__string�	variablesrcs$|��|�}|jjrt|�}||Sr)r`�eval_ctx�
autoescaper)r_rdrer<�rcrrr�sz"_make_new_gettext.<locals>.gettext�r
r
r"r5�Any)rcrrrhr�_make_new_gettext�s"	rkc
s0tdtdtdtdtdtjdtf�fdd��}|S)	Nr_�
__singular�__plural�__numrercs4|�d|�|��|||�}|jjrt|�}||S)N�num��
setdefaultr`rfrgr)r_rlrmrnrer<rhrrr�s
z$_make_new_ngettext.<locals>.ngettext�r
r
r"r#r5rj)rcrrrhr�_make_new_ngettext�s������rscs,tdtdtdtdtjdtf
�fdd��}|S)Nr_�__string_ctxrdrercs2|�d|�|��||�}|jjrt|�}||S)Nr%rp)r_rtrdrer<rhrrr&�s
z$_make_new_pgettext.<locals>.pgettextri)rcr&rrhr�_make_new_pgettext�s�����rucs4tdtdtdtdtdtdtjdtf�fdd	��}|S)
Nr_rtrlrmrnrercsB|�d|�|�d|�|��||||�}|jjrt|�}||S)Nr%rorp)r_rtrlrmrnrer<rhrrr'�s	z&_make_new_npgettext.<locals>.npgettextrr)rcr'rrhr�_make_new_npgettext�s"�������rvcs�eZdZdZdhZdeddf�fdd�Z	d/dd	d
eje	ddfdd�Z
d/d
eje	ddfd
d�Z			d0deje
ge
fdeje
e
ege
fd
eje	dejeje
e
ge
fdejeje
e
e
ege
fddfdd�Zd1dd�Zefdeje
ejfdeje
dejejee
ejeje
ejeje
dffffdd�Zdddejejejejffdd�Zefd e
d!eje
de
fd"d#�Zddd$e	dejeje
e
ffd%d&�Zd'e
d(eje
d)ej e
ej!fd*ejej!d+e	d,e	dej"fd-d.�Z#�Z$S)2�InternationalizationExtensionz-This extension adds gettext support to Jinja.�transr2rNcs:t��|�t|jd<|j|j|j|j|j|j	dd�dS)Nr(F)�install_gettext_translations�install_null_translations�install_gettext_callables�uninstall_gettext_translations�extract_translations�newstyle_gettext)
�superr4rb�globals�extend�_install�
_install_null�_install_callables�
_uninstall�_extractr3�r9rrr4s

�z&InternationalizationExtension.__init__�translations�_SupportedTranslations�newstylecCsdt|dd�}|dur
|j}t|dd�}|dur|j}t|dd�}t|dd�}|j|||||d�dS)N�ugettext�	ungettextr&r')r�r&r')�getattrrrr�)rr�r�rrr&r'rrrr�s

�z&InternationalizationExtension._installc
Cs�ddl}|��}t|d�r|j}ndtdtdtfdd�}t|d�r%|j}ndtdtd	td
tdtf
dd�}|j|j|j|||d
�dS)Nrr&�c�srcSrArr)r�r�rrrr&*rz=InternationalizationExtension._install_null.<locals>.pgettextr'�prcSs|dkr|S|S)Nrr)r�r�r�rrrrr'1�z>InternationalizationExtension._install_null.<locals>.npgettext)rrr�r&r')	r�NullTranslations�hasattrr&r"r'r#r�r)rr�rr�r&r'rrrr� s


�z+InternationalizationExtension._install_nullrrr&r'cCsb|dur||j_|jjr$t|�}t|�}|durt|�}|dur$t|�}|jjj||||d�dS�N)rrr&r')r2r~rkrsrurvr�r;)rrrr�r&r'rrrr�<s
�z0InternationalizationExtension._install_callablescCsdD]
}|jj�|d�qdSr�)r2r��pop)rr��keyrrrr�Ts�z(InternationalizationExtension._uninstallr>�gettext_functions.cCs t|t�r|j�|�}t||�Sr)�
isinstancer"r2rG�extract_from_ast)rr>r�rrrr�Xs

z&InternationalizationExtension._extractrErcCst|j�j}d}d}d}i}d}|jjjdkr�|r|j�d�|j�d�r&nx|j�d�}|j|vr?|jd|j�d�|jt	d	�|jjjd
krUt|j�|�
�||j<}	n|durd|jdvrd|jdk}qt�|jd
�||j<}	|dur�t
|	tj�r�t�dd
�}|||j<t�t�dd�|	�}n|	}|jdk}|jjjdks|j�d�d}
d}t�}|�|d�\}
}|
r�|�|
�|dur�t�|
dd
�}|
ddk}|jj�d��rd}t|j�|jjjdk�r|j�d�}|j|vr�|jd|j�d�|jt	d	�||j}|jdk}|j�d�|�|d�\}}
t|j�|�|�nt|j�|D]}||v�r5t�|d
�||<�q&|�s=d}n|du�rH|�d|�|du�rS|jjd}|�rc|�|�}|
�rc|�|
�}
|�||
||t|�|�op|�}|�|�|du�r�||gS|S)zParse a translatable tag.FN�	block_end�comma�colonr?ztranslatable variable z defined twice.)�exc�assign)�trimmed�	notrimmedr��load�_trans�storeroTr�name:pluralizezunknown variable z for pluralizationzpluralize without variables�ext.i18n.trimmed)�nextrCrH�current�type�expect�skip_if�value�failr�parse_expressionr�Namer�rP�AssignrU�_parse_blockr;�testr2�policies�_trim_whitespace�
_make_node�bool�
set_lineno)rrErH�num_called_num�plural_expr�plural_expr_assignmentrer��token�varr�have_plural�
referenced�singular_namesr�plural_namesr?�noderrrrGcs�
�


�
�%


�




�



�

z#InternationalizationExtension.parse�string�_ws_recCs|�d|���S)N� )�sub�strip)rr�r�rrrr��r�z.InternationalizationExtension._trim_whitespace�allow_pluralizecCsg}g}	|jjjdkr|�|jjj�dd��t|j�n_|jjjdkrFt|j�|j�d�j}|�|�|�d|�d��|j�d	�n7|jjjd
krot|j�|jj�d�rZn$|jj�d�ri|rdn|�	d
�|�	d�n|jj
ry|�	d�ntd��q|t|�fS)z1Parse until the next block tag with a given name.T�data�%�%%�variable_beginr?z%(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)
rCr�r��appendr��replacer�r�r�r��eos�RuntimeErrorr	)rrEr�r��bufr?rrrr��s<


���z*InternationalizationExtension._parse_blockrrrer��vars_referencedr�c
Cs|jj}|s|s|�dd�}|r|�dd�}|dur.t�dd�}t�|t�|�ggdd�}	nt�dd�}
t�|
t�|�t�|�|ggdd�}	|rc|��D]\}}|rW|dkrWqL|	j�	t�
||��qLnt�|	�}	|rzt�|	t�
dd	�|��D���}	t�|	g�S)
z/Generates a useful node from the data provided.r�r�Nrr�rrocSs"g|]
\}}t�t�|�|��qSr)r�Pair�Const)�.0r�r�rrr�
<listcomp>6s��z<InternationalizationExtension._make_node.<locals>.<listcomp>)r2r~r�rr�rPr��itemsrMr�r^�MarkSafeIfAutoescape�Mod�Dict�Output)
rrrrer�r�r�r�rr�rr�r�rrrr��sB
��
���	z(InternationalizationExtension._make_noder)NNN)r�r�rN)%rr r!rRr0rr4r5rXr�r�r��Callabler"r#r�r�r)rYr�Template�Sequence�Iterator�Tupler�r[r\rGr��Patternr�r�r�r]r�r��
__classcell__rrr�rrw�s�	
���
� ������
�
���.�
�& s��
�%���
����rwc@s*eZdZdZdhZdddejfdd�ZdS)	�ExprStmtExtensionzrAdds a `do` tag to Jinja that works like the print statement just
    that it doesn't print the return value.
    �dorErrcCs"tjt|j�jd�}|��|_|S)NrI)r�ExprStmtr�rCrH�parse_tupler�)rrEr�rrrrGFs
zExprStmtExtension.parseN)rr r!rRr0rr�rGrrrrr�?sr�c@s8eZdZdZddhZdddejejej	ffdd�Z
d	S)
�LoopControlExtensionz/Adds break and continue to the template engine.�break�continuerErrcCs0t|j�}|jdkrtj|jd�Stj|jd�S)Nr�rI)r�rCr�r�BreakrH�Continue)rrEr�rrrrGQs

zLoopControlExtension.parseN)rr r!rRr0r5rYrr�r�rGrrrrr�Ls$r�c�&eZdZdeddf�fdd�Z�ZS)�
WithExtensionr2rNc� t��|�tjdtdd�dS)NzZThe 'with' extension is deprecated and will be removed in Jinja 3.1. This is built in now.���
stacklevel�rr4�warnings�warn�DeprecationWarningr3r�rrr4Y�
�zWithExtension.__init__�rr r!rr4r�rrr�rr�X�r�cr�)�AutoEscapeExtensionr2rNcr�)Nz`The 'autoescape' extension is deprecated and will be removed in Jinja 3.1. This is built in now.r�r�r�r3r�rrr4dr�zAutoEscapeExtension.__init__r�rrr�rr�cr�r�c@s<eZdZdZdhZdddejfdd�Zdede	fd	d
�Z
dS)�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
    �debugrErrcCs8|j�d�j}t��}|jd|g|d�}tj|g|d�S)Nz
name:debug�_renderrI)rCr�rHr�ContextReferencerQr�)rrErHr%�resultrrrrG�szDebugExtension.parser%cCs8|��t|jj���t|jj���d�}tj|ddd�S)N)r%�filters�testsr�T)�depth�compact)�get_all�sortedr2r��keysr�pprint�pformat)rr%r�rrrr��s
�zDebugExtension._renderN)rr r!rRr0rr�rGr
r"r�rrrrr�ns
r�T�astr��babel_styleccs�|�tj�D]v}t|jtj�r|jj|vrqg}|jD]}t|tj�r1t|j	t
�r1|�|j	�q|�d�q|jD]}|�d�q:|j
durL|�d�|jdurV|�d�|setdd�|D��}|sdqnt|�dkrp|d}nt|�}|j|jj|fVqdS)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.
    Ncss�|]	}|dur|VqdSrr)r��xrrr�	<genexpr>�s�z#extract_from_ast.<locals>.<genexpr>rr)�find_allrrPr�r�r�r?rLr�r�r"r�rMrNrO�tuple�lenrH)rr�r	r��strings�argr(�outrrrr��s6�+�





�
�r�c@sneZdZdZdejejeeefdejeddfdd�Z	dedej
efd	d
�Zdedej
efdd
�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_tagsrNcCs||_||_d|_d|_dS)Nr)rr�offset�last_lineno)rrrrrrr4�s
z_CommentFinder.__init__rc	Cs�z>t|j|j|��D]-\}}}|dvr8z
|�dd�\}}Wn	ty'Yqw||jvr8|��gW||_SqgW||_S||_w)N)�comment�linecommentr)�reversedrr�split�
ValueErrorr�rstrip)rrr(�
token_type�token_value�prefixrrrr�find_backwards�s ��
��z_CommentFinder.find_backwardsrHcCsd|jr|j|kr
gSt|j|jd��D]\}\}}}||kr)|�|j|�Sq|�t|j��Sr)rr�	enumeraterrr r)rrH�idx�token_linenor(rrr�
find_commentss"�z_CommentFinder.find_comments)
rr r!rRr5r�r�r#r"r4r\r r$rrrrr�s��
�r�fileobj�keywordsr�optionsccs��i}|�dd��d�D]}|��}|sqd|t|�<qt|vr$d|t<d dtjttfdtdtd	tfd
d�}||dd
�}t	|�dt
j�|�dt
j�|�dt
j
�|�dt
j�|�dt
j�|�dt
j�|�d�pit
j|�d�ppt
j||dt
j�||dt
j�t
j||dt
j�t|�ddd�}||d�r�d
|jd<||d�r�d
|_|���|�dd��}	z|�|	�}
t|�|�|	���}Wn
t y�|sĂYdSwt!||�}t"|
|�D]\}
}}|
|||�#|
�fVq�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��,NFr'r��defaultrcSs|�|t|����dvS)N>�1�on�yes�true)�getr"�lower)r'r�r+rrr�getbool?r/zbabel_extract.<locals>.getbool�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)$r0rr�rrwr5�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�decoderG�list�lexrBrrr�r$)r%r&rr'r(�extension_namer2r3r2r>r�r�finderrHrcrrrr�
babel_extract
sZ�%&�



�
�rU)JrRr�re�typingr5r��
markupsaferr)rrr2r�
exceptionsrr�runtimer	r
r�utilsrr
�
TYPE_CHECKING�typing_extensions�te�lexerrrrEr�Protocolrr$rYr�r)r�r"rT�compiler�r*rjrbr�rkr#rsrurvrwr�r�r�r�r�r�r�r�r�rXr�r�BinaryIOr�r\rU�i18nr��loopcontrols�with_rgr�rrrr�<module>s�
m����(,*�
�K
*����.�
�O(����0��
�]

Spamworldpro Mini