ó
    ùÞ j®(  ã                   ó6   • S r SSKrSSKJr   " S S5      rS rg)z<utilities for generating and formatting literal Python code.é    N)Ú
exceptionsc                   ój   • \ rS rSrS rS rS rS rSS jrS r	S	 r
S
 rS rSS jrS rS rS rSrg)ÚPythonPrinteré   c                 óÖ  • SU l         / U l        SU l        Xl        SU l        / U l        SU l        U R                  5         0 U l        [        R                  " S5      U l        [        R                  " S5      U l        [        R                  " S5      U l        [        R                  " S5      U l        [        R                  " S	5      U l        [        R                  " S
5      U l        g )Nr   z    é   Fz^\s*#z^\s*$z:[ \t]*(?:#.*)?$z ^\s*(if|try|elif|while|for|with)z(^\s*(def|class|else|elif|except|finally)z"^\s*(else|elif|except|finally).*\:)ÚindentÚindent_detailÚindentstringÚstreamÚlinenoÚline_bufferÚin_indent_linesÚ_reset_multi_line_flagsÚ
source_mapÚreÚcompileÚ_re_space_commentÚ	_re_spaceÚ
_re_indentÚ_re_compoundÚ_re_indent_keywordÚ_re_unindentor)Úselfr   s     ÚD/var/www/html/gaurav/venv/lib/python3.13/site-packages/mako/pygen.pyÚ__init__ÚPythonPrinter.__init__   sÀ   € àˆŒð
  ˆÔð #ˆÔð Œð ˆŒð ˆÔà$ˆÔà×$Ñ$Ô&ð ˆŒä!#§¢¨HÓ!5ˆÔÜŸš HÓ-ˆŒÜŸ*š*Ð%8Ó9ˆŒÜŸJšJÐ'JÓKˆÔÜ"$§*¢*Ø7ó#
ˆÔô !ŸjšjÐ)NÓOˆÕó    c                 ó.   • U =R                   U-  sl         g ©N)r   ©r   Únums     r   Ú_update_linenoÚPythonPrinter._update_lineno7   s   € Ø�Š�sÑŽr   c                 ój   • U R                   U R                  ;  a  XR                  U R                   '   g g r    )r   r   )r   r   s     r   Ústart_sourceÚPythonPrinter.start_source:   s'   € Ø�;‰;˜dŸo™oÓ-Ø+1�O‰O˜DŸK™KÒ(ð .r   c                 ób   • U R                   R                  SU-  5        U R                  U5        g )NÚ
)r   Úwriter#   r!   s     r   Úwrite_blanksÚPythonPrinter.write_blanks>   s&   € Ø�‰×Ñ˜$ ™*Ô%Ø×Ñ˜CÕ r   Nc                 óè   • SU l         [        [        R                  " SU5      5       HG  u  p4U R                  R                  U5        Ub  U R                  X#-   5        U R                  S5        MI     g)z¥print a line or lines of python which already contain indentation.

The indentation of the total block of lines will be adjusted to that of
the current indent level.Fú\r?\nNr   )r   Ú	enumerater   Úsplitr   Úappendr&   r#   )r   ÚblockÚstarting_linenoÚiÚls        r   Úwrite_indented_blockÚ"PythonPrinter.write_indented_blockB   sa   € ð
  %ˆÔÜœbŸhšh x°Ó7Ö8‰DˆAØ×Ñ×#Ñ# AÔ&ØÑ*Ø×!Ñ! /Ñ"5Ô6Ø×Ñ Ö"ò	 9r   c                 ó8   • U H  nU R                  U5        M     g)z"print a series of lines of python.N)Ú	writeline)r   ÚlinesÚlines      r   Ú
writelinesÚPythonPrinter.writelinesN   s   € ãˆDØ�N‰N˜4Ö ò r   c                 ó¶  • U R                   (       d  U R                  5         SU l         Ub@  U R                  R                  U5      (       d   U R                  R                  U5      (       a  SnOSnU=(       a    [        U5      =(       a    US   S:H  nU(       d‹  U(       a  U R                  U5      (       an  U R                  S:”  a^  U =R                  S-  sl        [        U R                  5      S:X  a  [        R                  " S5      eU R                  R                  5         Uc  gU R                  R                  U R                  U5      S-   5        U R                  [        UR!                  S5      5      5        U R"                  R%                  U5      (       aº  U R&                  R                  U5      nU(       aB  UR)                  S5      nU =R                  S-  sl        U R                  R+                  U5        gSnU R,                  R                  U5      nU(       a1  U =R                  S-  sl        U R                  R+                  U5        ggg)	zžprint a line of python, indenting it according to the current
indent level.

this also adjusts the indentation counter according to the
content of the line.

TNFr   Ú#r   zToo many whitespace closuresr)   )r   Ú_flush_adjusted_linesr   Úmatchr   ÚlenÚ_is_unindentorr	   r
   r   ÚMakoExceptionÚpopr   r*   Ú_indent_liner#   r0   r   Úsearchr   Úgroupr1   r   )r   r;   ÚhastextÚ
is_commentrA   ÚindentorÚm2s          r   r9   ÚPythonPrinter.writelineS   sØ  € ð ×#×#Ø×&Ñ&Ô(Ø#'ˆDÔ ð ‰LØ×%Ñ%×+Ñ+¨D×1Ñ1Ø�~‰~×#Ñ# D×)Ñ)à‰GàˆGà×:œc $›i×:¨D°©G°s©Nˆ
ö Þ × 3Ñ 3°D× 9Ñ 9Ø—‘˜a“à�KŠK˜1Ñ�Kô �4×%Ñ%Ó&¨!Ó+ä ×.Ò.Ð/MÓNÐNØ×Ñ×"Ñ"Ô$à‰<Øð 	�‰×Ñ˜$×+Ñ+¨DÓ1°DÑ8Ô9Ø×ÑœC §
¡
¨4Ó 0Ó1Ô2ð �?‰?×!Ñ! $×'Ñ'ð
 ×%Ñ%×+Ñ+¨DÓ1ˆEÞà Ÿ;™; q›>�Ø—’˜qÑ •Ø×"Ñ"×)Ñ)¨(Õ3à�ð ×,Ñ,×2Ñ2°4Ó8�ÞØ—K’K 1Ñ$•KØ×&Ñ&×-Ñ-¨hÕ7ð ð# (r   c                 ó$   • U R                  5         g)z1close this printer, flushing any remaining lines.N)r@   ©r   s    r   ÚcloseÚPythonPrinter.closeš   s   € à×"Ñ"Õ$r   c                 ó¨   • [        U R                  5      S:X  a  gU R                  S   nUc  gU R                  R                  U5      n[	        U5      $ )zareturn true if the given line is an 'unindentor',
relative to the last 'indent' event received.

r   Féÿÿÿÿ)rB   r
   r   rA   Úbool)r   r;   rK   rA   s       r   rC   ÚPythonPrinter._is_unindentorž   sY   € ô ˆt×!Ñ!Ó" aÓ'Øà×%Ñ% bÑ)ˆð ÑØð ×#Ñ#×)Ñ)¨$Ó/ˆô �E‹{Ðr   c                 óª   • US:X  a  U R                   U R                  -  U-   $ [        R                  " SU-  U R                   U R                  -  U5      $ )z¡indent the given line according to the current indent level.

stripspace is a string of space that will be truncated from the
start of the line before indenting.Ú ú^%s)r   r	   r   Úsub)r   r;   Ú
stripspaces      r   rF   ÚPythonPrinter._indent_lineÆ   sR   € ð
 ˜Óà×$Ñ$ t§{¡{Ñ2°TÑ9Ð9ä�vŠvØ�ZÑ ×!2Ñ!2°T·[±[Ñ!@À$ó
ð 	
r   c                 ó"   • Su  U l         U l        g)zVreset the flags which would indicate we are in a backslashed
or triple-quoted section.)FFN)ÚbackslashedÚtriplequotedrO   s    r   r   Ú%PythonPrinter._reset_multi_line_flagsÓ   s   € ð /;Ñ+ˆÔ˜$Õ+r   c                 ó  • U R                   =(       d    U R                  n[        [        R                  " SU5      5      U l         [        [        R                  " SU5      5      nUS:X  d	  US-  S:w  a  U R                  (       + U l        U$ )z[return true if the given line is part of a multi-line block,
via backslash or triple-quote.ú\\$ú\"\"\"|\'\'\'r   é   r   )r]   r^   rT   r   rG   rB   Úfindall)r   r;   Úcurrent_stateÚtripless       r   Ú_in_multi_lineÚPythonPrinter._in_multi_lineÙ   sq   € ð ×(Ñ(×=¨D×,=Ñ,=ˆä¤§	¢	¨&°$Ó 7Ó8ˆÔÜ”b—j’jÐ!1°4Ó8Ó9ˆØ�a‹<˜7 Q™;¨!Ó+Ø$(×$5Ñ$5Ô 5ˆDÔàÐr   c                 óì  • S nU R                  5         U R                   H»  nU R                  U5      (       a   U R                  R	                  US-   5        M9  UR                  5       nUcB  [        R                  " SU5      (       a&  [        R                  " SU5      R                  S5      nU R                  R	                  U R                  X!5      S-   5        M½     / U l        U R                  5         g )Nr)   ú^[ \t]*[^# \t]ú	^([ \t]*)r   )r   r   rg   r   r*   Ú
expandtabsr   rG   rA   rH   rF   )r   rZ   Úentrys      r   r@   Ú#PythonPrinter._flush_adjusted_linesì   sÂ   € Øˆ
Ø×$Ñ$Ô&à×%Ô%ˆEØ×"Ñ" 5×)Ñ)Ø—‘×!Ñ! %¨$¡,Ö/à×(Ñ(Ó*�ØÑ%¬"¯)ª)Ð4EÀu×*MÑ*MÜ!#§¢¨,¸Ó!>×!DÑ!DÀQÓ!G�JØ—‘×!Ñ! $×"3Ñ"3°EÓ"FÈÑ"MÖNñ &ð ˆÔØ×$Ñ$Õ&r   )r   r   r   r   r   r   r]   r   r	   r
   r   r   r   r   r   r^   r    ©rW   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r#   r&   r+   r6   r<   r9   rP   rC   rF   r   rg   r@   Ú__static_attributes__© r   r   r   r      sH   † ò&PòPò2ò!ô
#ò!ò
E8òN%òôP
ò;òõ&'r   r   c                 ó²  ^^^• SS/mSu  mmUUU4S jnSS jn/ nSn[         R                  " SU 5       H�  nU" U5      (       a  UR                  U5        M#  UR                  5       nUcB  [         R                  " SU5      (       a&  [         R
                  " SU5      R                  S	5      nUR                  U" XT5      5        M‘     S
R                  U5      $ )z<remove the left-whitespace margin of a block of Python code.F)r   r   c                 ó   >• TT   =(       d    TT   n[         R                  " SU 5      (       a  STT'   OSTT'   S nU (       aŠ  TT   (       a0  U" STT   -  U 5      u  p0U(       a  STT'   OYU" STT   -  U 5      u  p0OGU" SU 5      u  p0U(       a  U$ U" SU 5      u  p0U(       a  UR                  S	5      TT'   M}  U" S
U 5      u  p0U (       a  MŠ  U$ )Nra   TFc                 ó€   • [         R                  " X5      nU(       a  X![        UR                  S5      5      S  4$ S U4$ )Nr   )r   rA   rB   rH   )ÚregÚtÚms      r   rA   Ú7adjust_whitespace.<locals>.in_multi_line.<locals>.match  s9   € Ü—’˜Ó ˆAÞØœC §¡¨£
›OÐ-Ð.Ð.Ð.à˜Q�w�r   z%sz.*?(?=%s|$)r?   rb   r   z.*?(?=\"\"\"|\'\'\'|#|$))r   rG   rH   )r;   Ústart_staterA   r{   r]   Ústater^   s       €€€r   Úin_multi_lineÚ(adjust_whitespace.<locals>.in_multi_line  sé   ø€ Ø˜KÑ(×?¨E°,Ñ,?ˆä�9Š9�V˜T×"Ñ"Ø!%ˆE�+Òà!&ˆE�+Ñò	ö Ø�\×"Ù ¨¨lÑ(;Ñ ;¸TÓB‘�ÞØ*/�E˜,Ò'á# N°U¸<Ñ5HÑ$HÈ$ÓO‘G�A�tá  dÓ+‘�ÞØ&Ð&áÐ 0°$Ó7‘�ÞØ*+¯'©'°!«*�E˜,Ñ'ÙáÐ ;¸TÓB‘�÷# ˆdð& Ðr   c                 ó8   • [         R                  " SU-  SU 5      $ )NrX   rW   )r   rY   )r;   rZ   s     r   rF   Ú'adjust_whitespace.<locals>._indent_line'  s   € Ü�vŠv�f˜zÑ)¨2¨tÓ4Ð4r   Nr.   rj   rk   r   r)   ro   )r   r0   r1   rl   rG   rA   rH   Újoin)	Útextr   rF   r:   rZ   r;   r]   r~   r^   s	         @@@r   Úadjust_whitespacer…   ý   s»   ú€ ð �EˆN€EØ &Ñ€K�÷"ôH5ð €EØ€Jä—’˜ 4Ö(ˆÙ˜×ÑØ�L‰L˜Öà—?‘?Ó$ˆDØÑ!¤b§i¢iÐ0AÀ4×&HÑ&HÜŸXšX l°DÓ9×?Ñ?ÀÓB�
Ø�L‰L™ dÓ7Ö8ñ )ð �9‰9�UÓÐr   )Ú__doc__r   Úmakor   r   r…   ru   r   r   Ú<module>rˆ      s#   ðñ Cã 	å ÷l'ñ l'ó^8r   