/usr/lib/python3.6/site-packages/jinja2/__pycache__
NameSizeModeActions
asyncfilters.cpython-36.opt-1.pyc47420644editdlrm
asyncfilters.cpython-36.pyc47420644editdlrm
asyncsupport.cpython-36.opt-1.pyc80910644editdlrm
asyncsupport.cpython-36.pyc80910644editdlrm
bccache.cpython-36.opt-1.pyc126630644editdlrm
bccache.cpython-36.pyc126630644editdlrm
compiler.cpython-36.opt-1.pyc467870644editdlrm
compiler.cpython-36.pyc468440644editdlrm
constants.cpython-36.opt-1.pyc16530644editdlrm
constants.cpython-36.pyc16530644editdlrm
debug.cpython-36.opt-1.pyc92250644editdlrm
debug.cpython-36.pyc92860644editdlrm
defaults.cpython-36.opt-1.pyc14030644editdlrm
defaults.cpython-36.pyc14030644editdlrm
environment.cpython-36.opt-1.pyc428570644editdlrm
environment.cpython-36.pyc432140644editdlrm
exceptions.cpython-36.opt-1.pyc49630644editdlrm
exceptions.cpython-36.pyc49630644editdlrm
ext.cpython-36.opt-1.pyc200020644editdlrm
ext.cpython-36.pyc200540644editdlrm
filters.cpython-36.opt-1.pyc346010644editdlrm
filters.cpython-36.pyc347340644editdlrm
idtracking.cpython-36.opt-1.pyc98500644editdlrm
idtracking.cpython-36.pyc98920644editdlrm
lexer.cpython-36.opt-1.pyc183860644editdlrm
lexer.cpython-36.pyc185160644editdlrm
loaders.cpython-36.opt-1.pyc165230644editdlrm
loaders.cpython-36.pyc165230644editdlrm
meta.cpython-36.opt-1.pyc36140644editdlrm
meta.cpython-36.pyc36140644editdlrm
nativetypes.cpython-36.opt-1.pyc50770644editdlrm
nativetypes.cpython-36.pyc50770644editdlrm
nodes.cpython-36.opt-1.pyc362370644editdlrm
nodes.cpython-36.pyc366110644editdlrm
optimizer.cpython-36.opt-1.pyc19830644editdlrm
optimizer.cpython-36.pyc19830644editdlrm
parser.cpython-36.opt-1.pyc252880644editdlrm
parser.cpython-36.pyc252880644editdlrm
runtime.cpython-36.opt-1.pyc245260644editdlrm
runtime.cpython-36.pyc245530644editdlrm
sandbox.cpython-36.opt-1.pyc144570644editdlrm
sandbox.cpython-36.pyc144570644editdlrm
tests.cpython-36.opt-1.pyc43590644editdlrm
tests.cpython-36.pyc43590644editdlrm
utils.cpython-36.opt-1.pyc206290644editdlrm
utils.cpython-36.pyc206290644editdlrm
visitor.cpython-36.opt-1.pyc32990644editdlrm
visitor.cpython-36.pyc32990644editdlrm
_compat.cpython-36.opt-1.pyc32870644editdlrm
_compat.cpython-36.pyc32870644editdlrm
_identifier.cpython-36.opt-1.pyc17900644editdlrm
_identifier.cpython-36.pyc17900644editdlrm
__init__.cpython-36.opt-1.pyc24790644editdlrm
__init__.cpython-36.pyc24790644editdlrm
Edit: /usr/lib/python3.6/site-packages/jinja2/__pycache__/bccache.cpython-36.pyc (12663B)
3 G\1@sdZddlmZmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZmZmZmZesejZejZnddZd d Zd Zd jd ejedejejdd>ejdBZGdddeZGdddeZGdddeZGdddeZ dS)a jinja2.bccache ~~~~~~~~~~~~~~ This module implements the bytecode cache system Jinja is optionally using. This is useful if you have very complex template situations and the compiliation of all those templates slow down your application too much. Situations where this is useful are often forking web applications that are initialized on the first request. :copyright: (c) 2017 by the Jinja Team. :license: BSD. )pathlistdirN)sha1)open_if_exists)BytesIOpicklePY2 text_typecCs,t|trtj||n|jtj|dS)N) isinstancefilemarshaldumpwritedumps)codefr/usr/lib/python3.6/bccache.py marshal_dump$s rcCs"t|trtj|Stj|jS)N)r r r loadloadsread)rrrr marshal_load*s  rZj2asciic@s@eZdZdZddZddZddZdd 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||_||_||_|jdS)N) environmentkeychecksumreset)selfrr r!rrr__init__EszBucket.__init__cCs d|_dS)z)Resets the bucket (unloads the bytecode).N)r)r#rrrr"Ksz Bucket.resetc Csx|jtt}|tkr"|jdStj|}|j|krB|jdSyt||_Wn"t t t fk rr|jdSXdS)z/Loads bytecode from a file or file like object.N) rlenbc_magicr"rrr!rrEOFError ValueError TypeError)r#rmagicr!rrr load_bytecodeOs  zBucket.load_bytecodecCs<|jdkrtd|jttj|j|dt|j|dS)z;Dump the bytecode into the file or file like object passed.Nzcan't write empty bucketr)rr)rr&rr r!r)r#rrrrwrite_bytecodebs   zBucket.write_bytecodecCs|jt|dS)zLoad bytecode from a string.N)r+r)r#stringrrrbytecode_from_stringjszBucket.bytecode_from_stringcCst}|j||jS)zReturn the bytecode as string.)rr,getvalue)r#outrrrbytecode_to_stringns zBucket.bytecode_to_stringN) __name__ __module__ __qualname____doc__r$r"r+r,r.r1rrrrr<src@sJeZdZdZddZddZddZdd d Zd d Zd dZ ddZ dS) BytecodeCacheaTo 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 Jinja2. cCs tdS)zSubclasses 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 tdS)zSubclasses 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. N)r7)r#r8rrr dump_bytecodeszBytecodeCache.dump_bytecodecCsdS)zClears the cache. This method is not used by Jinja2 but should be implemented to allow applications to clear the bytecode cache used by a particular environment. Nr)r#rrrclearszBytecodeCache.clearNcCsDt|jd}|dk r)r#sourcerrrget_source_checksumsz!BytecodeCache.get_source_checksumcCs0|j||}|j|}t|||}|j||S)zwReturn a cache bucket for the given template. All arguments are mandatory but filename may be `None`. )rBrDrr+)r#rr?r@rCr r!r8rrr get_buckets     zBytecodeCache.get_bucketcCs|j|dS)zPut the bucket into the cache.N)r9)r#r8rrr set_bucketszBytecodeCache.set_bucket)N) r2r3r4r5r+r9r:rBrDrErFrrrrr6us  r6c@sBeZdZdZdddZddZdd Zd d Zd d ZddZ dS)FileSystemBytecodeCacheaA 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 |dkr|j}||_||_dS)N)_get_default_cache_dir directorypattern)r#rJrKrrrr$sz FileSystemBytecodeCache.__init__cCsZdd}tj}tjdkr|Sttds.|dtj}tjj||}ytj|t j Wn0t k r}z|j t j krzWYdd}~XnXyPtj|t j tj|}|jtjkst j|j st j|jt j kr|Wn4t k r}z|j t j krWYdd}~XnXtj|}|jtjksPt j|j sPt j|jt j krV||S)NcSs tddS)NzJCannot determine safe temp directory. You need to explicitly provide one.) RuntimeErrorrrrr _unsafe_dirszCFileSystemBytecodeCache._get_default_cache_dir.._unsafe_dirntgetuidz_jinja2-cache-%d)tempfileZ gettempdirosr?hasattrrOrjoinmkdirstatS_IRWXUOSErrorerrnoZEEXISTchmodlstatst_uidS_ISDIRst_modeS_IMODE)r#rMZtmpdirdirnameZ actual_direZactual_dir_statrrrrIs:       z.FileSystemBytecodeCache._get_default_cache_dircCstj|j|j|jS)N)rrSrJrKr )r#r8rrr_get_cache_filenamesz+FileSystemBytecodeCache._get_cache_filenamec Cs6t|j|d}|dk r2z|j|Wd|jXdS)Nrb)rrar+close)r#r8rrrrr+s z%FileSystemBytecodeCache.load_bytecodec Cs.t|j|d}z|j|Wd|jXdS)Nwb)openrar,rc)r#r8rrrrr9sz%FileSystemBytecodeCache.dump_bytecodec Csbddlm}tjt|j|jd}x8|D]0}y|tj|j|Wq*t k rXYq*Xq*WdS)Nr)remove*) rQrffnmatchfilterrrJrKrrSrW)r#rffilesr@rrrr:s  zFileSystemBytecodeCache.clear)NrH) r2r3r4r5r$rIrar+r9r:rrrrrGs )rGc@s*eZdZdZd ddZddZd d ZdS) MemcachedBytecodeCacheavThis 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: - `werkzeug `_.contrib.cache - `python-memcached `_ - `cmemcache `_ (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||_||_||_||_dS)N)clientprefixtimeoutignore_memcache_errors)r#rmrnrorprrrr$QszMemcachedBytecodeCache.__init__c CsPy|jj|j|j}Wn tk r8|js0d}YnX|dk rL|j|dS)N)rmgetrnr Exceptionrpr.)r#r8rrrrr+Xs z$MemcachedBytecodeCache.load_bytecodec Cs\|j|j|jf}|jdk r*||jf7}y|jj|Wntk rV|jsRYnXdS)N)rnr r1rormsetrrrp)r#r8argsrrrr9bs  z$MemcachedBytecodeCache.dump_bytecode)rlNT)r2r3r4r5r$r+r9rrrrrk#s ,  rk)!r5rQrrsysrUrXr rPrhZhashlibrZ jinja2.utilsrZjinja2._compatrrrr r rrrZ bc_versionr<r version_infor&objectrr6rGrkrrrrs.   9N`