shell bypass 403

Cubjrnet7 Shell


name : asyncsupport.cpython-39.pyc
a

�`)�@sdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZdd	lm
Z
dd
lmZdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Ze
dd��Zdd�Zd0dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZGd,d-�d-e
�Zd1d.d/�Z e�dS)2zWThe code for async support. Importing this patches Jinja on supported
Python versions.
�N��update_wrapper)�Markup�)�TemplateModule)�LoopContext��concat��internalcode)�missingc�s&g���fdd�}|�IdHt��S)Nc�s"�2z3dHW}��|�q6dS�N)�append)�event��	async_gen�rv��7/usr/lib/python3.9/site-packages/jinja2/asyncsupport.py�collectszconcat_async.<locals>.collectr)rrrrr�concat_asyncsrcOs\t|i|��}z*|�|�|��2z3dHW}|Vq 6WntyV|j��VYn0dSr
)�dict�root_render_func�new_context�	Exception�environment�handle_exception)�self�args�kwargs�varsrrrr�generate_asyncsr!cs dd����fdd�}t|��S)Ncss>|j|i|��}z|�|���VqWnty8Yn0dSr
)r!�run_until_complete�	__anext__�StopAsyncIteration)r�looprrrrrr�_convert_generator's
z.wrap_generate_func.<locals>._convert_generatorcs0|jjs�|g|�Ri|��S�|t��||�Sr
)r�is_async�asyncio�get_event_loop)rrr�r&�original_generaterr�generate/sz$wrap_generate_func.<locals>.generater)r+r,rr*r�wrap_generate_func&sr-c�s`|jjstd��t|i|��}|�|�}zt|�|��IdHWStyZ|j��YS0dS)Nz8The environment was not created with async mode enabled.)	rr'�RuntimeErrorrrrrrr)rrrr �ctxrrr�render_async7s
r0cs�fdd�}t|��S)Ncs<|jjs�|g|�Ri|��St��}|�|j|i|���Sr
)rr'r(r)r"r0)rrrr%��original_renderrr�renderEsz wrap_render_func.<locals>.renderr)r2r3rr1r�wrap_render_funcDsr4cs(tdd���t��fdd��}t|��S)Nc�s2t|j|j|j��IdH}|jjjr.t|�}|Sr
)rZ_stackZ_depth�_contextZeval_ctx�
autoescaper�rrrrr�
async_callOs
z-wrap_block_reference_call.<locals>.async_callcs|jjjs�|�S�|�Sr
)r5rr'�r�r8�
original_callrr�__call__Vs
z+wrap_block_reference_call.<locals>.__call__�rr)r;r<rr:r�wrap_block_reference_callNs

r>cs(tdd���t��fdd��}t|��S)Nc�s |j|�IdH}|rt|�}|Sr
)Z_funcr)r�	argumentsr6rrrr�async_invoke`sz'wrap_macro_invoke.<locals>.async_invokecs |jjs�|||�S�|||�Sr
)Z_environmentr')rr?r6�r@�original_invokerr�_invokegsz"wrap_macro_invoke.<locals>._invoker=)rBrCrrAr�wrap_macro_invoke_s

rDc�s(|jdur|jS|��IdH|_}|Sr
)�_module�make_module_asyncr7rrr�get_default_module_asyncps
rGcst�fdd��}|S)Ncs|jjrtd���|�S)Nz6Template module attribute is unavailable in async mode)rr'r.r9��original_default_modulerr�_get_default_moduleysz0wrap_default_module.<locals>._get_default_moduler
)rIrJrrHr�wrap_default_modulexsrKFc�sB|�|||�}g}|�|�2z3dHW}|�|�q6t|||�Sr
)rrrr)rr Zshared�locals�contextZbody_stream�itemrrrrF�s
rFcCsdddlm}t|j�|_tt|j�|_tt|j�|_t|j�|_t	|j
�|_
t|_tt
|j
�|_
dS)Nr��Template)�rPr-r,rr!r0r4r3rKrJrGZ_get_default_module_asyncrFrOrrr�patch_template�s�rRcCs,ddlm}m}t|j�|_t|j�|_dS)Nr��BlockReference�Macro)�runtimerTrUr>r<rDrCrSrrr�
patch_runtime�srWcCs&ddlm}ddlm}|�|�dS)Nr)�FILTERS)�
ASYNC_FILTERS)�filtersrXZasyncfiltersrY�update)rXrYrrr�
patch_filters�sr\cCst�t�t�dSr
)rRrWr\rrrr�	patch_all�sr]c�st�|�r|IdHS|Sr
)�inspectZisawaitable)�valuerrr�
auto_await�s

r`cCs<t|d�r(|2z3dHW}|Vq6dS|D]
}|Vq,dS)N�	__aiter__)�hasattr)�iterablerNrrr�
auto_aiter�s

rdc@sheZdZee�Zedd��Zedd��Zedd��Z	dd�Z
ed	d
��Zedd��Zd
d�Z
dd�ZdS)�AsyncLoopContextc�sv|jdur|jSzt|j�|_WnNtyndd�|j2�IdH}|�|�|_t|�|j|jtu|_Yn0|jS)Nc�sg|z3dHW}|�q6Sr
r)�.0�xrrr�
<listcomp>��z+AsyncLoopContext.length.<locals>.<listcomp>)	Z_length�lenZ	_iterable�	TypeError�	_iterator�_to_iterator�index�_afterr)rrcrrr�length�s
 zAsyncLoopContext.lengthc�s|jIdH|jSr
)rprnr9rrr�	revindex0�szAsyncLoopContext.revindex0c�s|jIdH|jSr
)rp�index0r9rrr�revindex�szAsyncLoopContext.revindexc�sF|jtur|jSz|j��IdH|_Wnty>t|_Yn0|jSr
)rorrlr#r$r9rrr�
_peek_next�s
zAsyncLoopContext._peek_nextc�s|��IdHtuSr
)rtrr9rrr�last�szAsyncLoopContext.lastc�s$|��IdH}|tur |�d�S|S)Nzthere is no next item)rtrZ
_undefinedr7rrr�nextitem�s
zAsyncLoopContext.nextitemcCs|Sr
rr9rrrra�szAsyncLoopContext.__aiter__c�sL|jtur|j}t|_n|j��IdH}|jd7_|j|_||_||fS)Nr)rorrlr#rrZ_currentZ_beforer7rrrr#�s
zAsyncLoopContext.__anext__N)�__name__�
__module__�__qualname__�staticmethodrdrm�propertyrprqrsrtrurvrar#rrrrre�s





rec�s&ddl}|jdtdd�t||||�S)NrzRThis template must be recompiled with at least Jinja 2.11, or it will fail in 3.0.�)�
stacklevel)�warnings�warn�DeprecationWarningre)rcZ	undefinedZrecurseZdepth0r~rrr�make_async_loop_context�s�r�)NFN)Nr)!�__doc__r(r^�	functoolsrZ
markupsaferrrrVrZutilsr	rrrr!r-r0r4r>rDrGrKrFrRrWr\r]r`rdrer�rrrr�<module>s:	




	A


© 2025 Cubjrnet7