Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /proc/self/root/usr/lib/python3.9/site-packages/jinja2/__pycache__/
Dosya Yükle :
Şuanki Dosya : //proc/self/root/usr/lib/python3.9/site-packages/jinja2/__pycache__/bccache.cpython-39.pyc

a

�`k/�@sdZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZd
Zde�ed�e�ejdd>ejdBd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)a The optional bytecode cache system. This is useful if you have very
complex template situations and the compilation of all those templates
slows down your application too much.

Situations where this is useful are often forking web applications that
are initialized on the first request.
�N)�sha1)�listdir)�path�)�BytesIO)�marshal_dump)�marshal_load)�pickle)�	text_type)�open_if_exists�sj2��c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�BucketauBuckets are used to store the bytecode for one template.  It's created
    and initialized by the bytecode cache and passed to the loading functions.

    The buckets get an internal checksum from the cache assigned and use this
    to automatically reject outdated cache material.  Individual bytecode
    cache subclasses don't have to care about cache invalidation.
    cCs||_||_||_|��dS�N)�environment�key�checksum�reset)�selfrrr�r�2/usr/lib/python3.9/site-packages/jinja2/bccache.py�__init__.szBucket.__init__cCs
d|_dS)z)Resets the bucket (unloads the bytecode).N)�code�rrrrr4szBucket.resetc
Csx|�tt��}|tkr"|��dSt�|�}|j|krB|��dSzt|�|_Wn"t	t
tfyr|��YdS0dS)z/Loads bytecode from a file or file like object.N)�read�len�bc_magicrr	�loadrrr�EOFError�
ValueError�	TypeError)r�f�magicrrrr�
load_bytecode8s

zBucket.load_bytecodecCs<|jdurtd��|�t�t�|j|d�t|j|�dS)z;Dump the bytecode into the file or file like object passed.Nzcan't write empty bucketr
)rr!�writerr	�dumprr)rr"rrr�write_bytecodeKs


zBucket.write_bytecodecCs|�t|��dS)zLoad bytecode from a string.N)r$r)r�stringrrr�bytecode_from_stringSszBucket.bytecode_from_stringcCst�}|�|�|��S)zReturn the bytecode as string.)rr'�getvalue)r�outrrr�bytecode_to_stringWs
zBucket.bytecode_to_stringN)
�__name__�
__module__�__qualname__�__doc__rrr$r'r)r,rrrrr%src@sJeZdZdZdd�Zdd�Zdd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
BytecodeCachea�To implement your own bytecode cache you have to subclass this class
    and override :meth:`load_bytecode` and :meth:`dump_bytecode`.  Both of
    these methods are passed a :class:`~jinja2.bccache.Bucket`.

    A very basic bytecode cache that saves the bytecode on the file system::

        from os import path

        class MyCache(BytecodeCache):

            def __init__(self, directory):
                self.directory = directory

            def load_bytecode(self, bucket):
                filename = path.join(self.directory, bucket.key)
                if path.exists(filename):
                    with open(filename, 'rb') as f:
                        bucket.load_bytecode(f)

            def dump_bytecode(self, bucket):
                filename = path.join(self.directory, bucket.key)
                with open(filename, 'wb') as f:
                    bucket.write_bytecode(f)

    A more advanced version of a filesystem based bytecode cache is part of
    Jinja.
    cCs
t��dS)z�Subclasses have to override this method to load bytecode into a
        bucket.  If they are not able to find code in the cache for the
        bucket, it must not do anything.
        N��NotImplementedError�r�bucketrrrr${szBytecodeCache.load_bytecodecCs
t��dS)z�Subclasses have to override this method to write the bytecode
        from a bucket back to the cache.  If it unable to do so it must not
        fail silently but raise an exception.
        Nr2r4rrr�
dump_bytecode�szBytecodeCache.dump_bytecodecCsdS)z�Clears the cache.  This method is not used by Jinja but should be
        implemented to allow applications to clear the bytecode cache used
        by a particular environment.
        Nrrrrr�clear�szBytecodeCache.clearNcCsDt|�d��}|dur<d|}t|t�r2|�d�}|�|�|��S)z3Returns the unique hash key for this template name.�utf-8N�|)r�encode�
isinstancer
�update�	hexdigest)r�name�filename�hashrrr�
get_cache_key�s


zBytecodeCache.get_cache_keycCst|�d����S)z"Returns a checksum for the source.r8)rr:r=)r�sourcerrr�get_source_checksum�sz!BytecodeCache.get_source_checksumcCs0|�||�}|�|�}t|||�}|�|�|S)zwReturn a cache bucket for the given template.  All arguments are
        mandatory but filename may be `None`.
        )rArCrr$)rrr>r?rBrrr5rrr�
get_bucket�s


zBytecodeCache.get_bucketcCs|�|�dS)zPut the bucket into the cache.N)r6r4rrr�
set_bucket�szBytecodeCache.set_bucket)N)r-r.r/r0r$r6r7rArCrDrErrrrr1^s


r1c@sBeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�FileSystemBytecodeCachea�A bytecode cache that stores bytecode on the filesystem.  It accepts
    two arguments: The directory where the cache items are stored and a
    pattern string that is used to build the filename.

    If no directory is specified a default cache directory is selected.  On
    Windows the user's temp directory is used, on UNIX systems a directory
    is created for the user in the system temp directory.

    The pattern can be used to have multiple separate caches operate on the
    same directory.  The default pattern is ``'__jinja2_%s.cache'``.  ``%s``
    is replaced with the cache key.

    >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')

    This bytecode cache supports clearing of the cache using the clear method.
    N�__jinja2_%s.cachecCs |dur|��}||_||_dSr)�_get_default_cache_dir�	directory�pattern)rrIrJrrrr�sz FileSystemBytecodeCache.__init__c
CsXdd�}t��}tjdkr|Sttd�s.|�dt��}tj�||�}zt�|t	j
�Wn2ty�}z|jtj
krx�WYd}~n
d}~00zNt�|t	j
�t�|�}|jt��ks�t	�|j�r�t	�|j�t	j
kr�|�Wn4t�y}z|jtj
kr��WYd}~n
d}~00t�|�}|jt��k�sNt	�|j��rNt	�|j�t	j
k�rT|�|S)NcSstd��dS)NzJCannot determine safe temp directory.  You need to explicitly provide one.)�RuntimeErrorrrrr�_unsafe_dir�s�zCFileSystemBytecodeCache._get_default_cache_dir.<locals>._unsafe_dir�nt�getuidz_jinja2-cache-%d)�tempfileZ
gettempdir�osr>�hasattrrNr�join�mkdir�stat�S_IRWXU�OSError�errnoZEEXIST�chmod�lstat�st_uid�S_ISDIR�st_mode�S_IMODE)rrLZtmpdir�dirnameZ
actual_dir�eZactual_dir_statrrrrH�sF


�
��

�
��z.FileSystemBytecodeCache._get_default_cache_dircCst�|j|j|j�Sr)rrRrIrJrr4rrr�_get_cache_filename�sz+FileSystemBytecodeCache._get_cache_filenamecCs>t|�|�d�}|dur:z|�|�W|��n
|��0dS)N�rb)rr`r$�close�rr5r"rrrr$�s
z%FileSystemBytecodeCache.load_bytecodecCs6t|�|�d�}z|�|�W|��n
|��0dS)N�wb)�openr`r'rbrcrrrr6�sz%FileSystemBytecodeCache.dump_bytecodec	Cs\ddlm}t�t|j�|jd�}|D].}z|t�|j|��Wq(t	yTYq(0q(dS)Nr)�remove�*)
rPrf�fnmatch�filterrrIrJrrRrV)rrf�filesr?rrrr7szFileSystemBytecodeCache.clear)NrG)
r-r.r/r0rrHr`r$r6r7rrrrrF�s
/rFc@s*eZdZdZddd�Zdd�Zd	d
�ZdS)�MemcachedBytecodeCachea+This class implements a bytecode cache that uses a memcache cache for
    storing the information.  It does not enforce a specific memcache library
    (tummy's memcache or cmemcache) but will accept any class that provides
    the minimal interface required.

    Libraries compatible with this class:

    -   `cachelib <https://github.com/pallets/cachelib>`_
    -   `python-memcached <https://pypi.org/project/python-memcached/>`_

    (Unfortunately the django cache interface is not compatible because it
    does not support storing binary data, only unicode.  You can however pass
    the underlying cache client to the bytecode cache which is available
    as `django.core.cache.cache._client`.)

    The minimal interface for the client passed to the constructor is this:

    .. class:: MinimalClientInterface

        .. method:: set(key, value[, timeout])

            Stores the bytecode in the cache.  `value` is a string and
            `timeout` the timeout of the key.  If timeout is not provided
            a default timeout or no timeout should be assumed, if it's
            provided it's an integer with the number of seconds the cache
            item should exist.

        .. method:: get(key)

            Returns the value for the cache key.  If the item does not
            exist in the cache the return value must be `None`.

    The other arguments to the constructor are the prefix for all keys that
    is added before the actual cache key and the timeout for the bytecode in
    the cache system.  We recommend a high (or no) timeout.

    This bytecode cache does not support clearing of used items in the cache.
    The clear method is a no-operation function.

    .. versionadded:: 2.7
       Added support for ignoring memcache errors through the
       `ignore_memcache_errors` parameter.
    �jinja2/bytecode/NTcCs||_||_||_||_dSr)�client�prefix�timeout�ignore_memcache_errors)rrmrnrorprrrr@szMemcachedBytecodeCache.__init__cCsNz|j�|j|j�}Wnty6|js.�d}Yn0|durJ|�|�dSr)rm�getrnr�	Exceptionrpr))rr5rrrrr$Ls
z$MemcachedBytecodeCache.load_bytecodecCsZ|j|j|��f}|jdur*||jf7}z|jj|�WntyT|jsP�Yn0dSr)rnrr,rorm�setrrrp)rr5�argsrrrr6Vs
z$MemcachedBytecodeCache.dump_bytecode)rlNT)r-r.r/r0rr$r6rrrrrks/�

rk)r0rWrhrPrT�sysrOZhashlibrrrZ_compatrrrr	r
ZutilsrZ
bc_version�dumps�version_infor�objectrr1rFrkrrrr�<module>s4
���9Ng

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4