Your IP : 3.147.78.249
B
F��a� � @ s� d dl Z d dlZd dlmZ ddlmZ ddlmZ e�d�Z dd� Z
eee
eeeeed�hZejejd df dd �d
d�Zdd
d�dd�Zdejd d �dd�ZdS )� N)�wraps� )�_PassArg)�pass_eval_context�Vc s � fdd�}|S )Nc sr t ���}|d k�|t jkr0tjtd�dd��ntjtd�dd��t��� ���fdd��}�rht|�}d|_|S )N)�args�returnc S s t �t| d j�S )Nr )�t�cast�bool�is_async)r � r
�C/opt/alt/python37/lib/python3.7/site-packages/jinja2/async_utils.pyr s z2async_variant.<locals>.decorator.<locals>.is_asyncc S s t �t| d jj�S )Nr )r r
r �environmentr )r r
r
r r s c s0 �| �}�r| dd � } |r&� | |�S �| |�S )Nr r
)r �kwargs�b)�
async_funcr �need_eval_context�normal_funcr
r �wrapper s
z1async_variant.<locals>.decorator.<locals>.wrapperT) r Zfrom_objr r �Anyr r r Zjinja_async_variant)r Zpass_argr )r )r r r r � decorator s
z async_variant.<locals>.decoratorr
)r r r
)r r �
async_variant s r )�valuer c � s@ t | �tkrt�d| �S t�| �r4t�d| �I d H S t�d| �S )Nr zt.Awaitable[V])�type�_common_primitivesr r
�inspect�isawaitable)r r
r
r �
auto_await2 s
r z*t.Union[t.AsyncIterable[V], t.Iterable[V]]zt.AsyncIterator[V])�iterabler c C sf t | d�rFxVt�d| �2 y3 d H }W n
tk
s8X |V q Y W nxt�d| �D ]
}|V qTW d S )N� __aiter__zt.AsyncIterable[V]z
t.Iterable[V])�hasattrr r
�StopAsyncIteration)r �itemr
r
r �
auto_aiter= s
&r$ c � s dd� t | �2 �I d H S )Nc
� s. g | y3 d H }W n
t k
s"X |�q Y S )N)r"