
    ci\              	       F   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z	 dd
lm
Z
 ddgZ G d dej                  e	j                  ej                  ej                  e
j                         Z G d dej$                  e      Z G d dej(                  e      Zy)u\  Assemble DOT source code objects.

Example:
    >>> doctest_mark_exe()

    >>> import graphviz
    >>> dot = graphviz.Graph(comment='Mønti Pythøn ik den Hølie Grailen')

    >>> dot.node('Møøse')
    >>> dot.node('trained_by', 'trained by')
    >>> dot.node('tutte', 'TUTTE HERMSGERVORDENBROTBORDA')

    >>> dot.edge('Møøse', 'trained_by')
    >>> dot.edge('trained_by', 'tutte')

    >>> dot.node_attr['shape'] = 'rectangle'

    >>> print(dot.source)  #doctest: +NORMALIZE_WHITESPACE
    // Mønti Pythøn ik den Hølie Grailen
    graph {
        node [shape=rectangle]
        "Møøse"
        trained_by [label="trained by"]
        tutte [label="TUTTE HERMSGERVORDENBROTBORDA"]
        "Møøse" -- trained_by
        trained_by -- tutte
    }

    >>> dot.render('doctest-output/m00se.gv').replace('\\', '/')
    'doctest-output/m00se.gv.pdf'
    N   )DEFAULT_ENCODING)_tools)dot)jupyter_integration)piping)	rendering)unflatteningGraphDigraphc                   d    e Zd ZdZ ej
                  dd      ddddddedddddfddddej                  e	   d	ej                  e	   d
ej                  e	   dej                  e	   dej                  e	   de
dej                  e	   dej                  e	   ddf fd       Zede	fd       Z xZS )	BaseGraphz0Dot language creation and source code rendering.r   self)supported_number
ignore_argNF)renderer	formatternamecommentformatengineencodingstrictr   r   returnc                j    ||| d| j                    }t        | 	  ||||	|
|||||||||       y )N.)r   r   
graph_attr	node_attr	edge_attrbodyr   filename	directoryr   r   r   r   r   )_default_extensionsuper__init__)r   r   r   r!   r"   r   r   r   r   r   r   r    r   r   r   	__class__s                  6/tmp/pip-target-z3e9_cxr/lib/python/graphviz/graphs.pyr%   zBaseGraph.__init__4   s]      0q!8!8 9:HdG$.#,	"6"*i"* &v"*i 	 	A    c                 $    dj                  |       S )z(The generated DOT source code as string. )joinr   s    r'   sourcezBaseGraph.sourceL   s     wwt}r(   )__name__
__module____qualname____doc__r   deprecate_positional_argsr   typingOptionalstrboolr%   propertyr-   __classcell__)r&   s   @r'   r   r   .   s    ;%V%%qVL4815$04042B DD %A 3737AV__S1 A //#.A  -A  -	A
 "??3/A A "??3/A #OOC0A =AA MA.   r(   r   c                   &    e Zd ZdZedefd       Zy)r   a  Graph source code in the DOT language.

    Args:
        name: Graph name used in the source code.
        comment: Comment added to the first line of the source.
        filename: Filename for saving the source
            (defaults to ``name`` + ``'.gv'``).
        directory: (Sub)directory for source saving and rendering.
        format: Rendering output format (``'pdf'``, ``'png'``, ...).
        engine: Layout command used (``'dot'``, ``'neato'``, ...).
        renderer: Output renderer used (``'cairo'``, ``'gd'``, ...).
        formatter: Output formatter used (``'cairo'``, ``'gd'``, ...).
        encoding: Encoding for saving the source.
        graph_attr: Mapping of ``(attribute, value)`` pairs for the graph.
        node_attr: Mapping of ``(attribute, value)`` pairs set for all nodes.
        edge_attr: Mapping of ``(attribute, value)`` pairs set for all edges.
        body: Iterable of verbatim lines (including their final newline)
            to add to the graph ``body``.
        strict (bool): Rendering should merge multi-edges.

    Note:
        All parameters are `optional` and can be changed under their
        corresponding attribute name after instance creation.
    r   c                      y)z	``False``F r,   s    r'   directedzGraph.directedl   s     r(   N)r.   r/   r0   r1   r7   r6   r<   r;   r(   r'   r   r   R   s"    2 $  r(   c                       e Zd ZdZej                  !eej                  j                  d      d   z  Zedefd       Zy)r   z/Directed graph source code in the DOT language.Nr      r   c                      y)z``True``Tr;   r,   s    r'   r<   zDigraph.directedx   s     r(   )	r.   r/   r0   r1   r   	partitionr7   r6   r<   r;   r(   r'   r   r   r   sF    9}} 5==**3/22$  r(   )r1   r3   r   r   r*   r   r   r   r   r	   r
   __all__DotRenderJupyterIntegrationPipe	Unflattenr   GraphSyntaxr   DigraphSyntaxr   r;   r(   r'   <module>rI      s   @  &   !   I
!  #66&&!HCOOY @	c 	r(   