Ë
    V.j°(  ã                   ó6   — d Z ddlZddlmZ  G d„ d«      Zd„ Zy)z<utilities for generating and formatting literal Python code.é    N)Ú
exceptionsc                   ó^   — e Zd Zd„ Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Z	d	„ Z
d
„ Zdd„Zd„ Zd„ Zd„ Zy)ÚPythonPrinterc                 óÌ  — d| _         g | _        d| _        || _        d| _        g | _        d| _        | j                  «        i | _        t        j                  d«      | _        t        j                  d«      | _        t        j                  d«      | _        t        j                  d«      | _        t        j                  d	«      | _        t        j                  d
«      | _        y )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     úLC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\mako/pygen.pyÚ__init__zPythonPrinter.__init__   sÂ   € àˆŒð
  ˆÔð #ˆÔð ˆŒð ˆŒð ˆÔà$ˆÔà×$Ñ$Ô&ð ˆŒä!#§¡¨HÓ!5ˆÔÜŸ™ HÓ-ˆŒÜŸ*™*Ð%8Ó9ˆŒÜŸJ™JÐ'JÓKˆÔÜ"$§*¡*Ø7ó#
ˆÔô !Ÿj™jÐ)NÓOˆÕó    c                 ó.   — | xj                   |z  c_         y ©N)r   ©r   Únums     r   Ú_update_linenozPythonPrinter._update_lineno7   s   € Ø�Š�sÑŽr   c                 óh   — | j                   | j                  vr|| j                  | j                   <   y y r   )r   r   )r   r   s     r   Ústart_sourcezPythonPrinter.start_source:   s)   € Ø�;‰;˜dŸo™oÑ-Ø+1ˆD�O‰O˜DŸK™KÒ(ð .r   c                 ób   — | j                   j                  d|z  «       | j                  |«       y )NÚ
)r   Úwriter!   r   s     r   Úwrite_blankszPythonPrinter.write_blanks>   s&   € Ø�‰×Ñ˜$ ™*Ô%Ø×Ñ˜CÕ r   Nc                 óä   — d| _         t        t        j                  d|«      «      D ]G  \  }}| j                  j                  |«       |�| j                  ||z   «       | j                  d«       ŒI y)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_blockz"PythonPrinter.write_indented_blockB   se   € ð
  %ˆÔÜœbŸh™h x°Ó7Ö8‰DˆAˆqØ×Ñ×#Ñ# AÔ&ØÐ*Ø×!Ñ! /°AÑ"5Ô6Ø×Ñ Õ"ñ	 9r   c                 ó4   — |D ]  }| j                  |«       Œ y)z"print a series of lines of python.N)Ú	writeline)r   ÚlinesÚlines      r   Ú
writelineszPythonPrinter.writelinesN   s   € ãˆDØ�N‰N˜4Õ ñ r   c                 ó>  — | j                   s| j                  «        d| _         |�6| j                  j                  |«      s| j                  j                  |«      rd}nd}|xr t        |«      xr |d   dk(  }|s~|r| j                  |«      rk| j                  dkD  r\| xj                  dz  c_        t        | j                  «      dk(  rt        j                  d«      ‚| j                  j                  «        |€y| j                  j                  | j                  |«      dz   «       | j                  t        |j!                  d«      «      «       | j"                  j%                  |«      r°| j&                  j                  |«      }|rB|j)                  d«      }| xj                  dz  c_        | j                  j+                  |«       yd}| j,                  j                  |«      }|r1| xj                  dz  c_        | j                  j+                  |«       yyy)	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!   r+   r   Úsearchr   Úgroupr,   r   )r   r5   ÚhastextÚ
is_commentr:   ÚindentorÚm2s          r   r3   zPythonPrinter.writelineS   sÌ  € ð ×#Ò#Ø×&Ñ&Ô(Ø#'ˆDÔ ð ˆLØ×%Ñ%×+Ñ+¨DÔ1Ø�~‰~×#Ñ# DÔ)à‰GàˆGàÒ:œc $›iÒ:¨D°©G°s©Nˆ
ñ Ù × 3Ñ 3°DÔ 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                 ó$   — | j                  «        y)z1close this printer, flushing any remaining lines.N)r9   ©r   s    r   ÚclosezPythonPrinter.closeš   s   € à×"Ñ"Õ$r   c                 ó¤   — t        | j                  «      dk(  ry| j                  d   }|€y| j                  j                  |«      }t	        |«      S )zqreturn true if the given line is an 'unindentor',
        relative to the last 'indent' event received.

        r   Féÿÿÿÿ)r;   r	   r   r:   Úbool)r   r5   rD   r:   s       r   r<   zPythonPrinter._is_unindentorž   sY   € ô ˆt×!Ñ!Ó" aÒ'Øà×%Ñ% bÑ)ˆð ÐØð ×#Ñ#×)Ñ)¨$Ó/ˆô �E‹{Ðr   c                 ó¦   — |dk(  r| j                   | j                  z  |z   S t        j                  d|z  | j                   | j                  z  |«      S )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   r5   Ú
stripspaces      r   r?   zPythonPrinter._indent_lineÆ   sR   € ð
 ˜Òà×$Ñ$ t§{¡{Ñ2°TÑ9Ð9ä�v‰vØ�ZÑ ×!2Ñ!2°T·[±[Ñ!@À$ó
ð 	
r   c                 ó"   — d\  | _         | _        y)z^reset the flags which would indicate we are in a backslashed
        or triple-quoted section.)FFN)ÚbackslashedÚtriplequotedrG   s    r   r   z%PythonPrinter._reset_multi_line_flagsÓ   s   € ð /;Ñ+ˆÔ˜$Õ+r   c                 óþ   — | j                   xs | j                  }t        t        j                  d|«      «      | _         t        t        j                  d|«      «      }|dk(  s|dz  dk7  r| j                   | _        |S )zcreturn true if the given line is part of a multi-line block,
        via backslash or triple-quote.ú\\$ú\"\"\"|\'\'\'r   é   r   )rR   rS   rK   r   r@   r;   Úfindall)r   r5   Úcurrent_stateÚtripless       r   Ú_in_multi_linezPythonPrinter._in_multi_lineÙ   sq   € ð ×(Ñ(Ò=¨D×,=Ñ,=ˆä¤§	¡	¨&°$Ó 7Ó8ˆÔÜ”b—j‘jÐ!1°4Ó8Ó9ˆØ�aŠ<˜7 Q™;¨!Ò+Ø$(×$5Ñ$5Ð 5ˆDÔàÐr   c                 óÎ  — d }| j                  «        | j                  D ]­  }| j                  |«      r| j                  j	                  |dz   «       Œ3|j                  «       }|€;t        j                  d|«      r%t        j                  d|«      j                  d«      }| j                  j	                  | j                  ||«      dz   «       Œ¯ g | _        | j                  «        y )Nr%   ú^[ \t]*[^# \t]ú	^([ \t]*)r   )r   r   r[   r   r&   Ú
expandtabsr   r@   r:   rA   r?   )r   rP   Úentrys      r   r9   z#PythonPrinter._flush_adjusted_linesì   s¾   € Øˆ
Ø×$Ñ$Ô&à×%Ô%ˆEØ×"Ñ" 5Ô)Ø—‘×!Ñ! %¨$¡,Õ/à×(Ñ(Ó*�ØÐ%¬"¯)©)Ð4EÀuÔ*MÜ!#§¡¨,¸Ó!>×!DÑ!DÀQÓ!G�JØ—‘×!Ñ! $×"3Ñ"3°E¸:Ó"FÈÑ"MÕNð &ð ˆÔØ×$Ñ$Õ&r   r   ©rM   )Ú__name__Ú
__module__Ú__qualname__r   r!   r#   r'   r1   r6   r3   rH   r<   r?   r   r[   r9   © r   r   r   r      sH   „ ò&PòPò2ò!ó
#ò!ò
E8òN%òóP
ò;òó&'r   r   c                 óŽ  ‡‡‡— ddgŠd\  ŠŠˆˆˆfd„}dd„}g }d}t        j                  d| «      D ]�  } ||«      r|j                  |«       Œ|j                  «       }|€;t        j                  d|«      r%t        j
                  d|«      j                  d	«      }|j                   |||«      «       Œƒ d
j                  |«      S )z<remove the left-whitespace margin of a block of Python code.F)r   r   c                 óT  •— ‰‰   xs ‰‰   }t        j                  d| «      rd‰‰<   nd‰‰<   d„ }| rt‰‰   r- |d‰‰   z  | «      \  }} |rd‰‰<   nR |d‰‰   z  | «      \  }} n? |d| «      \  }} |r|S  |d| «      \  }} |r|j                  d	«      ‰‰<   Œg |d
| «      \  }} | rŒt|S )NrU   TFc                 óx   — t        j                  | |«      }|r||t        |j                  d«      «      d  fS d |fS )Nr   )r   r:   r;   rA   )ÚregÚtÚms      r   r:   z7adjust_whitespace.<locals>.in_multi_line.<locals>.match  s=   € Ü—‘˜˜aÓ ˆAÙØ˜!œC §¡¨£
›OÐ-Ð.Ð.Ð.à˜Q�w�r   z%sz.*?(?=%s|$)r8   rV   r   z.*?(?=\"\"\"|\'\'\'|#|$))r   r@   rA   )r5   Ústart_stater:   rk   rR   ÚstaterS   s       €€€r   Úin_multi_linez(adjust_whitespace.<locals>.in_multi_line  sì   ø€ Ø˜KÑ(Ò?¨E°,Ñ,?ˆä�9‰9�V˜TÔ"Ø!%ˆE�+Òà!&ˆE�+Ñò	ñ Ø�\Ò"Ù ¨¨lÑ(;Ñ ;¸TÓB‘��4ÙØ*/�E˜,Ò'á# N°U¸<Ñ5HÑ$HÈ$ÓO‘G�A‘tá  dÓ+‘��4ÙØ&Ð&áÐ 0°$Ó7‘��4ÙØ*+¯'©'°!«*�E˜,Ñ'ØáÐ ;¸TÓB‘��4ò# ð& Ðr   c                 ó6   — t        j                  d|z  d| «      S )NrN   rM   )r   rO   )r5   rP   s     r   r?   z'adjust_whitespace.<locals>._indent_line'  s   € Ü�v‰v�f˜zÑ)¨2¨tÓ4Ð4r   Nr)   r]   r^   r   r%   ra   )r   r+   r,   r_   r@   r:   rA   Újoin)	Útextrn   r?   r4   rP   r5   rR   rm   rS   s	         @@@r   Úadjust_whitespacerr   ý   s·   ú€ ð �EˆN€EØ"(Ñ€[�,ö"óH5ð €EØ€Jä—‘˜ 4Ö(ˆÙ˜ÔØ�L‰L˜Õà—?‘?Ó$ˆDØÐ!¤b§i¡iÐ0AÀ4Ô&HÜŸX™X l°DÓ9×?Ñ?ÀÓB�
Ø�L‰L™ d¨JÓ7Õ8ð )ð �9‰9�UÓÐr   )Ú__doc__r   Úmakor   r   rr   re   r   r   Ú<module>ru      s#   ðñ Cã 	å ÷l'ñ l'ó^8r   