o
    i                     @   sR   d dl Zd dlZddlmZ ddlmZ dZG dd deeZdd	 Z	d
d Z
dS )    N   )ReprPrinter)
StrPrinter)AddInfinityIntegerZMulNegativeInfinityPowc                       s:   e Zd ZdZd fdd	Zdd Zdd Zd	d
 Z  ZS )PythonPrinterzFA printer which converts an expression into its Python interpretation.Nc                    sD   t  | g | _g | _tD ]}d| }tt|}tt|| qd S )Nz	_print_%s)	super__init__symbols	functionsSTRPRINTgetattrr   setattrr
   )selfsettingsnamef_namef	__class__ d/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/sympy/printing/python.pyr      s   
zPythonPrinter.__init__c                 C   s4   |j j}tt|s|| jvr| j| t| |S N)func__name__hasattrsympyr   appendr   _print_Function)r   exprr   r   r   r   r!      s   zPythonPrinter._print_Functionc                 C   s,   |  |}|| jvr| j| t| |S r   )_strr   r    r   _print_Symbol)r   r"   symbolr   r   r   r$       s   

zPythonPrinter._print_Symbolc                 C   s   t d)Nz*Modules in the expression are unacceptable)
ValueError)r   r"   r   r   r   _print_module&   s   zPythonPrinter._print_moduler   )	r   
__module____qualname____doc__r   r!   r$   r'   __classcell__r   r   r   r   r
   
   s    r
   c           
      K   s2  t |}|| }d}i }|jD ]D}d|v r(|dddd}||t|< n|}t|rJ	 |d7 }||jvrI||jvrIt||t|< nq0||d | d 7 }q|jD ].}|}	t|	r|	 |	d7 }	|	|jvr{|	|jvr{t	|	|t	|< nqb||	d | d 7 }qX|r| 
|}|d	|| 7 }|S )
zvReturn Python interpretation of passed expression
    (can be passed to the exec() function without any modifications) {}T_z = Symbol('z')
z = Function('ze = )r
   Zdoprintr   replacer   Symbolkw	iskeywordr   Functionsubsr#   )
r"   r   printerZexprpresultZ	renamingsZ
symbolnameZnewsymbolnameZfunctionnameZnewfunctionnamer   r   r   python*   sN   









r8   c                 K   s   t t| fi | dS )z!Print output of python() functionN)printr8   )r"   r   r   r   r   print_pythonZ   s   r:   )keywordr2   r   reprr   strr   r   r
   r8   r:   r   r   r   r   <module>   s     0