$23 GRAYBYTE WORDPRESS FILE MANAGER $70

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/imunify360/venv/lib/python3.11/site-packages/jinja2/

HOME
Current File : /opt/imunify360/venv/lib/python3.11/site-packages/jinja2//optimizer.py
# -*- coding: utf-8 -*-
"""The optimizer tries to constant fold expressions and modify the AST
in place so that it should be faster to evaluate.

Because the AST does not contain all the scoping information and the
compiler has to find that out, we cannot do all the optimizations we
want. For example, loop unrolling doesn't work because unrolled loops
would have a different scope. The solution would be a second syntax tree
that stored the scoping rules.
"""
from . import nodes
from .visitor import NodeTransformer


def optimize(node, environment):
    """The context hint can be used to perform an static optimization
    based on the context given."""
    optimizer = Optimizer(environment)
    return optimizer.visit(node)


class Optimizer(NodeTransformer):
    def __init__(self, environment):
        self.environment = environment

    def generic_visit(self, node, *args, **kwargs):
        node = super(Optimizer, self).generic_visit(node, *args, **kwargs)

        # Do constant folding. Some other nodes besides Expr have
        # as_const, but folding them causes errors later on.
        if isinstance(node, nodes.Expr):
            try:
                return nodes.Const.from_untrusted(
                    node.as_const(args[0] if args else None),
                    lineno=node.lineno,
                    environment=self.environment,
                )
            except nodes.Impossible:
                pass

        return node


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2026 8.59 AM
root / root
0755
__pycache__
--
3 Mar 2026 8.59 AM
root / root
0755
__init__.py
1.513 KB
13 Feb 2026 12.40 PM
root / root
0644
_compat.py
3.116 KB
13 Feb 2026 12.40 PM
root / root
0644
_identifier.py
1.733 KB
13 Feb 2026 12.40 PM
root / root
0644
asyncfilters.py
4.15 KB
13 Feb 2026 12.40 PM
root / root
0644
asyncsupport.py
7.04 KB
13 Feb 2026 12.40 PM
root / root
0644
bccache.py
11.854 KB
13 Feb 2026 12.40 PM
root / root
0644
compiler.py
64.73 KB
13 Feb 2026 12.40 PM
root / root
0644
constants.py
1.424 KB
13 Feb 2026 12.40 PM
root / root
0644
debug.py
8.329 KB
13 Feb 2026 12.40 PM
root / root
0644
defaults.py
1.1 KB
13 Feb 2026 12.40 PM
root / root
0644
environment.py
49.442 KB
13 Feb 2026 12.40 PM
root / root
0644
exceptions.py
5.298 KB
13 Feb 2026 12.40 PM
root / root
0644
ext.py
25.821 KB
13 Feb 2026 12.40 PM
root / root
0644
filters.py
40.444 KB
13 Feb 2026 12.40 PM
root / root
0644
idtracking.py
8.995 KB
13 Feb 2026 12.40 PM
root / root
0644
lexer.py
29.62 KB
13 Feb 2026 12.40 PM
root / root
0644
loaders.py
17.252 KB
13 Feb 2026 12.40 PM
root / root
0644
meta.py
4.034 KB
13 Feb 2026 12.40 PM
root / root
0644
nativetypes.py
2.688 KB
13 Feb 2026 12.40 PM
root / root
0644
nodes.py
30.366 KB
13 Feb 2026 12.40 PM
root / root
0644
optimizer.py
1.423 KB
13 Feb 2026 12.40 PM
root / root
0644
parser.py
34.824 KB
13 Feb 2026 12.40 PM
root / root
0644
runtime.py
29.9 KB
13 Feb 2026 12.40 PM
root / root
0644
sandbox.py
16.726 KB
13 Feb 2026 12.40 PM
root / root
0644
tests.py
4.687 KB
13 Feb 2026 12.40 PM
root / root
0644
utils.py
21.994 KB
13 Feb 2026 12.40 PM
root / root
0644
visitor.py
3.164 KB
13 Feb 2026 12.40 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF