$72 GRAYBYTE WORDPRESS FILE MANAGER $95

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/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/

HOME
Current File : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__//loaders.cpython-37.pyc
B

G؊a�X�@sNdZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZejr�ddlmZddlmZeejed
�dd�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#Gd d!�d!e�Z$dS)"zKAPI and implementations for loading templates from different data
sources.
�N)�abc)�sha1)�
import_module)�
ModuleType�)�TemplateNotFound)�internalcode)�open_if_exists)�Environment)�Template)�template�returncCshg}x^|�d�D]P}tjj|ks@tjjr4tjj|ks@|tjjkrJt|��q|r|dkr|�|�qW|S)z�Split a path into segments and perform a sanity check.  If it detects
    '..' in the path it will raise a `TemplateNotFound` error.
    �/�.)�split�os�path�sep�altsep�pardirr�append)r�piecesZpiece�r�?/opt/alt/python37/lib/python3.7/site-packages/jinja2/loaders.py�split_template_paths
rc	@s�eZdZdZdZdeejeejeejej	ge
ffd�dd�Zejed�dd	�Z
eddeejejeejfdd�d
d��Zd
S)�
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 open(path) as f:
                    source = f.read()
                return source, path, lambda: mtime == getmtime(path)
    Tr
)�environmentrr
cCs&|jstt|�j�d���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 a string. 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$ cannot provide access to the sourceN)�has_source_access�RuntimeError�type�__name__r)�selfrrrrr�
get_sourceJszBaseLoader.get_source)r
cCstd��dS)z�Iterates 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)�	TypeError)r!rrr�list_templatesdszBaseLoader.list_templatesNr)r�name�globalsr
c
Cs�d}|dkri}|�||�\}}}|j}|dk	rF|�||||�}	|	j}|dkr\|�|||�}|dk	r~|	jdkr~||	_|�|	�|j�||||�S)acLoads 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_bucket�code�compileZ
set_bucket�template_classZ	from_code)
r!rr%r&r'�source�filename�uptodateZbcc�bucketrrr�loadjs

zBaseLoader.load)N)r �
__module__�__qualname__�__doc__r�str�t�Tuple�Optional�Callable�boolr"�Listr$r�MutableMapping�Anyr.rrrrr)s0rc@s�eZdZdZdejeejej	ejeejffee
dd�dd�Zdeejeeej
ge
ffd	�d
d�Zejed�d
d�ZdS)�FileSystemLoaderaLoad templates from a directory in the file system.

    The path can be relative or absolute. Relative paths are relative to
    the current working directory.

    .. code-block:: python

        loader = FileSystemLoader("templates")

    A list of paths can be given. The directories will be searched in
    order, stopping at the first matching template.

    .. code-block:: python

        loader = FileSystemLoader(["/override/templates", "/default/templates"])

    :param searchpath: A path, or list of paths, to the directory that
        contains the templates.
    :param encoding: Use this encoding to read the text from template
        files.
    :param followlinks: Follow symbolic links in the path.

    .. versionchanged:: 2.8
        Added the ``followlinks`` parameter.
    �utf-8FN)�
searchpath�encoding�followlinksr
cCs<t|tj�rt|t�r|g}dd�|D�|_||_||_dS)NcSsg|]}t�|��qSr)r�fspath)�.0�prrr�
<listcomp>�sz-FileSystemLoader.__init__.<locals>.<listcomp>)�
isinstancer�Iterabler2r=r>r?)r!r=r>r?rrr�__init__�s
zFileSystemLoader.__init__r
)rrr
c	s�t|�}xz|jD]p}tjj|f|���t��}|dkr8qz|���|j�}Wd|�	�Xtj�
���td���fdd�}|�|fSWt|��dS)N)r
cs*ytj����kStk
r$dSXdS)NF)rr�getmtime�OSErrorr)r+�mtimerrr,�sz-FileSystemLoader.get_source.<locals>.uptodate)
rr=rr�joinr	�read�decoder>�closerGr7r)r!rrrr=�f�contentsr,r)r+rIrr"�s
zFileSystemLoader.get_source)r
c	Cs�t�}x�|jD]�}tj||jd�}x~|D]v\}}}xj|D]b}tj�||�t|�d��tjj	��
tjj	d�}|dd�dkr�|dd�}||kr8|�|�q8Wq(WqWt|�S)N)r?r�z./)
�setr=r�walkr?rrJ�len�stripr�replace�add�sorted)	r!�foundr=Zwalk_dir�dirpath�_�	filenamesr+rrrrr$�s

zFileSystemLoader.list_templates)r<F)r r/r0r1r3�Unionr2r�PathLike�Sequencer7rFr4r6r"r8r$rrrrr;�s(	$r;c	@sheZdZdZdededd�dd�Zd	eejeeejej	ge
ffd
�dd�Zejed
�dd�Z
dS)�
PackageLoaderalLoad templates from a directory in a Python package.

    :param package_name: Import name of the package that contains the
        template directory.
    :param package_path: Directory within the imported package that
        contains the templates.
    :param encoding: Encoding of template files.

    The following example looks up templates in the ``pages`` directory
    within the ``project.ui`` package.

    .. code-block:: python

        loader = PackageLoader("project.ui", "pages")

    Only packages installed as directories (standard pip behavior) or
    zip/egg files (less common) are supported. The Python API for
    introspecting data in packages is too limited to support other
    installation methods the way this loader requires.

    There is limited support for :pep:`420` namespace packages. The
    template directory is assumed to only be in one namespace
    contributor. Zip files contributing to a namespace are not
    supported.

    .. versionchanged:: 3.0
        No longer uses ``setuptools`` as a dependency.

    .. versionchanged:: 3.0
        Limited PEP 420 namespace package support.
    �	templates�utf-8r2N)�package_name�package_pathr>r
c
Csltj�|��tjj�}|tjjkr(d}n(|dd�tjjtjjkrP|dd�}||_||_||_t	|�t
j�|�}|dk	s�t
d��|j}|dk	s�t
d��||_d|_d}t|tj�r�|j|_tt|j��}tj�||�}njg}|jr�|�|j�n |jdk	�r|�tj�|j��x0|D](}	tj�|	|�}	tj�|	��r|	}P�qW|dk�rbtd|�d���||_dS)N�rPz-An import spec was not found for the package.z'A loader was not found for the package.zThe zC package was not installed in a way that PackageLoader understands.) rr�normpath�rstripr�curdirrcrbr>r�	importlib�util�	find_spec�AssertionError�loader�_loader�_archiverD�	zipimport�zipimporter�archive�next�iter�submodule_search_locationsrJ�extend�originr�dirname�isdir�
ValueError�_template_root)
r!rbrcr>�specrlZ
template_rootZpkgdir�roots�rootrrrrFsD

zPackageLoader.__init__r
)rrr
c
s�tjj|jft|����|jdkrvtj���s6t|��t�d��}|�	�}WdQRXtj�
���td���fdd�}nBy|j�
��}Wn,tk
r�}zt|�|�Wdd}~XYnXd}|�|j��|fS)N�rb)r
cstj���otj����kS)N)rr�isfilerGr)rIrBrr�
up_to_dateVsz,PackageLoader.get_source.<locals>.up_to_date)rrrJrzrrnrr�openrKrGr7rm�get_datarHrLr>)r!rrrNr*r��er)rIrBrr"Fs
zPackageLoader.get_source)r
csg}|jdkrdt|j�}x�t�|j�D]8\�}}�|d��tjj��|��fdd�|D��q&Wn�t	|j
d�sxtd��|jt|j�d��tjj�tjj}t|�}xL|j
j�
�D]<}|�|�r�|dtjjkr�|�||d��tjjd��q�W|��|S)Nc3s(|] }tj��|��tjjd�VqdS)rN)rrrJrUr)rAr%)rYrr�	<genexpr>qsz/PackageLoader.list_templates.<locals>.<genexpr>�_fileszFThis zip import does not have the required metadata to list templates.���r)rnrSrzrrR�lstriprrru�hasattrrmr#r��keys�
startswithrrU�sort)r!�results�offsetrZr[�prefixr%r)rYrr$gs&



"zPackageLoader.list_templates)r`ra)r r/r0r1r2rFr3r4r5r6r7r"r8r$rrrrr_�s7*r_c@sfeZdZdZejeefdd�dd�Zdeejedej	ge
ffd�dd	�Zejed
�dd�Z
dS)
�
DictLoaderaLoads a template from a Python dict mapping template names to
    template source.  This loader is useful for unittesting:

    >>> loader = DictLoader({'index.html': 'source here'})

    Because auto reloading is rarely useful this is disabled per default.
    N)�mappingr
cCs
||_dS)N)r�)r!r�rrrrF�szDictLoader.__init__r
)rrr
cs6��jkr*�j���d���fdd�fSt���dS)Ncs��j���kS)N)r��getr)r!r*rrr�<lambda>��z'DictLoader.get_source.<locals>.<lambda>)r�r)r!rrr)r!r*rrr"�s

zDictLoader.get_source)r
cCs
t|j�S)N)rWr�)r!rrrr$�szDictLoader.list_templates)r r/r0r1r3�Mappingr2rFr4r6r7r"r8r$rrrrr��s
$r�c@s�eZdZdZejegejejeej	eejeejejge
ffffdd�dd�Zdeej	eejeejejge
ffd�dd	�ZdS)
�FunctionLoadera�A loader that is passed a function which does the loading.  The
    function receives the name of the template and has to return either
    a string with the template source, a tuple in the form ``(source,
    filename, uptodatefunc)`` or `None` if the template does not exist.

    >>> def load_template(name):
    ...     if name == 'index.html':
    ...         return '...'
    ...
    >>> loader = FunctionLoader(load_template)

    The `uptodatefunc` is a function that is called if autoreload is enabled
    and has to return `True` if the template is still up to date.  For more
    details have a look at :meth:`BaseLoader.get_source` which has the same
    return value.
    N)�	load_funcr
cCs
||_dS)N)r�)r!r�rrrrF�szFunctionLoader.__init__r
)rrr
cCs2|�|�}|dkrt|��t|t�r.|ddfS|S)N)r�rrDr2)r!rr�rvrrrr"�s


zFunctionLoader.get_source)
r r/r0r1r3r6r2r5r\r4r7rFr"rrrrr��s0r�c	@s�eZdZdZdejeefedd�dd�Zeej	eefd�dd	�Z
d
eej	eejeejejge
ffd�dd
�Zedd
eejejeejfdd�dd��Zejed�dd�ZdS)�PrefixLoaderaA loader that is passed a dict of loaders where each loader is bound
    to a prefix.  The prefix is delimited from the template by a slash per
    default, which can be changed by setting the `delimiter` argument to
    something else::

        loader = PrefixLoader({
            'app1':     PackageLoader('mypackage.app1'),
            'app2':     PackageLoader('mypackage.app2')
        })

    By loading ``'app1/index.html'`` the file from the app1 package is loaded,
    by loading ``'app2/index.html'`` the file from the second.
    rN)r��	delimiterr
cCs||_||_dS)N)r�r�)r!r�r�rrrrF�szPrefixLoader.__init__)rr
c
CsZy |�|jd�\}}|j|}Wn0ttfk
rP}zt|�|�Wdd}~XYnX||fS)Nr)rr�r�ry�KeyErrorr)r!rr�r%rlr�rrr�
get_loader�szPrefixLoader.get_loaderr
)rrr
c
CsL|�|�\}}y|�||�Stk
rF}zt|�|�Wdd}~XYnXdS)N)r�r"r)r!rrrlr%r�rrrr"�s
zPrefixLoader.get_sourcer)rr%r&r
c
CsN|�|�\}}y|�|||�Stk
rH}zt|�|�Wdd}~XYnXdS)N)r�r.r)r!rr%r&rlZ
local_namer�rrrr.�s
zPrefixLoader.load)r
cCsFg}x<|j��D].\}}x$|��D]}|�||j|�q"WqW|S)N)r��itemsr$rr�)r!�resultr�rlrrrrr$s
zPrefixLoader.list_templates)r)N)r r/r0r1r3r�r2rrFr4r�r5r6r7r"rr9r:r.r8r$rrrrr��s
	0		r�c	@s�eZdZdZejedd�dd�Zdeej	eej
eej
ejgeffd�dd	�Z
eddeej
ejeejfd
d�dd
��Zejed�dd�ZdS)�ChoiceLoadera�This loader works like the `PrefixLoader` just that no prefix is
    specified.  If a template could not be found by one loader the next one
    is tried.

    >>> loader = ChoiceLoader([
    ...     FileSystemLoader('/path/to/user/templates'),
    ...     FileSystemLoader('/path/to/system/templates')
    ... ])

    This is useful if you want to allow users to override builtin templates
    from a different location.
    N)�loadersr
cCs
||_dS)N)r�)r!r�rrrrFszChoiceLoader.__init__r
)rrr
c	Cs>x0|jD]&}y|�||�Stk
r,YqXqWt|��dS)N)r�r"r)r!rrrlrrrr" s
zChoiceLoader.get_sourcer)rr%r&r
c	Cs@x2|jD](}y|�|||�Stk
r.YqXqWt|��dS)N)r�r.r)r!rr%r&rlrrrr.*s
zChoiceLoader.load)r
cCs,t�}x|jD]}|�|���qWt|�S)N)rQr��updater$rW)r!rXrlrrrr$8szChoiceLoader.list_templates)N)r r/r0r1r3r^rrFr2r4r5r6r7r"rr9r:r.r8r$rrrrr�s0r�c@seZdZdZdS)�_TemplateModulez9Like a normal module but with support for weak referencesN)r r/r0r1rrrrr�?sr�c@s�eZdZdZdZejeej	ej
ejeej	ffdd�dd�Zeeed�dd	��Z
eeed�d
d��Zeddeejejeejfd
d�dd��ZdS)�ModuleLoadera6This loader loads templates from precompiled templates.

    Example usage:

    >>> loader = ChoiceLoader([
    ...     ModuleLoader('/path/to/compiled/templates'),
    ...     FileSystemLoader('/path/to/templates')
    ... ])

    Templates can be precompiled with :meth:`Environment.compile_templates`.
    FN)rr
csndt|�d���t��}t|tj�r.t|t�r4|g}dd�|D�|_t�|�fdd��t	j
�<||_�|_dS)NZ_jinja2_module_templates_�xcSsg|]}t�|��qSr)rr@)rArBrrrrC^sz)ModuleLoader.__init__.<locals>.<listcomp>cstj��d�S)N)�sys�modules�pop)r�)rbrrr�ar�z'ModuleLoader.__init__.<locals>.<lambda>)
�idr�rDrrEr2�__path__�weakref�proxyr�r��modulerb)r!r�modr)rbrrFRszModuleLoader.__init__)r%r
cCsdt|�d����S)NZtmpl_zutf-8)r�encode�	hexdigest)r%rrr�get_template_keyjszModuleLoader.get_template_keycCst�|�dS)Nz.py)r�r�)r%rrr�get_module_filenamensz ModuleLoader.get_module_filenamer
r)rr%r&r
c
Cs�|�|�}|j�d|��}t|j|d�}|dkr�yt|dddg�}Wn,tk
rp}zt|�|�Wdd}~XYnXtj�	|d�|dkr�i}|j
�||j|�S)Nrr})
r�rb�getattrr��
__import__�ImportErrorrr�r�r�r)Zfrom_module_dict�__dict__)r!rr%r&�keyr�r�r�rrrr.rs
zModuleLoader.load)N)r r/r0r1rr3r\r2rr]r^rF�staticmethodr�r�rr5r9r:r.rrrrr�Cs"r�)%r1�importlib.utilrhrr��typingr3r�ro�collectionsr�hashlibrr�typesr�
exceptionsr�utilsrr	�
TYPE_CHECKINGrr
rr2r8rrr;r_r�r�r�r�r�r�rrrr�<module>s6nS"-?0


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 11.11 PM
root / linksafe
0755
__init__.cpython-37.opt-1.pyc
1.84 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
__init__.cpython-37.pyc
1.84 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
_identifier.cpython-37.opt-1.pyc
1.825 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
_identifier.cpython-37.pyc
1.825 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
async_utils.cpython-37.opt-1.pyc
2.389 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
async_utils.cpython-37.pyc
2.389 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
bccache.cpython-37.opt-1.pyc
12.802 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
bccache.cpython-37.pyc
12.802 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
compiler.cpython-37.opt-1.pyc
53.089 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
compiler.cpython-37.pyc
53.089 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
constants.cpython-37.opt-1.pyc
1.479 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
constants.cpython-37.pyc
1.479 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
debug.cpython-37.opt-1.pyc
5.204 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
debug.cpython-37.pyc
5.204 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
defaults.cpython-37.opt-1.pyc
1.282 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
defaults.cpython-37.pyc
1.282 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
environment.cpython-37.opt-1.pyc
51.229 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
environment.cpython-37.pyc
51.229 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
exceptions.cpython-37.opt-1.pyc
5.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
exceptions.cpython-37.pyc
5.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
ext.cpython-37.opt-1.pyc
25.626 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
ext.cpython-37.pyc
25.626 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
filters.cpython-37.opt-1.pyc
48.595 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
filters.cpython-37.pyc
48.595 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
idtracking.cpython-37.opt-1.pyc
10.889 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
idtracking.cpython-37.pyc
10.889 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
lexer.cpython-37.opt-1.pyc
19.562 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
lexer.cpython-37.pyc
19.562 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
loaders.cpython-37.opt-1.pyc
19.753 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
loaders.cpython-37.pyc
19.753 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
meta.cpython-37.opt-1.pyc
3.679 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
meta.cpython-37.pyc
3.679 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nativetypes.cpython-37.opt-1.pyc
4.707 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nativetypes.cpython-37.pyc
4.707 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nodes.cpython-37.opt-1.pyc
40.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nodes.cpython-37.pyc
40.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
optimizer.cpython-37.opt-1.pyc
1.836 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
optimizer.cpython-37.pyc
1.836 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
parser.cpython-37.opt-1.pyc
26.864 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
parser.cpython-37.pyc
26.864 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
runtime.cpython-37.opt-1.pyc
32.179 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
runtime.cpython-37.pyc
32.179 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
sandbox.cpython-37.opt-1.pyc
11.517 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
sandbox.cpython-37.pyc
11.517 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
tests.cpython-37.opt-1.pyc
6.349 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
tests.cpython-37.pyc
6.349 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
utils.cpython-37.opt-1.pyc
26.536 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
utils.cpython-37.pyc
26.536 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
visitor.cpython-37.opt-1.pyc
3.768 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
visitor.cpython-37.pyc
3.768 KB
14 Nov 2023 1.02 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF