%PDF- %PDF-
| Direktori : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/ |
| Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/utils.cpython-37.pyc |
B
��R%? � @ s� d Z ddlZddlZddlmZ ddlmZmZmZm Z m
Z
e�d�Ze�dd�
eejd��d�
eejd ��f �Ze�d
�Ze�d�Ze�d�Zd
ZdZeddddd� i�� Ze� Zdj
Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Z d!d"� Z!d@d$d%�Z"dAd'd(�Z#d)d*� Z$dBd+d,�Z%dCd-d.�Z&dDd3d4�Z'dEd6d7�Z(G d8d9� d9e)�Z*ydd:lm+Z+ e+�,e*� W n e-k
�rx Y nX eG d;d<� d<e)��Z.G d=d>� d>e)�Z/dd?l0m1Z1mZm2Z2 dS )Fz�
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
� N)�deque)� text_type�string_types�implements_iterator�
allocate_lock� url_quotez(\s+)z4^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$�|)�(�<z<)�.�,�)�>�
z>z&^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$z(<!--.*?-->|<[^>]*>)z &([^;]+);Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZMissingType� �__repr__c C s dS )N�missingr )�xr r �=/opt/alt/python37/lib/python3.7/site-packages/jinja2/utils.py�<lambda> � r � c C s
d| _ | S )a+ This decorator can be used to mark a function or method context callable.
A context callable is passed the active :class:`Context` as first argument when
called from the template. This is useful if a function wants to get access
to the context or functions provided on the context object. For example
a function that returns a sorted list of template variables the current
template exports could look like this::
@contextfunction
def get_exported_names(context):
return sorted(context.exported_vars)
T)�contextfunction)�fr r r r ( s r c C s
d| _ | S )aG This decorator can be used to mark a function or method as an eval
context callable. This is similar to the :func:`contextfunction`
but instead of passing the context, an evaluation context object is
passed. For more information about the eval context, see
:ref:`eval-context`.
.. versionadded:: 2.4
T)�evalcontextfunction)r r r r r 8 s r c C s
d| _ | S )z�This decorator can be used to mark a function or method as environment
callable. This decorator works exactly like the :func:`contextfunction`
decorator just that the first argument is the active :class:`Environment`
and not context.
T)�environmentfunction)r r r r r E s r c C s t �| j� | S )z%Marks the function as internally used)�
internal_code�add�__code__)r r r r �internalcodeO s r c C s ddl m} t| |�S )a� Check if the object passed is undefined. This does nothing more than
performing an instance check against :class:`Undefined` but looks nicer.
This can be used for custom filters or tests that want to react to
undefined variables. For example a custom default filter can look like
this::
def default(var, default=''):
if is_undefined(var):
return default
return var
r )� Undefined)Zjinja2.runtimer! �
isinstance)�objr! r r r �is_undefinedU s r$ c C s x| D ]}qW dS )z4Consumes an iterable without doing anything with it.Nr )�iterableZeventr r r �consumee s
r&