+
    i
                     f    R t ^ RIHt ^ RIHt ^ RIHtHtHtH	t	H
t
HtHtHt  ! R R]4      tR tR# )a  
This module implements the functionality to take any Python expression as a
string and fix all numbers and other things before evaluating it,
thus

1/2

returns

Integer(1)/Integer(2)

We use the ast module for this. It is well documented at docs.python.org.

Some tips to understand how this works: use dump() to get a nice
representation of any node. Then write a string of what you want to get,
e.g. "Integer(1)", parse it, dump it and you'll see that you need to do
"Call(Name('Integer', Load()), [node], [], None, None)". You do not need
to bother with lineno and col_offset, just call fix_missing_locations()
before returning the node.
)Basic)SympifyError)parseNodeTransformerCallNameLoadfix_missing_locationsConstantTuplec                   8   a  ] tR t^t o R tR tR tR tRtV t	R# )	Transformc                J    \         P                  ! V 4       Wn        W n        R # )N)r   __init__
local_dictglobal_dict)selfr   r   s   &&&x/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/parsing/ast_parser.pyr   Transform.__init__   s      &$&    c           	     .   \        VP                  \        4      '       d+   \        \	        \        R \        4       4      V.. R7      4      # \        VP                  \        4      '       d+   \        \	        \        R\        4       4      V.. R7      4      # V# )IntegerfuncargskeywordsFloat)
isinstancevalueintr	   r   r   r   float)r   nodes   &&r   visit_ConstantTransform.visit_Constant#   su    djj#&&(4	463J"*. / /

E**(43H"*. / /r   c           	        VP                   V P                  9   d   V# VP                   V P                  9   dN   V P                  VP                   ,          p\        V\        \
        34      '       g   \        V4      '       d   V# MVP                   R9   d   V# \        \        \        R\        4       4      \        VP                   4      .. R7      4      # )TrueSymbolr   )r%   False)idr   r   r   r   typecallabler	   r   r   r   r
   )r   r!   name_objs   && r   
visit_NameTransform.visit_Name,   s    77doo%KWW(((''0H(UDM22hx6H6H 7IWW))K$TtHdf/Etww'(2&7 8 	8r   c                &   VP                   P                    Uu. uF  q P                  V4      NK  	  ppV P                  VP                  4      p\        \	        R \        4       4      \        V\        4       4      V.. R7      p\        V4      # u upi )Lambdar   )r   visitbodyr   r   r   r   r	   )r   r!   argr   r1   ns   &&    r   visit_LambdaTransform.visit_Lambda9   sn    +/99>>:>C

3>:zz$))$d8TV,df%t,r;$Q''	 ;s   B)r   r   N)
__name__
__module____qualname____firstlineno__r   r"   r,   r4   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     '
8( (r   r   c                   / p\        RV4        \        V P                  4       RR7      p\        Y4      P                  T4      p\        TRR4      p\        YBT4      #   \         d    \	        R\        T 4      ,          4      hi ; i)z
Converts the string "s" to a SymPy expression, in local_dict.

It converts all numbers to Integers before feeding it to Python and
automatically creates Symbols.
zfrom sympy import *eval)modezCannot parse %s.z<string>)
execr   stripSyntaxErrorr   reprr   r0   compiler>   )sr   r   aes   &&   r   
parse_exprrH   @   s     K	,9!'')&) 	**003A:v&A
++	  9-Q7889s   A 'BN)__doc__sympy.core.basicr   sympy.core.sympifyr   astr   r   r   r   r   r	   r
   r   r   rH    r   r   <module>rN      s3   * # ++ + +"( "(H,r   