
    h|                     X   % S r SSKrSSKr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  \R,                  (       aG  SSKrSSKJr  SSKJr  SSKJr   " S S\R<                  5      r " S S\5      r \RB                  \\ 4   r"Sr#\RH                  \%S4   \&S'   \RN                  " S5      r( " S S5      r)\S\S\RT                  S\RT                  S\RB                  \RT                  \4   4S  j5       r+S!\RX                  \%/\%4   S\RX                  S\%4   4S" jr-S!\RX                  \%\%\./\%4   S\RX                  S\%4   4S# jr/S!\RX                  \%\%/\%4   S\RX                  S\%4   4S$ jr0S!\RX                  \%\%\%\./\%4   S\RX                  S\%4   4S% jr1 " S& S'\)5      r2 " S( S)\)5      r3 " S* S+\)5      r4 " S, S-\)5      r5\#S.4S/\	Rl                  S0\Rn                  \%   S1\8S\Rr                  \RH                  \.\%\RB                  \Rt                  \%   \RH                  \Rt                  \%   S4   4   4      4S2 jjr; " S3 S45      r<S5\Rz                  S6\Rn                  \%   S7\Rn                  \%   S8\R|                  \%\RT                  4   S\Rr                  \RH                  \.\%\RB                  \Rt                  \%   \RH                  \Rt                  \%   S4   4   \R~                  \%   4      4
S9 jr@\2rA\3rB\4rC\5rDg):z2Extension API for adding custom tags and behavior.    N)Markup   )defaults)nodes)Environment)TemplateAssertionError)TemplateSyntaxError)concat)Context)	Undefined)import_string)pass_context)Token)TokenStream)Parserc                   @    \ rS rSrS\S\4S jrS\S\S\S\4S jrS	rg
)_TranslationsBasic   messagereturnc                     g N )selfr   s     B/var/www/auris/envauris/lib/python3.13/site-packages/jinja2/ext.pygettext_TranslationsBasic.gettext   s        singularpluralnc                     g r   r   )r   r   r    r!   s       r   ngettext_TranslationsBasic.ngettext   s    r   r   N)	__name__
__module____qualname____firstlineno__strr   intr#   __static_attributes__r   r   r   r   r      s0    33333	S 	# 	# 	# 	r   r   c            
       H    \ rS rSrS\S\S\4S jrS\S\S\S\S\4
S	 jrS
rg)_TranslationsContext!   contextr   r   c                     g r   r   )r   r/   r   s      r   pgettext_TranslationsContext.pgettext"   s    sr   r   r    r!   c                     g r   r   )r   r/   r   r    r!   s        r   	npgettext_TranslationsContext.npgettext$   s    r   r   N)	r%   r&   r'   r(   r)   r1   r*   r4   r+   r   r   r   r-   r-   !   sA    BCB#B#B		*-	7:	?B		r   r-   )_r   r#   r1   r4   .GETTEXT_FUNCTIONSz\s*\n\s*c                   J   \ rS rSr% Sr\R                  \   \S'   S S jr	\
" 5       r\R                  \   \S'   SrS	\SS4S
 jrS	\SS4S jr S!S\S\R"                  \   S\R"                  \   S\4S jjrSSS\R&                  S\R(                  S   4   4S jrSSS\R&                  \R.                  \R0                  \R.                     4   4S jr S!S\S\R"                  \   S\R6                  4S jjr     S"S\S\R"                  \R0                  \R:                        S\R"                  \R0                  \R<                        S\R"                  \R:                     S\R"                  \R:                     S\R"                  \   S\R>                  4S jjr Sr!g)#	Extension7   a+  Extensions can be used to add extra functionality to the Jinja template
system at the parser level.  Custom extensions are bound to an environment
but may not store environment specific data on `self`.  The reason for
this is that an extension can be bound to another environment (for
overlays) by creating a copy and reassigning the `environment` attribute.

As extensions are created by the environment they cannot accept any
arguments for configuration.  One may want to work around that by using
a factory function, but that is not possible as extensions are identified
by their import name.  The correct way to configure the extension is
storing the configuration values on the environment.  Because this way the
environment ends up acting as central configuration storage the
attributes may clash which is why extensions have to ensure that the names
they choose for configuration are not too generic.  ``prefix`` for example
is a terrible name, ``fragment_cache_prefix`` on the other hand is a good
name as includes the name of the extension (fragment cache).

identifierr   Nc                 D    U R                    SU R                   3U l        g )N.)r&   r%   r;   )clss    r   __init_subclass__Extension.__init_subclass__L   s    NN+1S\\N;r   tagsd   environmentc                     Xl         g r   rC   )r   rC   s     r   __init__Extension.__init__Y   s    &r   zte.Selfc                     [         R                  U R                  5      nUR                  R	                  U R                  5        Xl        U$ )z=Create a copy of this extension bound to another environment.)object__new__	__class____dict__updaterC   )r   rC   rvs      r   bindExtension.bind\   s4    ^^DNN+
4==)$	r   sourcenamefilenamec                     U$ )zThis method is called before the actual lexing and can be used to
preprocess the source.  The `filename` is optional.  The return value
must be the preprocessed source.
r   )r   rQ   rR   rS   s       r   
preprocessExtension.preprocessc   s	     r   streamr   r   c                     U$ )zIt's passed a :class:`~jinja2.lexer.TokenStream` that can be used
to filter tokens returned.  This method has to return an iterable of
:class:`~jinja2.lexer.Token`\s, but it doesn't have to return a
:class:`~jinja2.lexer.TokenStream`.
r   )r   rW   s     r   filter_streamExtension.filter_streaml   s	     r   parserr   c                     [        5       e)zIf any of the :attr:`tags` matched this method is called with the
parser as first argument.  The token the parser stream is pointing at
is the name token that matched.  This method has to return one or a
list of multiple nodes.
)NotImplementedError)r   r[   s     r   parseExtension.parsev   s     "##r   linenoc                 @    [         R                  " U R                  XS9$ )zReturn an attribute node for the current extension.  This is useful
to pass constants on extensions to generated template code.

::

    self.attr('_my_attribute', lineno=lineno)
r`   )r   ExtensionAttributer;   )r   rR   r`   s      r   attrExtension.attr~   s     ''MMr   argskwargsdyn_args
dyn_kwargsc           	      b    Uc  / nUc  / n[         R                  " U R                  XS9UUUUUS9$ )zcCall a method of the extension.  This is a shortcut for
:meth:`attr` + :class:`jinja2.nodes.Call`.
rb   )r   Callrd   )r   rR   rf   rg   rh   ri   r`   s          r   call_methodExtension.call_method   sF     <D>FzzIIdI*
 	
r   rE   )r   Nr   )NNNNN)"r%   r&   r'   r(   __doc__tClassVarr)   __annotations__r?   setrA   Setpriorityr   rF   rO   OptionalrU   UnionIterablerY   r   NodeListr^   r*   rc   rd   ExprKeywordrk   rl   r+   r   r   r   r9   r9   7   s   $ 

3< uD!%%* H'K 'D ' 	  OS!"C<=JJsO	#	


7 33	4$H $QVVEJJ=O1O)P $ 48
N
N!"C
N		!	!
N 0448+/-1"&

 jj

+,
 

166%--01	

 **UZZ(
 JJuzz*
 

3
 

 
r   r9   	__contextrf   rg   r   c                 L    U R                   " U R                  S5      /UQ70 UD6$ )Nr   )callresolve)r|   rf   rg   s      r   _gettext_aliasr      s(     >>)++I6HHHHr   funcc           	      n   ^  [         S[        S[        S[        R                  S[        4U 4S jj5       nU$ )Nr|   __string	variablesr   c                 |   > U R                  TU5      nU R                  R                  (       a  [        U5      nX2-  $ r   )r~   eval_ctx
autoescaper   )r|   r   r   rN   r   s       r   r   "_make_new_gettext.<locals>.gettext   s5    ^^D(+((B ~r   r   r   r)   ro   Any)r   r   s   ` r   _make_new_gettextr      s<    7 c  #   Nr   c                    ^  [         S[        S[        S[        S[        S[        R
                  S[        4U 4S jj5       nU$ )Nr|   
__singular__plural__numr   r   c                    > UR                  SU5        U R                  TXU5      nU R                  R                  (       a  [	        U5      nXT-  $ )Nnum
setdefaultr~   r   r   r   )r|   r   r   r   r   rN   r   s         r   r#   $_make_new_ngettext.<locals>.ngettext   sG     	UE*^^D*>((B~r   r   r   r)   r*   ro   r   )r   r#   s   ` r   _make_new_ngettextr      sX      	
 UU 
  Or   c                 z   ^  [         S[        S[        S[        S[        R                  S[        4
U 4S jj5       nU$ )Nr|   __string_ctxr   r   r   c                    > UR                  SU5        U R                  TX5      nU R                  R                  (       a  [	        U5      nXC-  $ )Nr/   r   )r|   r   r   r   rN   r   s        r   r1   $_make_new_pgettext.<locals>.pgettext   sG     	Y5^^D,9((B ~r   r   )r   r1   s   ` r   _make_new_pgettextr      sH    

*-
9<
KL55
	
 
 Or   c                    ^  [         S[        S[        S[        S[        S[        S[        R
                  S[        4U 4S jj5       nU$ )	Nr|   r   r   r   r   r   r   c                    > UR                  SU5        UR                  SU5        U R                  TXX45      nU R                  R                  (       a  [	        U5      nXe-  $ )Nr/   r   r   )r|   r   r   r   r   r   rN   r   s          r   r4   &_make_new_npgettext.<locals>.npgettext   sY     	Y5UE*^^D,HL((B ~r   r   )r   r4   s   ` r   _make_new_npgettextr      se       	
  UU 
 $ r   c                     ^  \ rS rSrSrS1rS\SS4U 4S jjr S(SS	S
\R                  \
   SS4S jjrS(S
\R                  \
   SS4S jjr   S)S\R                  \/\4   S\R                  \\\/\4   S
\R                  \
   S\R                  \R                  \\/\4      S\R                  \R                  \\\\/\4      SS4S jjrS*S jr\4S\R&                  \\R*                  4   S\R,                  \   S\R.                  \R0                  \\\R&                  \R                  \   \R0                  \R                  \   S4   4   4      4S jjrSSS\R&                  \R4                  \R6                  \R4                     4   4S jr\4S\S\R<                  \   S\4S jjrSSS\
S\R0                  \R6                  \   \4   4S jr S\S \R                  \   S!\R                  \   S"\RB                  \\RD                  4   S#\R                  \RD                     S$\
S%\
S\RF                  4S& jr$S'r%U =r&$ )+InternationalizationExtension   z-This extension adds gettext support to Jinja.transrC   r   Nc           	         > [         TU ]  U5        [        UR                  S'   UR	                  U R
                  U R                  U R                  U R                  U R                  SS9  g )Nr6   F)install_gettext_translationsinstall_null_translationsinstall_gettext_callablesuninstall_gettext_translationsextract_translationsnewstyle_gettext)
superrF   r   globalsextend_install_install_null_install_callables
_uninstall_extract)r   rC   rK   s     r   rF   &InternationalizationExtension.__init__  s]    %#1C )-&*&8&8&*&=&=+/??!%" 	 	
r   translations_SupportedTranslationsnewstylec                     [        USS 5      nUc  UR                  n[        USS 5      nUc  UR                  n[        USS 5      n[        USS 5      nU R                  X4X%US9  g )Nugettext	ungettextr1   r4   )r   r1   r4   )getattrr   r#   r   )r   r   r   r   r#   r1   r4   s          r   r   &InternationalizationExtension._install  sw    
 ,
D9?"**G<d;#,,H<T:L+t<	y 	  	
r   c           
      f   SS K nUR                  5       n[        US5      (       a  UR                  nOS[        S[        S[        4S jn[        US5      (       a  UR
                  nO#S[        S[        S[        S	[        S[        4
S
 jnU R                  UR                   UR                  UUUS9  g )Nr   r1   csr   c                     U$ r   r   )r   r   s     r   r1   =InternationalizationExtension._install_null.<locals>.pgettext*  s    r   r4   pr!   c                     US:X  a  U$ U$ )Nr   r   )r   r   r   r!   s       r   r4   >InternationalizationExtension._install_null.<locals>.npgettext1  s    Fq))r   )r   r#   r   r1   r4   )	r   NullTranslationshasattrr1   r)   r4   r*   r   r#   )r   r   r   r   r1   r4   s         r   r   +InternationalizationExtension._install_null   s    //1<,,#,,HC C C  <--$..I*S *S *S *S *S * 	 ((!** 	  	
r   r   r#   r1   r4   c                    Ub  X0R                   l        U R                   R                  (       a2  [        U5      n[        U5      nUb  [	        U5      nUb  [        U5      nU R                   R                  R                  XXES9  g N)r   r#   r1   r4   )rC   r   r   r   r   r   r   rM   )r   r   r#   r   r1   r4   s         r   r   0InternationalizationExtension._install_callables<  s}     08-,,'0G)(3H#-h7$/	:	  '' 	( 	
r   c                 b    S H)  nU R                   R                  R                  US 5        M+     g r   )rC   r   pop)r   r   keys      r   r   (InternationalizationExtension._uninstallT  s)    CC$$((d3 Dr   rQ   gettext_functions.c                 x    [        U[        5      (       a  U R                  R                  U5      n[	        X5      $ r   )
isinstancer)   rC   r^   extract_from_ast)r   rQ   r   s      r   r   &InternationalizationExtension._extractX  s2     fc""%%++F3F::r   r[   r   c           
      
   [        UR                  5      R                  nSnUR                  R                  S5      nUb  UR                  nSnSnSn0 nSn	UR                  R
                  R                  S:w  Ga  U(       a  UR                  R                  S5        UR                  R                  S5      (       a  GOUR                  R                  S5      n
U
R                  U;   a.  UR                  SU
R                  < S	3U
R                  [        S
9  UR                  R
                  R                  S:X  a4  [        UR                  5        UR                  5       =XR                  '   nOTU	c"  U
R                  S;   a  U
R                  S:H  n	GM?  [        R                  " U
R                  S5      =XR                  '   nUc  [        U[        R                  5      (       aR  [        R                  " SS5      nXXU
R                  '   [        R                   " [        R                  " SS5      U5      nOUnU
R                  S:H  nUR                  R
                  R                  S:w  a  GM  UR                  R                  S5        SnSn[#        5       nU R%                  US5      u  nnU(       a6  UR'                  U5        Uc"  [        R                  " US   S5      nUS   S:H  nUR                  R
                  R)                  S5      (       Ga  Sn[        UR                  5        UR                  R
                  R                  S:w  av  UR                  R                  S5      n
U
R                  U;  a.  UR                  SU
R                  < S3U
R                  [        S
9  XR                     nU
R                  S:H  nUR                  R                  S5        U R%                  US5      u  nn[        UR                  5        UR'                  U5        O[        UR                  5        U H%  nUU;  d  M  [        R                  " US5      UU'   M'     U(       d  SnOUc  UR                  SU5        U	c  U R*                  R,                  S   n	U	(       a)  U R/                  U5      nU(       a  U R/                  U5      nU R1                  UUUUU[3        U5      U=(       a    U5      nUR5                  U5        Ub  UU/$ U$ )zParse a translatable tag.NstringF	block_endcommacolonrR   ztranslatable variable z defined twice.)excassign)trimmed	notrimmedr   load_transstorer   Tr   zname:pluralizezunknown variable z for pluralizationzpluralize without variablesext.i18n.trimmed)nextrW   r`   next_ifvaluecurrenttypeexpectskip_iffailr   parse_expressionr   Namer   rk   Assignrr   _parse_blockrM   testrC   policies_trim_whitespace
_make_nodebool
set_lineno)r   r[   r`   r/   context_tokenplural_exprplural_expr_assignmentnum_called_numr   r   tokenvarr    have_plural
referencedsingular_namesr   plural_namesrR   nodes                       r   r^   #InternationalizationExtension.parsec  sD   fmm$++--h7$#))G
 /3;?-/	mm##((K7$$W- }}$$W--MM((0E{{i',U[[O?KLL.   }}$$))X5V]]#/5/F/F/HH	++&U[[4L%L++2/4zz%++v/NN	++&"c5::.."'**Xv">K-8ekk*-2\\

8W5s.* #&K!&!5G mm##((K7J 	[)U
 $(#4#4VT#B n-"#jj):FC!/!2e!; ==  %%&677K}}$$))[8,,V4;;i/KK+EKK?:LM2   
 (4!&!5MM  -#'#4#4VU#C L&l+ D9$"'**T6":	$  K KK5v>?&&//0BCG,,X6H..v6*{
 	!-*D11Kr   r   _ws_rec                 B    UR                  SUR                  5       5      $ )N )substrip)r   r   r   s      r   r   .InternationalizationExtension._trim_whitespace  s    zz#v||~..r   allow_pluralizec                 x   / n/ n UR                   R                  R                  S:X  aV  UR                  UR                   R                  R                  R                  SS5      5        [        UR                   5        GOUR                   R                  R                  S:X  a}  [        UR                   5        UR                   R                  S5      R                  nUR                  U5        UR                  SU S35        UR                   R                  S5        GOUR                   R                  R                  S	:X  a  [        UR                   5        UR                   R                  R                  S:X  a   UR                   R                  R                  OS
nUS:X  a  OUS:X  a  U(       a  OzUR                  S5        OUS:X  a  UR                  S5        UR                  SU S35        O8UR                   R                  (       a  UR                  S5        O[        S5      eGM)  U[        U5      4$ )z1Parse until the next block tag with a given name.data%%%variable_beginrR   z%(z)svariable_endblock_beginNendtrans	pluralizez:a translatable section can have only one pluralize sectionr   z6trans blocks can't be nested; did you mean `endtrans`?zBcontrol structures in translatable sections are not allowed; saw ``zunclosed translation blockzinternal parser error)rW   r   r   appendr   replacer   r   r   eosRuntimeErrorr
   )r   r[   r  r   bufrR   
block_names          r   r   *InternationalizationExtension._parse_block  s    
}}$$))V3

6==0066>>sDIJV]]#&&++/??V]]#}}++F399!!$'

RvR=)$$^4&&++}<V]]# }},,11V; MM))// 
 +;.&KKT  7*KKP &<q* ""89"#:;;I L 6#;&&r   r   r    r/   r   r   vars_referencedr   c                 
   U R                   R                  nU(       d2  U(       d+  UR                  SS5      nU(       a  UR                  SS5      nSn	[        R                  " U5      /n
Ub+  U
R                  S[        R                  " U5      5        SU	 3n	Ub,  SU	 3n	U
R                  [        R                  " U5      U45        [        R                  " [        R                  " U	S5      U
/ SS5      nU(       aX  UR                  5        HC  u  pU(       a  US	:X  a  M  UR                  R                  [        R                  " X5      5        ME     O[        R                  " U5      nU(       aw  [        R                  " U[        R                  " UR                  5        VVs/ s H0  u  p[        R                   " [        R                  " U5      U5      PM2     snn5      5      n[        R"                  " U/5      $ s  snnf )
z/Generates a useful node from the data provided.r  r  r   Nr   r   r!   r   r   )rC   r   r  r   Constinsertr   rk   r   itemsrg   r  r{   MarkSafeIfAutoescapeModDictPairOutput)r   r   r    r/   r   r   r  r   r   	func_name	func_argsr   r   r   s                 r   r   (InternationalizationExtension._make_node  s    ##44
 x''c2Hc2	).X)>(?	QG 45I;I"I;Iekk&1;?@zz%**Y7BdS
 'oo/
 "cUl""5==#<= 0 --d3DyyJJ /8oo.?.?
 "JJu{{3'7?.? ||TF##s   %7G?r   r   )NNN)r   r   r   N)'r%   r&   r'   r(   rn   rA   r   rF   ro   ru   r   r   r   Callabler)   r*   r   r   r7   rv   r   TemplateSequenceIteratorTupler   rx   ry   r^   r   Patternr   r   r  rz   r  r   r+   __classcell__)rK   s   @r   r   r      s   79D

K 

D 

 TX
4
@A

4@P
	
$
ajj&6 
$ 
@ &*<@GK
SE3J'
 **c3_c12
 **T"	

 **QZZc
C89
 ::ajj#sC)=s)BCD
 

04 .?	;U^^+,	; ::c?	; 
	S!''!**S/1771::c?C;O3P"PQQR
		;xH xQVVEJJ=O1O)P xt FL /s /AIIcN /PS /-'-'15-'	
c!	"-'^<$<$ 

3<$ C	<$
 66#uzz/*<$ ZZ

+<$ <$ <$ 
<$ <$r   r   c                   D    \ rS rSrSrS1rSSS\R                  4S jrSr	g	)
ExprStmtExtensioniN  zjAdds a `do` tag to Jinja that works like the print statement just
that it doesn't print the return value.
dor[   r   r   c                     [         R                  " [        UR                  5      R                  S9nUR                  5       Ul        U$ )Nrb   )r   ExprStmtr   rW   r`   parse_tupler   )r   r[   r   s      r   r^   ExprStmtExtension.parseU  s4    ~~T&--%8%?%?@&&(	r   r   N)
r%   r&   r'   r(   rn   rA   r   r.  r^   r+   r   r   r   r+  r+  N  s'     6DH  r   r+  c                   x    \ rS rSrSrSS1rSSS\R                  \R                  \R                  4   4S jrS	rg
)LoopControlExtensioni[  z/Adds break and continue to the template engine.breakcontinuer[   r   r   c                     [        UR                  5      nUR                  S:X  a  [        R                  " UR
                  S9$ [        R                  " UR
                  S9$ )Nr3  rb   )r   rW   r   r   Breakr`   Continue)r   r[   r   s      r   r^   LoopControlExtension.parse`  sB    V]]#;;'!;;ell33~~U\\22r   r   N)r%   r&   r'   r(   rn   rA   ro   rv   r   r6  r7  r^   r+   r   r   r   r2  r2  [  s8    9Z D3H 3enn1L)M 3r   r2  c                   V    \ rS rSrSrS1rSSS\R                  4S jrS\	S\
4S	 jrS
rg)DebugExtensionig  a  A ``{% debug %}`` tag that dumps the available variables,
filters, and tests.

.. code-block:: html+jinja

    <pre>{% debug %}</pre>

.. code-block:: text

    {'context': {'cycler': <class 'jinja2.utils.Cycler'>,
                 ...,
                 'namespace': <class 'jinja2.utils.Namespace'>},
     'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd',
                 ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'],
     'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined',
               ..., 'odd', 'sameas', 'sequence', 'string', 'undefined', 'upper']}

.. versionadded:: 2.11.0
debugr[   r   r   c                     UR                   R                  S5      R                  n[        R                  " 5       nU R                  SU/US9n[        R                  " U/US9$ )Nz
name:debug_renderrb   )rW   r   r`   r   ContextReferencerl   r  )r   r[   r`   r/   results        r   r^   DebugExtension.parse~  sV    %%l3::((*!!)gYv!F||VHV44r   r/   c                    UR                  5       [        U R                  R                  R	                  5       5      [        U R                  R
                  R	                  5       5      S.n[        R                  " USSS9$ )N)r/   filterstests   T)depthcompact)get_allsortedrC   rB  keysrC  pprintpformat)r   r/   r?  s      r   r=  DebugExtension._render  sb    (d..66;;=>D,,22779:
 ~~fAt<<r   r   N)r%   r&   r'   r(   rn   rA   r   r  r^   r   r)   r=  r+   r   r   r   r:  r:  g  s:    ( 9D5H 5 5=w =3 =r   r:  Tastr   babel_stylec              #   z  #    U R                  [        R                  5       GH  n[        UR                  [        R
                  5      (       a  UR                  R                  U;  a  MI  / nUR                   Ho  n[        U[        R                  5      (       a<  [        UR                  [        5      (       a  UR                  UR                  5        M^  UR                  S5        Mq     UR                   H  nUR                  S5        M     UR                  b  UR                  S5        UR                  b  UR                  S5        U(       d  [        S U 5       5      nU(       d  GMM  O [!        U5      S:X  a  US   nO[        U5      nUR"                  UR                  R                  U4v   GM     g7f)aW  Extract localizable strings from the given template node.  Per
default this function returns matches in babel style that means non string
parameters as well as keyword arguments are returned as `None`.  This
allows Babel to figure out what you really meant if you are using
gettext functions that allow keyword arguments for placeholder expansion.
If you don't want that behavior set the `babel_style` parameter to `False`
which causes only strings to be returned and parameters are always stored
in tuples.  As a consequence invalid gettext calls (calls without a single
string parameter or string parameters after non-string parameters) are
skipped.

This example explains the behavior:

>>> from jinja2 import Environment
>>> env = Environment()
>>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}')
>>> list(extract_from_ast(node))
[(1, '_', 'foo'), (1, '_', ()), (1, 'ngettext', ('foo', 'bar', None))]
>>> list(extract_from_ast(node, babel_style=False))
[(1, '_', ('foo',)), (1, 'ngettext', ('foo', 'bar'))]

For every string found this function yields a ``(lineno, function,
message)`` tuple, where:

* ``lineno`` is the number of the line on which the string was found,
* ``function`` is the name of the ``gettext`` function used (if the
  string was extracted from embedded Python code), and
*   ``message`` is the string, or a tuple of strings for functions
     with multiple string arguments.

This extraction function operates on the AST and is because of that unable
to extract any comments.  For comment support you have to use the babel
extraction interface or extract comments yourself.
Nc              3   .   #    U  H  oc  M  Uv   M     g 7fr   r   ).0xs     r   	<genexpr>#extract_from_ast.<locals>.<genexpr>  s     <7a7s   	r   r   )find_allr   rk   r   r   r   rR   rf   r  r   r)   r  rg   rh   ri   tuplelenr`   )rM  r   rN  r   stringsargr6   outs           r   r   r     s8    V UZZ(499ejj11yy~~%66+-99C#u{{++
399c0J0Jsyy)t$	  ANN4  ==$NN4 ??&NN4 <7<<C  7|q ajGnkk499>>3..C )s   F9F;c                       \ rS rSrSrS\R                  \R                  \\	\	4      S\R                  \	   SS4S jr
S\S\R                  \	   4S	 jrS
\S\R                  \	   4S jrSrg)_CommentFinderi  zHelper class to find comments in a token stream.  Can only
find comments for gettext calls forwards.  Once the comment
from line 4 is found, a comment for line 1 will not return a
usable value.
tokenscomment_tagsr   Nc                 8    Xl         X l        SU l        SU l        g )Nr   )r]  r^  offsetlast_lineno)r   r]  r^  s      r   rF   _CommentFinder.__init__  s     (r   r`  c                 .    [        U R                  U R                  U 5       HK  u  p#nUS;   d  M   UR                  S S5      u  pVXPR
                  ;   d  M4  UR                  5       /s  Xl        $    / Xl        $ ! [         a     Md  f = f! Xl        f = f)N)commentlinecommentr   )reversedr]  r`  split
ValueErrorr^  rstrip)r   r`  r6   
token_typetoken_valueprefixrd  s          r   find_backwards_CommentFinder.find_backwards  s    	!.6DKK&1/*{ !;;!*5*;*;D!*D !2!22 ' 011 !K/  K & ! ! !Ks:   ,B A;B B 1B ;
B	B B		B Br`   c                 :   U R                   (       a  U R                  U:  a  / $ [        U R                  U R                  S  5       H/  u  nu  n  nX1:  d  M  U R                  U R                  U-   5      s  $    U R                  [        U R                  5      5      $ r   )r^  ra  	enumerater]  r`  rm  rW  )r   r`   idxtoken_linenor6   s        r   find_comments_CommentFinder.find_comments  s      D$4$4v$=I)24;;t{{}3M)N%C%,1$**4;;+<== *O ""3t{{#344r   )r^  ra  r`  r]  )r%   r&   r'   r(   rn   ro   r%  r'  r*   r)   rF   ry   rm  rs  r+   r   r   r   r\  r\    s{    jjc3!78HI

SV	!S !QVVC[ ! 5C 5AFF3K 5r   r\  fileobjkeywordsr^  optionsc              #     #    0 nUR                  SS5      R                  S5       H*  nUR                  5       nU(       d  M  SU[        U5      '   M,     [        U;  a	  SU[        '   SS[
        R                  [        [        4   S[        S[        S	[        4S
 jjnU" USS5      n[        UR                  S[        R                  5      UR                  S[        R                  5      UR                  S[        R                  5      UR                  S[        R                  5      UR                  S[        R                  5      UR                  S[        R                   5      UR                  S5      =(       d    [        R"                  UR                  S5      =(       d    [        R$                  U" US[        R&                  5      U" US[        R(                  5      [        R*                  U" US[        R,                  5      [/        U5      SSS9nU" US5      (       a  SUR0                  S'   U" US5      (       a  SUl        U R5                  5       R7                  UR                  SS5      5      n	 UR9                  U	5      n
[;        UR=                  UR?                  U	5      5      5      n[C        X5      n[E        X5       H  u  pnXXRG                  U5      4v   M     g! [@         a    U(       d  e  gf = f7f) a  Babel extraction method for Jinja templates.

.. versionchanged:: 2.3
   Basic support for translation comments was added.  If `comment_tags`
   is now set to a list of keywords for extraction, the extractor will
   try to find the best preceding comment that begins with one of the
   keywords.  For best results, make sure to not have more than one
   gettext call in one line of code and the matching comment in the
   same line or the line before.

.. versionchanged:: 2.5.1
   The `newstyle_gettext` flag can be set to `True` to enable newstyle
   gettext calls.

.. versionchanged:: 2.7
   A `silent` option can now be provided.  If set to `False` template
   syntax errors are propagated instead of being ignored.

:param fileobj: the file-like object the messages should be extracted from
:param keywords: a list of keywords (i.e. function names) that should be
                 recognized as translation functions
:param comment_tags: a list of translator tags to search for and include
                     in the results.
:param options: a dictionary of additional options (optional)
:return: an iterator over ``(lineno, funcname, message, comments)`` tuples.
         (comments will be empty currently)

extensions ,NFrw  r   defaultr   c                 Z    U R                  U[        U5      5      R                  5       S;   $ )N>   1onyestrue)getr)   lower)rw  r   r|  s      r   getboolbabel_extract.<locals>.getbool8  s&    {{3G-3359SSSr   silentTblock_start_stringblock_end_stringvariable_start_stringvariable_end_stringcomment_start_stringcomment_end_stringline_statement_prefixline_comment_prefixtrim_blockslstrip_blockskeep_trailing_newliner   )
cache_sizeauto_reloadr   r   r   encodingzutf-8)F)$r  rg  r  r   r   ro   Mappingr)   r   r   r   BLOCK_START_STRINGBLOCK_END_STRINGVARIABLE_START_STRINGVARIABLE_END_STRINGCOMMENT_START_STRINGCOMMENT_END_STRINGLINE_STATEMENT_PREFIXLINE_COMMENT_PREFIXTRIM_BLOCKSLSTRIP_BLOCKSNEWLINE_SEQUENCEKEEP_TRAILING_NEWLINErV  r   r   readdecoder^   listlexrU   r	   r\  r   rs  )ru  rv  r^  rw  ry  extension_namer  r  rC   rQ   r   r]  finderr`   r   r   s                   r   babel_extractr    s    J 35J!++lB7==cB'--/48
=01 C %J648
01T38, T3 T TRV T Wh-F((*E*EF&(A(AB+X-K-KL)8+G+GH*H,I,IJ((*E*EF+,N0N0N)*Jh.J.J(<(<=(*@*@A!!0(2P2PQjK$ w	""37/0w*++'+$\\^""7;;z7#CDF  (kook&<&<V&DEF F1F!1$!AgG%9%9&%AAA "B  	s*   I6L9:K) 36L)K>;L=K>>L)Ern   rJ  retypingro   
markupsafer   rz  r   r   rC   r   
exceptionsr   r	   runtimer
   r   r   utilsr   r   TYPE_CHECKINGtyping_extensionstelexerr   r   r[   r   Protocolr   r-   rv   r   r7   r'  r)   rq   compiler   r9   r   r   r#  r   r*   r   r   r   r   r+  r2  r:  r$  r%  r   r&  ru   r   r\  BinaryIOr  ry   r  i18nr,  loopcontrolsr;  r   r   r   <module>r     sp   8  	     $ . +      ??""R[[ 1  WW%79M%MN
( 17738$  
K	 j
 j
Z II uuI01IWWQUUII IAJJucz2 qzz#s(7K QZZc3(<= !**SRUXBV &QZZc
C8 QZZS=Q "
**c3S)3.
/ZZS2U$I U$p

	 
	39 	3%=Y %=T *;L/	L/zz#L/ L/ ZZGGCaggajjoqwwqzz#7K/LLMMN	L/^%5 %5PYBZZYBjjoYB **S/YB VVCJ	YB
 ZZGGS!''!**S/1771::c?C3G+HHI166RU;VYBz %#r   