관리-도구
편집 파일: utils.cpython-39.pyc
a ��`�W � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dl m Z d dl mZ d dlmZ d dlmZ d d lmZ d dlmZ d dlmZ d d lmZ d dlmZ eddddd� i�� Ze� ZdjZde �d�vZdd� Z dd� Z!dd� Z"dd� Z#dd � Z$d!d"� Z%d#d$� Z&dJd&d'�Z'dKd)d*�Z(d+d,� Z)dLd-d.�Z*dMd/d0�Z+dNd5d6�Z,dOd8d9�Z-G d:d;� d;e.�Z/ej0�1e/� dPd=d>�Z2dQd?d@�Z3G dAdB� dBe.�Z4G dCdD� dDe.�Z5G dEdF� dFe.�Z6ze7dG� d2Z8W n e9�y� d%Z8Y n0 dHdI� Z:dS )R� N)�deque)�choice)� randrange)� ascii_letters)�digits)�Lock��escape)�Markup� )�abc)�string_types)� text_type)� url_quoteZMissingType� �__repr__c C s dS )N�missingr )�xr r �0/usr/lib/python3.9/site-packages/jinja2/utils.py�<lambda> � r � z\/�/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)�evalcontextfunctionr r r r r 0 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)�environmentfunctionr r r r r = s r c C s t �| j� | S )z%Marks the function as internally used)� internal_code�add�__code__r r r r �internalcodeG 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)Zruntimer"