�
��gR � �� � d dl mZ d dlmZ d dlmZ d dlmZmZm Z d dl
mZ dgZeddd �fed
diffZ
eeee fZdd
�Ze
fd�Zdd�Ze
eddfd�Zd� ddfd�ZdZddd�Ze
d� ddefd�ZdS )� )�Basic)�Expr)�Symbol)�Integer�Rational�Float)�srepr�dotprint�blue�ellipse)�color�shaper
�blackFc �: � d}t | t � � st | � � }nm| j st | � � }nV| j }t t
t |� � � � }t | � � j �dd�
|� � �d�}|r||f}|S )aN A string that follows ```obj = type(obj)(*obj.args)``` exactly.
Parameters
==========
with_args : boolean, optional
If ``True``, there will be a second argument for the return
value, which is a tuple containing ``purestr`` applied to each
of the subnodes.
If ``False``, there will not be a second argument for the
return.
Default is ``False``
Examples
========
>>> from sympy import Float, Symbol, MatrixSymbol
>>> from sympy import Integer # noqa: F401
>>> from sympy.core.symbol import Str # noqa: F401
>>> from sympy.printing.dot import purestr
Applying ``purestr`` for basic symbolic object:
>>> code = purestr(Symbol('x'))
>>> code
"Symbol('x')"
>>> eval(code) == Symbol('x')
True
For basic numeric object:
>>> purestr(Float(2))
"Float('2.0', precision=53)"
For matrix symbol:
>>> code = purestr(MatrixSymbol('x', 2, 2))
>>> code
"MatrixSymbol(Str('x'), Integer(2), Integer(2))"
>>> eval(code) == MatrixSymbol('x', 2, 2)
True
With ``with_args=True``:
>>> purestr(Float(2), with_args=True)
("Float('2.0', precision=53)", ())
>>> purestr(MatrixSymbol('x', 2, 2), with_args=True)
("MatrixSymbol(Str('x'), Integer(2), Integer(2))",
("Str('x')", 'Integer(2)', 'Integer(2)'))
� �(�, �))�
isinstancer �str�argsr �tuple�map�purestr�type�__name__�join)�x� with_args�sargs�rvr s �b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/printing/dot.pyr r s� � �b
�E��a���� ;�
��V�V���
�V� ;�
�1�X�X����v���c�'�4�(�(�)�)���A�w�w�'�'�'����5�)9�)9�)9�)9�
:��� �
��Y��
�I� c �d � i }|D ]*\ }}t | |� � r|� |� � �+|S )a� Merge style dictionaries in order
Examples
========
>>> from sympy import Symbol, Basic, Expr, S
>>> from sympy.printing.dot import styleof
>>> styles = [(Basic, {'color': 'blue', 'shape': 'ellipse'}),
... (Expr, {'color': 'black'})]
>>> styleof(Basic(S(1)), styles)
{'color': 'blue', 'shape': 'ellipse'}
>>> x = Symbol('x')
>>> styleof(x + 1, styles) # this is an Expr
{'color': 'black', 'shape': 'ellipse'}
)r �update)�expr�styles�style�typ�stys r"