GRAYBYTE WORDPRESS FILE MANAGER3638

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/imunify360/venv/lib/python3.11/site-packages/jinja2/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/imunify360/venv/lib/python3.11/site-packages/jinja2//nativetypes.py
from ast import literal_eval
from itertools import chain
from itertools import islice

from . import nodes
from ._compat import text_type
from .compiler import CodeGenerator
from .compiler import has_safe_repr
from .environment import Environment
from .environment import Template


def native_concat(nodes):
    """Return a native Python type from the list of compiled nodes. If
    the result is a single node, its value is returned. Otherwise, the
    nodes are concatenated as strings. If the result can be parsed with
    :func:`ast.literal_eval`, the parsed value is returned. Otherwise,
    the string is returned.

    :param nodes: Iterable of nodes to concatenate.
    """
    head = list(islice(nodes, 2))

    if not head:
        return None

    if len(head) == 1:
        raw = head[0]
    else:
        raw = u"".join([text_type(v) for v in chain(head, nodes)])

    try:
        return literal_eval(raw)
    except (ValueError, SyntaxError, MemoryError):
        return raw


class NativeCodeGenerator(CodeGenerator):
    """A code generator which renders Python types by not adding
    ``to_string()`` around output nodes.
    """

    @staticmethod
    def _default_finalize(value):
        return value

    def _output_const_repr(self, group):
        return repr(u"".join([text_type(v) for v in group]))

    def _output_child_to_const(self, node, frame, finalize):
        const = node.as_const(frame.eval_ctx)

        if not has_safe_repr(const):
            raise nodes.Impossible()

        if isinstance(node, nodes.TemplateData):
            return const

        return finalize.const(const)

    def _output_child_pre(self, node, frame, finalize):
        if finalize.src is not None:
            self.write(finalize.src)

    def _output_child_post(self, node, frame, finalize):
        if finalize.src is not None:
            self.write(")")


class NativeEnvironment(Environment):
    """An environment that renders templates to native Python types."""

    code_generator_class = NativeCodeGenerator


class NativeTemplate(Template):
    environment_class = NativeEnvironment

    def render(self, *args, **kwargs):
        """Render the template to produce a native Python type. If the
        result is a single node, its value is returned. Otherwise, the
        nodes are concatenated as strings. If the result can be parsed
        with :func:`ast.literal_eval`, the parsed value is returned.
        Otherwise, the string is returned.
        """
        vars = dict(*args, **kwargs)

        try:
            return native_concat(self.root_render_func(self.new_context(vars)))
        except Exception:
            return self.environment.handle_exception()


NativeEnvironment.template_class = NativeTemplate

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 11 2025 07:53:06
root / root
0755
__pycache__
--
July 02 2025 08:36:55
root / root
0755
__init__.py
1.513 KB
June 09 2025 11:12:39
root / root
0644
_compat.py
3.116 KB
June 09 2025 11:12:39
root / root
0644
_identifier.py
1.733 KB
June 09 2025 11:12:39
root / root
0644
asyncfilters.py
4.15 KB
June 09 2025 11:12:39
root / root
0644
asyncsupport.py
7.04 KB
June 09 2025 11:12:39
root / root
0644
bccache.py
11.854 KB
June 09 2025 11:12:39
root / root
0644
compiler.py
64.73 KB
June 09 2025 11:12:39
root / root
0644
constants.py
1.424 KB
June 09 2025 11:12:39
root / root
0644
debug.py
8.329 KB
June 09 2025 11:12:39
root / root
0644
defaults.py
1.1 KB
June 09 2025 11:12:39
root / root
0644
environment.py
49.442 KB
June 09 2025 11:12:39
root / root
0644
exceptions.py
5.298 KB
June 09 2025 11:12:39
root / root
0644
ext.py
25.821 KB
June 09 2025 11:12:39
root / root
0644
filters.py
40.444 KB
June 09 2025 11:12:39
root / root
0644
idtracking.py
8.995 KB
June 09 2025 11:12:39
root / root
0644
lexer.py
29.62 KB
June 09 2025 11:12:39
root / root
0644
loaders.py
17.252 KB
June 09 2025 11:12:39
root / root
0644
meta.py
4.034 KB
June 09 2025 11:12:39
root / root
0644
nativetypes.py
2.688 KB
June 09 2025 11:12:39
root / root
0644
nodes.py
30.366 KB
June 09 2025 11:12:39
root / root
0644
optimizer.py
1.423 KB
June 09 2025 11:12:39
root / root
0644
parser.py
34.824 KB
June 09 2025 11:12:39
root / root
0644
runtime.py
29.9 KB
June 09 2025 11:12:39
root / root
0644
sandbox.py
16.726 KB
June 09 2025 11:12:39
root / root
0644
tests.py
4.687 KB
June 09 2025 11:12:39
root / root
0644
utils.py
21.994 KB
June 09 2025 11:12:39
root / root
0644
visitor.py
3.164 KB
June 09 2025 11:12:39
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF