U
    d/e	                     @   sh   d Z ddl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gZG d	d dej	ej
ejZdS )
:Pipe source through the Graphviz *unflatten* preprocessor.    N   )_tools)base)backend)encoding	Unflattenc                   @   s>   e Zd ZdZejddd
eje e	eje dddd	Z
dS )r   r   r   )Zsupported_numberNFzgraphviz.Source)staggerfanoutchainreturnc                 C   sr   ddl m} | j| j|||| jd}|  }|j||d|d|d|d|d|d	|d
dd	S )a  Return a new :class:`.Source` instance with the source
            piped through the Graphviz *unflatten* preprocessor.

        Args:
            stagger: Stagger the minimum length
                of leaf edges between 1 and this small integer.
            fanout: Fanout nodes with indegree = outdegree = 1
                when staggering (requires ``stagger``).
            chain: Form disconnected nodes into chains
                of up to this many nodes.

        Returns:
            Prepocessed DOT source code (improved layout aspect ratio).

        Raises:
            graphviz.RequiredArgumentError: If ``fanout`` is given
                but ``stagger`` is None.
            graphviz.ExecutableNotFound: If the Graphviz ``unflatten`` executable
                is not found.
            graphviz.CalledProcessError: If the returncode (exit status)
                of the unflattening 'unflatten' subprocess is non-zero.

        See also:
            Upstream documentation:
            https://www.graphviz.org/pdf/unflatten.1.pdf
        r   )sources)r	   r
   r   r   filename	directoryformatenginer   renderer	formatterN)r   r   r   r   r   r   r   Zloaded_from_path) r   Z
_unflattensourcer   Z_copy_kwargsZSourceget)selfr	   r
   r   r   outkwargs r   9/tmp/pip-unpacked-wheel-n8ok7rre/graphviz/unflattening.py	unflatten   s$      zUnflatten.unflatten)NFN)__name__
__module____qualname____doc__r   Zdeprecate_positional_argstypingOptionalintboolr   r   r   r   r   r      s   
    )r    r!   Zgraphvizr   r   r   r   r   __all__EncodingZBaser   r   r   r   r   <module>   s   