
     Tij                    `    S r SSKJr  SSKrSSKrSSKrSSKJr  S	S jrS
S jr	SS jr
SS jrg)z'Utilities for working with Python ASTs.    )annotationsN)Callablec                   [         R                  " U 5      n[
        R                  " U5      n[        R                  " U5      n[        U[        R                  5      (       d   e[        UR                  5      S:X  d   eUR                  S   n[        U[        R                  5      (       d   eX4$ ! [         a  n[        SU R                   S35      UeS nAff = f)Nz@Decorator script does not work on dynamically compiled function .   r   )inspect	getsourceOSErrorRuntimeError__name__textwrapdedentastparse
isinstanceModulelenbodyFunctionDef)funcsrcetop_level_astf_asts        ]/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnxscript/_internal/ast_utils.pyget_src_and_astr      s    %
 //#
CIIcNMmSZZ0000}!!"a'''q!EeS__----:  Nt}}o]^_
	s   B3 3
C=CCc                v    U R                   n[        U[        R                  5      (       a  UR                  $ U/$ )N)slicer   r   Tupleelts)expr
index_exprs     r   normalize_subscript_exprr#      s0    
 J*cii((|    c                @   [        U [        R                  5      (       a  [        U R                  [        R                  5      (       aV  [        U R                  R
                  [        R                  5      (       a#  U R                  R
                  R                  S:H  $ g)z=Return True if the statement is a call to the print function.printF)r   r   ExprvalueCallr   Nameidstmts    r   is_print_callr.   )   s]    $!!djj#((++$**//38844zz))W44r$   c                    [        U [        R                  5      (       aM  [        U R                  [        R                  5      (       a$  [        U R                  R                  [
        5      $ g)z,Return True if the statement is a docstring.F)r   r   r'   r(   Constantstrr,   s    r   is_doc_stringr2   2   sA    $!!jS\\&J&J$****C00r$   )r   r   returnztuple[str, ast.FunctionDef])r!   zast.Subscript)r-   zast.stmtr3   bool)__doc__
__future__r   r   r   r   typingr   r   r#   r.   r2    r$   r   <module>r9      s-    . " 
    	r$   