
    hr                     N   S SK rS SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  SSK
Jr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  S\R&                  \R(                     S\R*                  \R(                     4S jr " S S\5      r " S S\5      r " S S\5      r\\l        g)    N)literal_eval)parse)chain)islice)GeneratorType   )nodes)CodeGenerator)Frame)has_safe_repr)Environment)Templatevaluesreturnc                    [        [        U S5      5      nU(       d  g[        U5      S:X  a  US   n[        U[        5      (       d  U$ OK[        U [
        5      (       a  [        X5      n SR                  U  Vs/ s H  n[	        U5      PM     sn5      n [        [        USS95      $ s  snf ! [        [        [        4 a    Us $ f = f)aV  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    eval)mode)listr   len
isinstancestrr   r   joinr   r   
ValueErrorSyntaxErrorMemoryError)r   headrawvs       gC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\jinja2/nativetypes.pynative_concatr"      s     vq!"D
4yA~1g#s##J $ fm,,4(Fggv.v!s1vv./ #F#	
 	
 / [1 
s   9B)B. .CCc                   v   \ rS rSrSr\S\R                  S\R                  4S j5       rS\R                  \R                     S\
4S jrS\R                  S	\S
\R                   S\R                  4S jrS\R                  S	\S
\R                   SS4S jrS\R                  S	\S
\R                   SS4S jrSrg)NativeCodeGenerator2   zYA code generator which renders Python types by not adding
``str()`` around output nodes.
valuer   c                     U $ N )r&   s    r!   _default_finalize%NativeCodeGenerator._default_finalize7   s        groupc           
      t    [        SR                  U Vs/ s H  n[        U5      PM     sn5      5      $ s  snf )Nr   )reprr   r   )selfr-   r    s      r!   _output_const_repr&NativeCodeGenerator._output_const_repr;   s,    BGGU3USVU34553s   5nodeframefinalizec                     UR                  UR                  5      n[        U5      (       d  [        R                  " 5       e[        U[        R                  5      (       a  U$ UR                  U5      $ r(   )as_consteval_ctxr   r	   
Impossibler   TemplateDataconst)r0   r3   r4   r5   r;   s        r!   _output_child_to_const*NativeCodeGenerator._output_child_to_const>   sW     enn-U##""$$dE..//L~~e$$r,   Nc                 V    UR                   b  U R                  UR                   5        g g r(   srcwriter0   r3   r4   r5   s       r!   _output_child_pre%NativeCodeGenerator._output_child_preK   s#     <<#JJx||$ $r,   c                 B    UR                   b  U R                  S5        g g )N)r?   rB   s       r!   _output_child_post&NativeCodeGenerator._output_child_postQ   s     <<#JJsO $r,   r)   )__name__
__module____qualname____firstlineno____doc__staticmethodtAnyr*   Iterabler   r1   r	   Exprr   r
   _FinalizeInfor<   rC   rG   __static_attributes__r)   r,   r!   r$   r$   2   s      155  6

155(9 6c 6%JJ%',%8E8S8S%	
%%JJ%',%8E8S8S%	%JJ',8E8S8S	r,   r$   c                   ,    \ rS rSrSr\r\" \5      r	Sr
g)NativeEnvironmentX   z=An environment that renders templates to native Python types.r)   N)rI   rJ   rK   rL   rM   r$   code_generator_classrN   r"   concatrT   r)   r,   r!   rV   rV   X   s    G.-(Fr,   rV   c                       \ rS rSr\rS\R                  S\R                  S\R                  4S jrS\R                  S\R                  S\R                  4S jr	Sr
g)	NativeTemplate_   argskwargsr   c                     U R                  [        U0 UD65      n U R                  R                  U R	                  U5      5      $ ! [
         a    U R                  R                  5       s $ f = f)a  Render the template to produce a native Python type. 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.
)new_contextdictenvironment_classrY   root_render_func	Exceptionenvironmenthandle_exception)r0   r]   r^   ctxs       r!   renderNativeTemplate.renderb   sp     tT4V45	7))00%%c*   	7##4466	7s   )A $A-,A-c                 l  #    U R                   R                  (       d  [        S5      eU R                  [	        U0 UD65      n U R
                  R                  U R                  U5       Vs/ s S h  vN oDPM   N
 Os  snf sn5      $ ! [         a    U R                   R                  5       s $ f = f7f)Nz8The environment was not created with async mode enabled.)
re   is_asyncRuntimeErrorr`   ra   rb   rY   rc   rd   rf   )r0   r]   r^   rg   ns        r!   render_asyncNativeTemplate.render_asyncr   s     ((J  tT4V45	7))00"&"7"7"<==Q==   	7##4466	7sZ   AB4(B
 ,A>.A<
2A:3A<
6A>:A<
<A>=B
 	B4
$B1.B40B11B4r)   N)rI   rJ   rK   rL   rV   rb   rO   rP   rh   rn   rT   r)   r,   r!   r[   r[   _   sT    )7AEE 7QUU 7quu 7 7 7 7155 7r,   r[   )typingrO   astr   r   	itertoolsr   r   typesr   r   r	   compilerr
   r   r   re   r   r   rQ   rP   Optionalr"   r$   rV   r[   template_classr)   r,   r!   <module>rw      s           #  # $ !!**QUU+ 

1550A D#- #L) ) 7X  7F $2   r,   