/usr/local/lib/python3.6/site-packages/jinja2/__pycache__
NameSizeModeActions
async_utils.cpython-36.pyc24350644editdlrm
bccache.cpython-36.pyc130970644editdlrm
compiler.cpython-36.pyc543690644editdlrm
constants.cpython-36.pyc14960644editdlrm
debug.cpython-36.pyc53440644editdlrm
defaults.cpython-36.pyc12410644editdlrm
environment.cpython-36.pyc523970644editdlrm
exceptions.cpython-36.pyc54980644editdlrm
ext.cpython-36.pyc262740644editdlrm
filters.cpython-36.pyc497540644editdlrm
idtracking.cpython-36.pyc111250644editdlrm
lexer.cpython-36.pyc199830644editdlrm
loaders.cpython-36.pyc202170644editdlrm
meta.cpython-36.pyc37460644editdlrm
nativetypes.cpython-36.pyc48050644editdlrm
nodes.cpython-36.pyc411930644editdlrm
optimizer.cpython-36.pyc18610644editdlrm
parser.cpython-36.pyc276350644editdlrm
runtime.cpython-36.pyc328630644editdlrm
sandbox.cpython-36.pyc116960644editdlrm
tests.cpython-36.pyc64820644editdlrm
utils.cpython-36.pyc272170644editdlrm
visitor.cpython-36.pyc38390644editdlrm
_identifier.cpython-36.pyc18500644editdlrm
__init__.cpython-36.pyc18650644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/jinja2/__pycache__/environment.cpython-36.pyc (52397B)
3 ^TBg7@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddl m Z ddlmZd d lmZd d lmZd d lmZd d lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlm Z d dlm!Z!d dlm"Z"d dlm#Z#d dlm$Z$d dlm%Z%d dl&m'Z'd dl&m(Z(d dl&m)Z)d d l&m*Z*d d!l&m+Z+d d"l,m-Z-d d#l,m.Z.d d$l,m/Z/d d%lm0Z0d d&l1m2Z2d d'l3m4Z4d d(l3m5Z5d d)l3m6Z6d d*l7m8Z8d d+l7m9Z9d d,l7m:Z:d d-l7m;Z;d d.l7mZ>ej?r|ddl@ZAd d1lBmCZCd d2lDmEZEd d3lFmGZGejHd4d5d6ZIe d7d8ejJeIejKeId9d:d;ZLeMejNejOejPejQeRfdd?ZSejNejOejNejOejPejQeRfdTemplate)sizer9cCs |dkr dS|dkriSt|S)z*Return the cache class for the given size.rN)r.)r@r<r<r= create_cacheQs rA)cacher9cCs&|dkr dSt|tkriSt|jS)z(Create an empty copy of the given cache.N)typedictr.capacity)rBr<r<r= copy_cache^s  rFr1) environment extensionsr9cCsDi}x:|D]2}t|tr.tjtjdt|}||||j<q W|S)zuLoad the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions. r1) isinstancestrtcastTyper, identifier)rGrHresult extensionr<r<r=load_extensionsks   rQ)rGr9cCsPt|jtstd|j|jko,|jkns:td|jdksLtd|S)z*Perform a sanity check on the environment.z5'undefined' must be a subclass of 'jinja2.Undefined'.zrSrRrT) issubclass undefinedr(AssertionErrorblock_start_stringvariable_start_stringcomment_start_stringnewline_sequence)rGr<r<r=_environment_config_check}s  r\c@sHeZdZUdZdZdZdZejddZ e Z ej d e Zej e ej deeeeeeeeeeeefdedddddddfeeeeeeejeejeeedeejej eej d feej eejej!d ej"fej eej!ejegeffejd e#eejd ed ddZ$ej eej d fddddZ%ej"ddddZ&e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'feeeeeeejeejeeeejej eej d feej eejej!d ej"fej eej!ejegeffejd e#eejd ddddZ(e)e*dddZ+ej,d dddZ-ej"ej eej"fej ej"efddd Z.ej"eej"d!d"d#Z/ej eefej"ejejej"ejej0eej"feje eje1eej"d$d%d&Z2dieej"ejejej"ejej0eej"feje eje1ej"d'd(d)Z3djeej"ejejej"ejej0eej"feje eje1ej"d'd*d+Z4e5dkeejeejee6j7d,d-d.Z8eejeejee6j7d,d/d0Z9dleejeejeej,ej:e#eefd,d1d2Z;dmeejeejeed,d3d4Zdoe6j7ejeejeeed8d9d:Z?eee@d;dee@d?d@dAZDeBjCdqej ee6j7fejeejedBeed?dCdAZDe5drej ee6j7fejeejeeeej ee@fd?dDdAZDdseedEdFdGdHZEdtej eeFjGfejejHeejej!egefejeejej!egdfeddJdKdLZIduejejHeejej!egefejJedMdNdOZKdvejedPdQdRdSZLeeedTdUdVZMe5eejej0eej"fddWdXdYZNe5dwej edfejeejej0eej"fddZd[d\ZOe5dxejPej edfejeejej0eej"fdd]d^d_ZQe5dyej edejJej edffejeejej0eej"fdd`dadbZRdzej ee6j7fejej0eej"fejej dddcdddeZSejej0eej"fejTeej"fdfdgdhZUdS){r4aThe core component of Jinja is the `Environment`. It contains important shared variables like configuration, filters, tests, globals and others. Instances of this class may be modified if they are not shared and if no template was loaded so far. Modifications on environments after the first template was loaded will lead to surprising effects and undefined behavior. Here are the possible initialization parameters: `block_start_string` The string marking the beginning of a block. Defaults to ``'{%'``. `block_end_string` The string marking the end of a block. Defaults to ``'%}'``. `variable_start_string` The string marking the beginning of a print statement. Defaults to ``'{{'``. `variable_end_string` The string marking the end of a print statement. Defaults to ``'}}'``. `comment_start_string` The string marking the beginning of a comment. Defaults to ``'{#'``. `comment_end_string` The string marking the end of a comment. Defaults to ``'#}'``. `line_statement_prefix` If given and a string, this will be used as prefix for line based statements. See also :ref:`line-statements`. `line_comment_prefix` If given and a string, this will be used as prefix for line based comments. See also :ref:`line-statements`. .. versionadded:: 2.2 `trim_blocks` If this is set to ``True`` the first newline after a block is removed (block, not variable tag!). Defaults to `False`. `lstrip_blocks` If this is set to ``True`` leading spaces and tabs are stripped from the start of a line to a block. Defaults to `False`. `newline_sequence` The sequence that starts a newline. Must be one of ``'\r'``, ``'\n'`` or ``'\r\n'``. The default is ``'\n'`` which is a useful default for Linux and OS X systems as well as web applications. `keep_trailing_newline` Preserve the trailing newline when rendering templates. The default is ``False``, which causes a single newline, if present, to be stripped from the end of the template. .. versionadded:: 2.7 `extensions` List of Jinja extensions to use. This can either be import paths as strings or extension classes. For more information have a look at :ref:`the extensions documentation `. `optimized` should the optimizer be enabled? Default is ``True``. `undefined` :class:`Undefined` or a subclass of it that is used to represent undefined values in the template. `finalize` A callable that can be used to process the result of a variable expression before it is output. For example one can convert ``None`` implicitly into an empty string here. `autoescape` If set to ``True`` the XML/HTML autoescaping feature is enabled by default. For more details about autoescaping see :class:`~markupsafe.Markup`. As of Jinja 2.4 this can also be a callable that is passed the template name and has to return ``True`` or ``False`` depending on autoescape should be enabled by default. .. versionchanged:: 2.4 `autoescape` can now be a function `loader` The template loader for this environment. `cache_size` The size of the cache. Per default this is ``400`` which means that if more than 400 templates are loaded the loader will clean out the least recently used template. If the cache size is set to ``0`` templates are recompiled all the time, if the cache size is ``-1`` the cache will not be cleaned. .. versionchanged:: 2.8 The cache size was increased to 400 from a low 50. `auto_reload` Some loaders load templates from locations where the template sources may change (ie: file system or database). If ``auto_reload`` is set to ``True`` (default) every time a template is requested the loader checks if the source changed and if yes, it will reload the template. For higher performance it's possible to disable that. `bytecode_cache` If set to a bytecode cache object, this object will provide a cache for the internal Jinja bytecode so that templates don't have to be parsed if they were not changed. See :ref:`bytecode-cache` for more information. `enable_async` If set to true this enables async template execution which allows using async functions and generators. FNr r?Tizte.Literal['\n', '\r\n', '\r']r1.r2r0)rXblock_end_stringrYvariable_end_stringrZcomment_end_stringline_statement_prefixline_comment_prefix trim_blocks lstrip_blocksr[keep_trailing_newlinerH optimizedrVfinalize autoescapeloader cache_size auto_reloadbytecode_cache enable_asynccCs||_||_||_||_||_||_||_||_| |_| |_ | |_ | |_ ||_ ||_ ||_||_tj|_tj|_tj|_||_t||_||_||_tj|_t|| |_||_ t!|dS)N)"rXr]rYr^rZr_r`rarbrcr[rdrVrerfrgrcopyfiltersrtestsrglobalsrhrArBrkrjrZpoliciesrQrHis_asyncr\)selfrXr]rYr^rZr_r`rarbrcr[rdrHrerVrfrgrhrirjrkrlr<r<r=__init__#s6%      zEnvironment.__init__)rPr9cCs|jjt||gdS)z\Adds an extension after the environment was created. .. versionadded:: 2.5 N)rHupdaterQ)rrrPr<r<r= add_extensionoszEnvironment.add_extension) attributesr9cKs0x*|jD]\}}t||s t|||q WdS)zAdd the items to the instance of the environment if they do not exist yet. This is used by :ref:`extensions ` to register callbacks and configuration values without breaking inheritance. N)itemshasattrsetattr)rrrvkeyvaluer<r<r=extendvs zEnvironment.extend)rXr]rYr^rZr_r`rarbrcrHrerVrfrgrhrirjrkr9cCstt}|d=|d=|d=tj|j}|jj|jd|_||_x(|j D]\}}|t k rLt |||qLW|t k rt ||_ n t|j |_ i|_x&|jj D]\}}|j||j|<qW| t k r|jjt|| t|S)agCreate a new overlay environment that shares all the data with the current environment except for cache and the overridden attributes. Extensions cannot be removed for an overlayed environment. An overlayed environment automatically gets all the extensions of the environment it is linked to plus optional extra extensions. Creating overlays should happen after the initial environment was set up completely. Not all attributes are truly linked, some are just copied over so modifications on the original environment may not shine through. rrrirHT)rDlocalsobject__new__ __class____dict__rt overlayed linked_torwr/ryrArBrFrHbindrQr\)rrrXr]rYr^rZr_r`rarbrcrHrerVrfrgrhrirjrkr8rvrzr{r<r<r=overlays$!    zEnvironment.overlay)r9cCst|S)zThe lexer for this environment.)r!)rrr<r<r=lexerszEnvironment.lexercCstt|jjdddS)z)Iterates over the extensions by priority.cSs|jS)N)priority)xr<r<r=sz-Environment.iter_extensions..)rz)itersortedrHvalues)rrr<r<r=iter_extensionsszEnvironment.iter_extensions)objargumentr9cCs~y||Stttfk rxt|trjy t|}Wntk rHYn"Xy t||Stk rhYnX|j||dSXdS)z:Get an item or attribute of an object but prefer the item.)rnameN)AttributeError TypeError LookupErrorrIrJ ExceptiongetattrrV)rrrrattrr<r<r=getitems   zEnvironment.getitem)r attributer9cCsRy t||Stk rYnXy||Stttfk rL|j||dSXdS)zGet an item or attribute of an object but prefer the attribute. Unlike :meth:`getitem` the attribute *must* be a string. )rrN)rrrrrV)rrrrr<r<r=rs zEnvironment.getattr)rr{r8kwargscontexteval_ctx is_filterr9cCsP|r|j}d} n |j}d} |j|} | dkrd| d|d} t|try |jWn2tk r} z| d| d} WYdd} ~ XnXt| |f|dk r|nf}|dk r|ni}tj | } | tj kr|dkrtd| d |j d |nV| tj kr.|dkr |dk r|j }nt|}|j d |n| tjkrF|j d || ||S) NfiltertestzNo z named .z (z-; did you forget to quote the callable name?)zAttempted to invoke a context z without context.r)rnrogetrIr(_fail_with_undefined_errorrrr)Zfrom_objrinsertZ eval_contextrr$rG)rrrr{r8rrrrZenv_mapZ type_namefuncmsgeZpass_argr<r<r=_filter_test_commons>    "       zEnvironment._filter_test_common)rr{r8rrrr9cCs|j||||||dS)a/Invoke a filter on a value the same way the compiler does. This might return a coroutine if the filter is running from an environment in async mode and the filter supports async execution. It's your responsibility to await this if needed. .. versionadded:: 2.7 T)r)rrrr{r8rrrr<r<r= call_filterszEnvironment.call_filtercCs|j||||||dS)aInvoke a test on a value the same way the compiler does. This might return a coroutine if the test is running from an environment in async mode and the test supports async execution. It's your responsibility to await this if needed. .. versionchanged:: 3.0 Tests support ``@pass_context``, etc. decorators. Added the ``context`` and ``eval_ctx`` parameters. .. versionadded:: 2.7 F)r)rrrr{r8rrrr<r<r= call_test-szEnvironment.call_test)sourcerfilenamer9c Cs4y|j|||Stk r.|j|dYnXdS)aParse the sourcecode and return the abstract syntax tree. This tree of nodes is used by the compiler to convert the template into executable source- or bytecode. This is useful for debugging or to extract information from templates. If you are :ref:`developing Jinja extensions ` this gives you a good overview of the node tree generated. )rN)_parserhandle_exception)rrrrrr<r<r=parseFszEnvironment.parsecCst||||jS)z8Internal parsing function used by `parse` and `compile`.)r%r)rrrrrr<r<r=rZszEnvironment._parsec Cs>t|}y|jj|||Stk r8|j|dYnXdS)aLex the given sourcecode and return a generator that yields tokens as tuples in the form ``(lineno, token_type, value)``. This can be useful for :ref:`extension development ` and debugging templates. This does not perform preprocessing. If you want the preprocessing of the extensions to be applied you have to filter source through the :meth:`preprocess` method. )rN)rJrZ tokeniterrr)rrrrrr<r<r=lex`s zEnvironment.lexcstfdd|jt|S)zPreprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized. cs|j|S)N) preprocess)sr)rrr<r=rsz(Environment.preprocess..)rrrJ)rrrrrr<)rrr=rus  zEnvironment.preprocess)rrrstater9cCsV|j|||}|jj||||}x0|jD]$}|j|}t|ts*t|||}q*W|S)zCalled by the parser to do the preprocessing and filtering for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`. )rrtokenizerZ filter_streamrIr#)rrrrrrstreamextr<r<r= _tokenizes   zEnvironment._tokenize)rrr defer_initr9cCst||||||jdS)z|Internal hook that can be overridden to hook a different generate method in. .. versionadded:: 2.5 )rre)r re)rrrrrrr<r<r= _generates zEnvironment._generate)rrr9cCs t||dS)z{Internal hook that can be overridden to hook a different compile method in. .. versionadded:: 2.5 exec)compile)rrrrr<r<r=_compileszEnvironment._compilezte.Literal[False])rrrrawrr9cCsdS)Nr<)rrrrrrrr<r<r=rs zEnvironment.compilezte.Literal[True]cCsdS)Nr<)rrrrrrrr<r<r=rs c Csxd}yNt|tr"|}|j|||}|j||||d}|r<|S|dkrHd}|j||Stk rr|j|dYnXdS)aCompile a node or template source code. The `name` parameter is the load name of the template after it was joined using :meth:`join_path` if necessary, not the filename on the file system. the `filename` parameter is the estimated filename of the template on the file system. If the template came from a database or memory this can be omitted. The return value of this method is a python code object. If the `raw` parameter is `True` the return value will be a string with python code equivalent to the bytecode returned otherwise. This method is mainly used internally. `defer_init` is use internally to aid the module code generator. This causes the generated code to be able to import without the global environment variable to be set. .. versionadded:: 2.4 `defer_init` parameter added. N)rz