B
    ™‘[’	  ã               @   s4   d dl mZmZ dd„ Zdd„ Zdd„ Zdd	„ Zd
S )é    )Úprint_functionÚdivisionc             C   sV   d	dd„}t | ƒdkrdS d}x | dd… D ]}|||ƒ7 }q,W ||| d dƒ7 }|S )
zÎ
    Prettyprints systems of nodes.

    Examples
    ========

    >>> from sympy.printing.tree import pprint_nodes
    >>> print(pprint_nodes(["a", "b1\nb2", "c"]))
    +-a
    +-b1
    | b2
    +-c

    é   c             S   s\   |   d¡}d|d  }x@|dd … D ]0}|dkr2q$|dkrH|d| 7 }q$|d| 7 }q$W |S )NÚ
z+-%s
r   r   Ú z| %s
z  %s
)Úsplit)ÚsÚtypeÚxÚrÚa© r   ú2lib/python3.7/site-packages/sympy/printing/tree.pyÚindent   s    
zpprint_nodes.<locals>.indentr   r   Néÿÿÿÿé   )r   )Úlen)Úsubtreesr   Úfr   r   r   r   Úpprint_nodes   s    
r   c             C   s^   d| j jt| ƒf }| j}t|ƒdkrZx2t|ƒD ]&}|| }|dkrFq0|d||f 7 }q0W |S )zu
    Returns information about the "node".

    This includes class name, string representation and assumptions.
    z%s: %s
r   N)Ú	__class__Ú__name__ÚstrZ_assumptionsr   Úsorted)Únoder   Údr   Úvr   r   r   Ú
print_node'   s    r   c             C   s6   g }x| j D ]}| t|ƒ¡ qW t| ƒt|ƒ }|S )z«
    Returns a tree representation of "node" as a string.

    It uses print_node() together with pprint_nodes() on node.args recursively.

    See also: print_tree()
    )ÚargsÚappendÚtreer   r   )r   r   Úargr   r   r   r   r    8   s
    r    c             C   s   t t| ƒƒ dS )a’  
    Prints a tree representation of "node".

    Examples
    ========

    >>> from sympy.printing import print_tree
    >>> from sympy import Symbol
    >>> x = Symbol('x', odd=True)
    >>> y = Symbol('y', even=True)
    >>> print_tree(y**x)
    Pow: y**x
    +-Symbol: y
    | algebraic: True
    | commutative: True
    | complex: True
    | even: True
    | hermitian: True
    | imaginary: False
    | integer: True
    | irrational: False
    | noninteger: False
    | odd: False
    | rational: True
    | real: True
    | transcendental: False
    +-Symbol: x
      algebraic: True
      commutative: True
      complex: True
      even: False
      hermitian: True
      imaginary: False
      integer: True
      irrational: False
      noninteger: False
      nonzero: True
      odd: True
      rational: True
      real: True
      transcendental: False
      zero: False

    See also: tree()
    N)Úprintr    )r   r   r   r   Ú
print_treeG   s    .r#   N)Z
__future__r   r   r   r   r    r#   r   r   r   r   Ú<module>   s   #