Your IP : 18.119.134.196
B
f�q` � ( @ sr d Z ddlZddlZddlmZ ddlmZ ddlm Z ddl
mZ ejrVddl
mZ eed �d
d�Zeed �dd
�Zeeed�dd�Zejed �dd�Zejed �dd�Zedeed�dd��Zedeed�dd��Zejed �dd�Zejed �dd�Zejed �dd �Zejed �d!d"�Zejed �d#d$�Zejed �d%d&�Zeed �d'd(�Z eed �d)d*�Z!ejed �d+d,�Z"ejed �d-d.�Z#ejed �d/d0�Z$ejed �d1d2�Z%ejejed3�d4d5�Z&ejed �d6d7�Z'ejed �d8d9�Z(ejej)ed:�d;d<�Z*eeeeeeeeeeeeee e!e"e#e$e%e'e+e&e(e*ej,ej,ej,ej-ej-ej.ej.ej.ej/ej/ej0ej0ej0ej1ej1d=�'Z2dS )>z6Built-in template tests used with the ``is`` operator.� N)�abc)�Number� )� Undefined)�pass_environment)�Environment)�value�returnc C s | d dkS )z#Return true if the variable is odd.� r � )r r r �=/opt/alt/python37/lib/python3.7/site-packages/jinja2/tests.py�test_odd s r
c C s | d dkS )z$Return true if the variable is even.r
r r )r r r r � test_even s r )r �numr c C s | | dkS )z-Check if a variable is divisible by a number.r r )r r r r r �test_divisibleby s r c C s t | t� S )a; Return true if the variable is defined:
.. sourcecode:: jinja
{% if variable is defined %}
value of variable: {{ variable }}
{% else %}
variable is not defined
{% endif %}
See the :func:`default` filter for a simple way to set undefined
variables.
)�
isinstancer )r r r r �test_defined s r c C s
t | t�S )z-Like :func:`defined` but the other way round.)r r )r r r r �test_undefined. s r r )�envr r c C s
|| j kS )a Check if a filter exists by name. Useful if a filter may be
optionally available.
.. code-block:: jinja
{% if 'markdown' is filter %}
{{ value | markdown }}
{% else %}
{{ value }}
{% endif %}
.. versionadded:: 3.0
)�filters)r r r r r �test_filter3 s r c C s
|| j kS )a� Check if a test exists by name. Useful if a test may be
optionally available.
.. code-block:: jinja
{% if 'loud' is test %}
{% if value is loud %}
{{ value|upper }}
{% else %}
{{ value|lower }}
{% endif %}
{% else %}
{{ value }}
{% endif %}
.. versionadded:: 3.0
)�tests)r r r r r � test_testE s r c C s | dkS )z$Return true if the variable is none.Nr )r r r r � test_none[ s r c C s | dkp| dkS )zNReturn true if the object is a boolean value.
.. versionadded:: 2.11
TFr )r r r r �test_boolean` s r c C s | dkS )zDReturn true if the object is False.
.. versionadded:: 2.11
Fr )r r r r �
test_falseh s r c C s | dkS )zCReturn true if the object is True.
.. versionadded:: 2.11
Tr )r r r r � test_truep s r c C s t | t�o| dk o| dk S )zIReturn true if the object is an integer.
.. versionadded:: 2.11
TF)r �int)r r r r �test_integery s r c C s
t | t�S )zFReturn true if the object is a float.
.. versionadded:: 2.11
)r �float)r r r r �
test_float� s r c C s t | ��� S )z*Return true if the variable is lowercased.)�str�islower)r r r r �
test_lower� s r# c C s t | ��� S )z*Return true if the variable is uppercased.)r! �isupper)r r r r �
test_upper� s r% c C s
t | t�S )z&Return true if the object is a string.)r r! )r r r r �test_string� s r&