+
    WBi(                     8    R t ^ RIt^ RIHt  ! R R4      tR tR# )z<utilities for generating and formatting literal Python code.N)
exceptionsc                   v   a  ] tR t^t o R tR tR tR tRR ltR t	R t
R	 tR
 tRR ltR tR tR tRtV tR# )PythonPrinterc                   ^ V n         . V n        RV n        Wn        ^V n        . V n        RV n        V P                  4        / V n        \        P                  ! R4      V n        \        P                  ! R4      V n        \        P                  ! R4      V n        \        P                  ! R4      V n        \        P                  ! R4      V n        \        P                  ! R4      V n        R	# )
    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).*\:N)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   &&//usr/lib/python3.14/site-packages/mako/pygen.py__init__PythonPrinter.__init__   s    
   #   $$$& !#H!5H-**%89JJ'JK"$**7#
 !jj)NO    c                8    V ;P                   V,          un         R # N)r   r   nums   &&r   _update_linenoPythonPrinter._update_lineno7   s    sr   c                p    V P                   V P                  9  d   WP                  V P                   &   R # R # r   )r   r   )r   r   s   &&r   start_sourcePythonPrinter.start_source:   s'    ;;doo-+1OODKK( .r   c                l    V P                   P                  R V,          4       V P                  V4       R# )
N)r
   writer!   r   s   &&r   write_blanksPythonPrinter.write_blanks>   s&    $*%C r   Nc                    RV n         \        \        P                  ! RV4      4       FL  w  r4V P                  P                  V4       Ve   V P                  W#,           4       V P                  ^4       KN  	  R# )zprint 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?\nN)r   	enumerater   splitr   appendr$   r!   )r   blockstarting_linenoils   &&&  r   write_indented_block"PythonPrinter.write_indented_blockB   sa    
  %bhhx78DA##A&*!!/"56"	 9r   c                :    V F  pV P                  V4       K  	  R# )z"print a series of lines of python.N)	writeline)r   lineslines   &* r   
writelinesPythonPrinter.writelinesN   s    DNN4  r   c                   V P                   '       g   V P                  4        RV n         VeC   V P                  P                  V4      '       g"   V P                  P                  V4      '       d   RpMRpT;'       d     \        V4      ;'       d    V^ ,          R8H  pV'       g   V'       d   V P                  V4      '       du   V P                  ^ 8  dd   V ;P                  ^,          un        \        V P                  4      ^ 8X  d   \        P                  ! R4      hV P                  P                  4        Vf   R# V P                  P                  V P                  V4      R,           4       V P                  \        VP!                  R4      4      4       V P"                  P%                  V4      '       d   V P&                  P                  V4      pV'       dH   VP)                  ^4      pV ;P                  ^,          un        V P                  P+                  V4       R# RpV P,                  P                  V4      pV'       d7   V ;P                  ^,          un        V P                  P+                  V4       R# R# R# )zprint 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.

TNF#zToo many whitespace closuresr'   )r   _flush_adjusted_linesr   matchr   len_is_unindentorr   r   r   MakoExceptionpopr
   r(   _indent_liner!   r.   r   searchr   groupr/   r   )r   r9   hastext
is_commentr?   indentorm2s   &&     r   r7   PythonPrinter.writelineS   s    ###&&(#'D  L%%++D11~~##D))GG::c$i::DGsN
  3 3D 9 9aKK1K 4%%&!+ ../MNN""$< 	$++D1D89C

4 012 ??!!$''
 %%++D1E ;;q>q ""))(3 ,,2248KK1$K&&--h7 # (r   c                &    V P                  4        R# )z1close this printer, flushing any remaining lines.N)r>   r   s   &r   closePythonPrinter.close   s    ""$r   c                    \        V P                  4      ^ 8X  d   R# V P                  R,          pVf   R# V P                  P                  V4      p\	        V4      # )zareturn true if the given line is an 'unindentor',
relative to the last 'indent' event received.

F)r@   r   r   r?   bool)r   r9   rI   r?   s   &&  r   rA   PythonPrinter._is_unindentor   sY     t!!"a'%%b)  ##))$/ E{r   c                    VR8X  d%   V P                   V P                  ,          V,           # \        P                  ! RV,          V P                   V P                  ,          V4      # )zindent 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   r9   
stripspaces   &&&r   rD   PythonPrinter._indent_line   sR    
 $$t{{2T99vvZ!2!2T[[!@$
 	
r   c                $    RRuV n         V n        R# )zVreset the flags which would indicate we are in a backslashed
or triple-quoted section.FN)backslashedtriplequotedrM   s   &r   r   %PythonPrinter._reset_multi_line_flags   s     /4U+$+r   c                &   V P                   ;'       g    V P                  p\        \        P                  ! RV4      4      V n         \        \        P                  ! RV4      4      pV^8X  g   V^,          ^ 8w  d   V P                  '       * V n        V# )z[return true if the given line is part of a multi-line block,
via backslash or triple-quote.\\$\"\"\"|\'\'\')r[   r\   rR   r   rE   r@   findall)r   r9   current_statetripless   &&  r   _in_multi_linePythonPrinter._in_multi_line   st     ((==D,=,=		&$ 78bjj!1489a<7Q;!+$($5$5 5Dr   c                   R pV P                  4        V P                   F  pV P                  V4      '       d%   V P                  P	                  VR,           4       K>  VP                  4       pVfD   \        P                  ! RV4      '       d'   \        P                  ! RV4      P                  ^4      pV P                  P	                  V P                  W!4      R,           4       K  	  . V n        V P                  4        R # )Nr'   ^[ \t]*[^# \t]	^([ \t]*))r   r   rd   r
   r(   
expandtabsr   rE   r?   rF   rD   )r   rX   entrys   &  r   r>   #PythonPrinter._flush_adjusted_lines   s    
$$&%%E""5))!!%$,/((*%"))4Eu*M*M!#,!>!D!DQ!GJ!!$"3"3E"F"MN & $$&r   )r   r   r   r   r   r   r[   r   r   r   r	   r   r   r   r
   r\   r   rU   )__name__
__module____qualname____firstlineno__r   r!   r$   r)   r4   r:   r7   rN   rA   rD   r   rd   r>   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sP     &PP2!
#!
E8N%P
;&' 'r   r   c                  aaa RR.o^ ^uooVVV3R lpR	R lp. pRp\         P                  ! RV 4       F  pV! V4      '       d   VP                  V4       K$  VP                  4       pVfD   \         P                  ! RV4      '       d'   \         P
                  ! RV4      P                  ^4      pVP                  V! WT4      4       K  	  RP                  V4      # )
z<remove the left-whitespace margin of a block of Python code.Fc                   < SS,          ;'       g
    SS,          p\         P                  ! R V 4      '       d   RSS&   MRSS&   R pV '       d   SS,          '       dD   V! RSS,          ,          V 4      w  r0V'       d   RSS&   K?  V! RSS,          ,          V 4      w  r0KZ  V! RV 4      w  r0V'       d   V# V! RV 4      w  r0V'       d   VP                  ^ 4      SS&   K  V! RV 4      w  r0K  V# )	r_   TFc                     \         P                  ! W4      pV'       d   W!\        VP                  ^ 4      4      R 3# RV3# )r   N)r   r?   r@   rF   )regtms   && r   r?   7adjust_whitespace.<locals>.in_multi_line.<locals>.match  s9     AC
O-...Qwr   z%sz.*?(?=%s|$)r=   r`   z.*?(?=\"\"\"|\'\'\'|#|$))r   rE   rF   )r9   start_stater?   ry   r[   stater\   s   &   r   in_multi_line(adjust_whitespace.<locals>.in_multi_line  s    K(??E,,?99VT""!%E+!&E+	 \""l(; ;TB*/E,'#NU<5H$H$OGAtd+&& 0$7*+''!*E,' ;TB4r   c                 @    \         P                  ! R V,          RV 4      # )rV   rU   )r   rW   )r9   rX   s   &&r   rD   'adjust_whitespace.<locals>._indent_line'  s    vvfz)2t44r   Nr,   rg   rh   r'   rl   )r   r.   r/   ri   rE   r?   rF   join)	textr}   rD   r8   rX   r9   r[   r|   r\   s	   &     @@@r   adjust_whitespacer      s     ENE#$a[,"H5 EJ4(LL??$D!bii0A4&H&HXXlD9??B
LLd78 ) 99Ur   )__doc__r   makor   r   r    r   r   <module>r      s#    C 	 l' l'^8r   