← Back
Editing: nativetypes.cpython-311.pyc
� P}<b� � �D � d dl Zd dlmZ d dlmZ d dlmZ d dlmZ d dlm Z ddl mZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ dej ej dej ej fd�Z G d� de � � Z G d� de� � Z G d� de� � Zee_ dS )� N)�literal_eval)�parse)�chain)�islice)� GeneratorType� )�nodes)� CodeGenerator)�Frame)� has_safe_repr)�Environment)�Template�values�returnc � � t t | d� � � � }|sdS t |� � dk r |d }t |t � � s|S nDt | t � � rt || � � } d� d� | D � � � � } t t |d�� � � � S # t t t f$ r |cY S w xY w) an Return a native Python type from the list of compiled nodes. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the result can be parsed with :func:`ast.literal_eval`, the parsed value is returned. Otherwise, the string is returned. :param values: Iterable of outputs to concatenate. � Nr r � c �, � g | ]}t |� � ��S � ��str��.0�vs �4/usr/lib/python3/dist-packages/jinja2/nativetypes.py� <listcomp>z!native_concat.<locals>.<listcomp>% s � �.�.�.�!�s�1�v�v�.�.�.� �eval)�mode) �listr �len� isinstancer r r �joinr r � ValueError�SyntaxError�MemoryError)r �head�raws r � native_concatr) s� � � ��v�q�!�!�"�"�D�� ��t� �4�y�y�A�~�~��1�g���#�s�#�#� ��J� � �f�m�,�,� )��4��(�(�F��g�g�.�.�v�.�.�.�/�/���� �#�F�#�#�#� � � �� ��[�1� � � �� � � ����s �B8 �8C�Cc � � e Zd ZdZedej dej fd�� � Zdej ej de fd�Z dej de d ej dej fd �Zdej de d ej ddfd�Zdej de d ej ddfd �ZdS )�NativeCodeGeneratorzaA code generator which renders Python types by not adding ``str()`` around output nodes. �valuer c � � | S �Nr )r, s r �_default_finalizez%NativeCodeGenerator._default_finalize7 s � ��r �groupc �Z � t d� d� |D � � � � � � S )Nr c �, � g | ]}t |� � ��S r r r s r r z:NativeCodeGenerator._output_const_repr.<locals>.<listcomp><