+
    iR                          ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtH	t	 ^ RI
Ht R.t]RRR	R
/3]RR/33t]]]]	3tRR lt]3R ltRR lt]]RR3R ltR RR3R ltRtRRRR/t]R RR]3R ltR# )    )Basic)Expr)Symbol)IntegerRationalFloat)sreprdotprintcolorblueshapeellipseblackc                B   Rp\        V \        4      '       g   \        V 4      pMoV P                  '       g   \	        V 4      pMQV P                  p\        \        \        V4      4      p\        V 4      P                  : RRP                  V4      : R2pV'       d   W23pV# )a  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   &&   r/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/printing/dot.pyr   r      sx    b EaVVVV1Xvvc'4()Aw''5)9:YI    c                h    / pV F)  w  r4\        W4      '       g   K  VP                  V4       K+  	  V# )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"   styleofr+   N   s3    $ Ed  LL  Lr#   c                `    VP                  R \        V P                  4       4       4       4      # )zPrint a dictionary of attributes

Examples
========

>>> from sympy.printing.dot import attrprint
>>> print(attrprint({'color': 'blue', 'shape': 'ellipse'}))
"color"="blue", "shape"="ellipse"
c              3   4   "   T F  pR V,          x  K  	  R# 5i)z	"%s"="%s"Nr   ).0items   & r"   	<genexpr>attrprint.<locals>.<genexpr>q   s     I7Ht+d**7Hs   )r   sorteditems)d	delimiters   &&r"   	attrprintr6   g   s$     >>Ivaggi7HIIIr#   Tc                @   \        W4      p\        V \        4      '       d3   V P                  '       g!   \	        V P
                  P                  4      pMV! V 4      pWeR&   \        V 4      pV'       d   VR\	        V4      ,          ,          pRV: R\        V4      : R2# )zString defining a node

Examples
========

>>> from sympy.printing.dot import dotnode
>>> from sympy.abc import x
>>> print(dotnode(x))
"Symbol('x')_()" ["color"="black", "label"="x", "shape"="ellipse"];
label_%s"z" [z];)	r+   r   r   is_Atomr   	__class__r   r   r6   )r&   r'   	labelfuncposrepeatr(   r8   expr_strs   &&&&&   r"   dotnoderA   t   sw     D!E$t|||DNN++,$'Nt}HECH$$#Yu%566r#   c                 ,    \        V \        4      '       * # Nr   r   r   s   &r"   <lambda>rF      s    jE&:":r#   c           
     8   V! V 4      '       d   . # \        V RR7      w  rEV'       dO   VR\        V4      ,          ,          p\        V4       UUu. uF  w  rgV: R\        W&3,           4      : 2NK   	  pppV Uu. uF  pRV: RV: R2NK  	  up# u uppi u upi )ag  List of strings for all expr->expr.arg pairs

See the docstring of dotprint for explanations of the options.

Examples
========

>>> from sympy.printing.dot import dotedges
>>> from sympy.abc import x
>>> for e in dotedges(x+2):
...     print(e)
"Add(Integer(2), Symbol('x'))_()" -> "Integer(2)_(0,)";
"Add(Integer(2), Symbol('x'))_()" -> "Symbol('x')_(1,)";
T)r   r9   _r:   z" -> "z";)r   r   	enumerate)r&   atomr>   r?   r@   arg_strsias   &&&&    r"   dotedgesrN      s     Dzz	$TT:C((H%h/1/DA $%c#*o6/  19ABA8Q/BB1Bs   $B:Bz|digraph{

# Graph style
%(graphstyle)s

#########
# Nodes #
#########

%(nodes)s

#########
# Edges #
#########

%(edges)s
}rankdirTDorderingoutc                 ,    \        V \        4      '       * # rC   rD   rE   s   &r"   rF   rF      s    jE.B*Br#   Nc           	       aaaaaaa	a
 \         P                  4       pVP                  V4       . o	. oRVVVVV	VVV
3R llo
S
! V ^ 4       \        R\	        VRR7      RRP                  S	4      RRP                  S4      /,          # )a  DOT description of a SymPy expression tree

Parameters
==========

styles : list of lists composed of (Class, mapping), optional
    Styles for different classes.

    The default is

    .. code-block:: python

        (
            (Basic, {'color': 'blue', 'shape': 'ellipse'}),
            (Expr,  {'color': 'black'})
        )

atom : function, optional
    Function used to determine if an arg is an atom.

    A good choice is ``lambda x: not x.args``.

    The default is ``lambda x: not isinstance(x, Basic)``.

maxdepth : integer, optional
    The maximum depth.

    The default is ``None``, meaning no limit.

repeat : boolean, optional
    Whether to use different nodes for common subexpressions.

    The default is ``True``.

    For example, for ``x + x*y`` with ``repeat=True``, it will have
    two nodes for ``x``; with ``repeat=False``, it will have one
    node.

    .. warning::
        Even if a node appears twice in the same object like ``x`` in
        ``Pow(x, x)``, it will still only appear once.
        Hence, with ``repeat=False``, the number of arrows out of an
        object might not equal the number of args it has.

labelfunc : function, optional
    A function to create a label for a given leaf node.

    The default is ``str``.

    Another good option is ``srepr``.

    For example with ``str``, the leaf nodes of ``x + 1`` are labeled,
    ``x`` and ``1``.  With ``srepr``, they are labeled ``Symbol('x')``
    and ``Integer(1)``.

**kwargs : optional
    Additional keyword arguments are included as styles for the graph.

Examples
========

>>> from sympy import dotprint
>>> from sympy.abc import x
>>> print(dotprint(x+2)) # doctest: +NORMALIZE_WHITESPACE
digraph{
<BLANKLINE>
# Graph style
"ordering"="out"
"rankdir"="TD"
<BLANKLINE>
#########
# Nodes #
#########
<BLANKLINE>
"Add(Integer(2), Symbol('x'))_()" ["color"="black", "label"="Add", "shape"="ellipse"];
"Integer(2)_(0,)" ["color"="black", "label"="2", "shape"="ellipse"];
"Symbol('x')_(1,)" ["color"="black", "label"="x", "shape"="ellipse"];
<BLANKLINE>
#########
# Edges #
#########
<BLANKLINE>
"Add(Integer(2), Symbol('x'))_()" -> "Integer(2)_(0,)";
"Add(Integer(2), Symbol('x'))_()" -> "Symbol('x')_(1,)";
}

c           
      J  < S	P                  \        V SSVS
R 7      4       S'       d
   VS8  d   R# SP                  \        V SVS
R7      4       \	        V P
                  4       UUu. uF,  w  r4S! V4      '       d   K  S! WA^,           W#3,           4      NK.  	   ppR# u uppi ))r=   r>   r?   N)rJ   r>   r?   )appendrA   extendrN   rI   r   )edepthr>   rL   argrJ   edgesr=   maxdepthnodesr?   r'   traverses   &&&  r"   r^   dotprint.<locals>.traverse  s}    WQ)VTU)XadFCD:CAFF:K]:KSWX[S\	+#Qwd
	+:K]]s   (B?B
graphstyle
)r5   r]   r[   )r   )_graphstylecopyr%   templater6   r   )r&   r'   rJ   r\   r?   r=   kwargsr`   r[   r]   r^   s   &fffff, @@@r"   r
   r
      s}    z !!#JfEE^ ^ T1\9Z4#Hdii.dii.0 0 0r#   )F)r   r   )sympy.core.basicr   sympy.core.exprr   sympy.core.symbolr   sympy.core.numbersr   r   r   sympy.printing.reprr	   __all__default_stylesslotClassesr   r+   r6   r   rA   rN   rd   rb   r
   r   r#   r"   <module>rn      s    "   $ 7 7 %, Wfgy12	Wg
 w%0<~ ( 2
J (3Bt 70 ;4 C4 	& $
E2  B$#l0r#   