⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.24
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3.9
/
site-packages
/
jinja2
/
__pycache__
/
View File Name :
loaders.cpython-39.opt-1.pyc
a `E @ s0 d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddl m Z ddl mZ dd l mZ dd l m Z ddlmZ ddlmZ dd lmZ dd ZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZdS )"zKAPI and implementations for loading templates from different data sources. N)sha1)path) ModuleType )abcfspath) iteritems)string_types)TemplateNotFound)internalcode)open_if_existsc C s\ g }| dD ]H}tj|v s6tjr,tj|v s6|tjkr@t| q|r|dkr|| q|S )zSplit a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. /.)splitr sepaltseppardirr append)templatepiecesZpiece r 2/usr/lib/python3.9/site-packages/jinja2/loaders.pysplit_template_path s r c @ s2 e Zd ZdZdZdd Zdd Zed dd ZdS ) BaseLoadera Baseclass for all loaders. Subclass this and override `get_source` to implement a custom loading mechanism. The environment provides a `get_template` method that calls the loader's `load` method to get the :class:`Template` object. A very basic example for a loader that looks up templates on the file system could look like this:: from jinja2 import BaseLoader, TemplateNotFound from os.path import join, exists, getmtime class MyLoader(BaseLoader): def __init__(self, path): self.path = path def get_source(self, environment, template): path = join(self.path, template) if not exists(path): raise TemplateNotFound(template) mtime = getmtime(path) with file(path) as f: source = f.read().decode('utf-8') return source, path, lambda: mtime == getmtime(path) Tc C s" | j std| jj t|dS )a Get the template source, filename and reload helper for a template. It's passed the environment and template name and has to return a tuple in the form ``(source, filename, uptodate)`` or raise a `TemplateNotFound` error if it can't locate the template. The source part of the returned tuple must be the source of the template as unicode string or a ASCII bytestring. The filename should be the name of the file on the filesystem if it was loaded from there, otherwise `None`. The filename is used by python for the tracebacks if no loader extension is used. The last item in the tuple is the `uptodate` function. If auto reloading is enabled it's always called to check if the template changed. No arguments are passed so the function must store the old state somewhere (for example in a closure). If it returns `False` the template will be reloaded. z&%s cannot provide access to the sourceN)has_source_accessRuntimeError __class____name__r selfenvironmentr r r r get_sourceG s zBaseLoader.get_sourcec C s t ddS )zIterates over all templates. If the loader does not support that it should raise a :exc:`TypeError` which is the default behavior. z-this loader cannot iterate over all templatesN) TypeErrorr r r r list_templates_ s zBaseLoader.list_templatesNc C s d}|du ri }| ||\}}}|j}|durF|||||} | j}|du r\||||}|dur~| jdu r~|| _|| |j||||S )ac Loads a template. This method looks up the template in the cache or loads one by calling :meth:`get_source`. Subclasses should not override this method as loaders working on collections of other loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`) will not call this method but `get_source` directly. N)r" Zbytecode_cacheZ get_bucketcodecompileZ set_buckettemplate_classZ from_code) r r! nameglobalsr&