
    g                         S r SSKrSSKJr  SSKJr   " S S5      r " S S5      r " S	 S
\5      r " S S5      r " S S\5      r	g)zjutilities for analyzing expressions and blocks of Python
code, as well as generating Python from AST nodes    N)
exceptions)pyparserc                       \ rS rSrSrS rSrg)
PythonCode   z<represents information about a string containing Python codec                    Xl         [        5       U l        [        5       U l        [	        U[
        5      (       a'  [        R                  " UR                  5       S40 UD6nOUn[        R                  " U 40 UD6nUR                  U5        g )Nexec)codesetdeclared_identifiersundeclared_identifiers
isinstancestrr   parselstripFindIdentifiersvisitselfr
   exception_kwargsexprfs        P/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/mako/ast.py__init__PythonCode.__init__   sp    	 %(E! '*e# dC  >>$++-L;KLDD$$T>-=>	    )r
   r   r   N__name__
__module____qualname____firstlineno____doc__r   __static_attributes__ r   r   r   r      s
    Fr   r   c                       \ rS rSrSrS rSrg)ArgumentList2   zBparses a fragment of code as a comma-separated list of expressionsc                    / U l         / U l        [        5       U l        [        5       U l        [        U[        5      (       aV  [        R                  " SU5      (       a!  [        R                  " SU5      (       d  US-  n[        R                  " US40 UD6nOUn[        R                  " U [        40 UD6nUR                  U5        g )Nz\Sz,\s*$,r	   )codeargsargsr   r   r   r   r   rematchr   r   	FindTupler   r   r   s        r   r   ArgumentList.__init__6   s    	$'E!&)e#dC  xxt$$RXXh-E-E >>$C2BCDDtZD3CD	r   )r+   r*   r   r   Nr   r$   r   r   r&   r&   2   s
    Lr   r&   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )PythonFragmentH   zextends PythonCode to provide identifier lookups in partial control
statements

e.g.::

    for x in 5:
    elif y==9:
    except (MyException, e):

c                   > [         R                  " SUR                  5       [         R                  5      nU(       d  [        R
                  " SU-  40 UD6eUR                  S5      (       a  US UR                  S5       nUR                  SS5      u  pEUS;   a  US-   nOPUS:X  a  US	-   nODUS
;   a	  SU-   S-   nO5US:X  a	  SU-   S-   nO&US:X  a  US-   nO[        R
                  " SU-  40 UD6e[        TU ]$  " U40 UD6  g )Nz^(\w+)(?:\s+(.*?))?:\s*(#|$)z0Fragment '%s' is not a partial control statement         )forifwhilepasstryzpass
except:pass)elifelsezif False:pass
exceptz	try:pass
withz!Unsupported control keyword: '%s')
r,   r-   stripSr   CompileExceptiongroupstartsuperr   )r   r
   r   mkeywordr   	__class__s         r   r   PythonFragment.__init__U   s   HH4djjlBDDI--BTI"  771::!''!*%D''!Q-,,&=D--D(($t+f4D $&/D&=D--3g="  	2!12r   r$   r   r   r    r!   r"   r   r#   __classcell__rH   s   @r   r1   r1   H   s    	3 3r   r1   c                   <    \ rS rSrSrSS jrS	S jr\S 5       rSr	g)
FunctionDeclq   zfunction declarationc                 f   Xl         [        R                  " US40 UD6n[        R                  " U 40 UD6nUR	                  U5        [        U S5      (       d  [        R                  " SU-  40 UD6eU(       d9  U R                  (       a'  [        R                  " SU R                  S   -  40 UD6eg g )Nr	   funcnamez'Code '%s' is not a function declarationz('**%s' keyword argument not allowed here)
r
   r   r   	ParseFuncr   hasattrr   rB   kwargs
kwargnames)r   r
   allow_kwargsr   r   r   s         r   r   FunctionDecl.__init__u   s    	~~dF?.>?t8'78	tZ((--9D@"  --://"%& #  !,|r   c                    / nU R                   SSS2   nU R                  SSS2   nU R                  SSS2   nU R                  SSS2   nU R                  (       a#  UR                  SUR                  S5      -   5        U H  nU(       a  UR                  U< SU< 35        M$  U(       ac  UR                  S5      nUc  UR                  U5        MR  UR                  U< S[        R                  " U5      R                  5       < 35        M  UR                  U5        M     U R                  (       a#  UR                  SUR                  S5      -   5        U Ho  nU(       d  U(       d  UR                  U5        M$  UR                  S5      nUR                  U< S[        R                  " U5      R                  5       < 35        Mq     UR                  5         U$ )a  Return the argument declarations of this FunctionDecl as a printable
list.

By default the return value is appropriate for writing in a ``def``;
set `as_call` to true to build arguments to be passed to the function
instead (assuming locals with the same names as the arguments exist).
NrR   z**r   =*)argnamesrV   defaults
kwdefaultsrU   appendpopr   ExpressionGeneratorvaluevarargsreverse)	r   as_call	namedeclsr\   rV   r]   r^   namedefaults	            r   get_argument_expressions%FunctionDecl.get_argument_expressions   s    	 ==2&__TrT*
==2&__TrT*
 ;;TJNN1$556D   D$!78$..+? $$T*$$!=!=g!F!L!L!NP
   &# ( <<S8<<?23Dh  &",,q/  X99'BHHJL  	r   c                 X    [        U R                  5      [        U R                  5      -   $ )N)tupler\   rV   )r   s    r   allargnamesFunctionDecl.allargnames   s    T]]#eDOO&<<<r   )r
   N)T)F)
r   r   r    r!   r"   r   ri   propertyrm   r#   r$   r   r   rN   rN   q   s$    $7r = =r   rN   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )FunctionArgs   z.the argument portion of a function declarationc                 .   > [         TU ]  " SU-  40 UD6  g )Nzdef ANON(%s):pass)rE   r   )r   r
   rU   rH   s      r   r   FunctionArgs.__init__   s    ,t3>v>r   r$   rJ   rL   s   @r   rq   rq      s    8? ?r   rq   )
r"   r,   makor   r   r   r&   r1   rN   rq   r$   r   r   <module>rv      sP   5 
   D ,&3Z &3RQ= Q=h?< ?r   