U
    Evf\                     @   sB   d Z ddlmZ ddlmZ ddlZddlmZ ddddZdS )	z
Internal debugging utilities, that are not expected to be used in the rest of
the codebase.

WARNING: Code in this module may change without prior notice!
    )StringIO)PathN)TransformNode)	highlightc                   s~    dkr| g t   fddt }|d | | |d tjddt|jdd d	|g| d
dd dS )a  
    Generate a graphical representation of the transform tree for *transform*
    using the :program:`dot` program (which this function depends on).  The
    output format (png, dot, etc.) is determined from the suffix of *dest*.

    Parameters
    ----------
    transform : `~matplotlib.transform.Transform`
        The represented transform.
    dest : str
        Output filename.  The extension must be one of the formats supported
        by :program:`dot`, e.g. png, svg, dot, ...
        (see https://www.graphviz.org/doc/info/output.html).
    highlight : list of `~matplotlib.transform.Transform` or None
        The transforms in the tree to be drawn in bold.
        If *None*, *transform* is highlighted.
    Nc              
      s   t | krd S t |  i }t| j}| jr>d| d}|  krNd|d< d|d< d| |d< d	td
j| }|	t |  d| d t
|  D ]P\}}t|trt | |jkr|	dt |  dt | d| d || qd S )N[]ZboldstyleZboxshapez"%s"label z{0[0]}={0[1]}z [z];
"z" -> "z
" [label="z", fontsize=10];
)idaddtype__name___invalidjoinmapformatitemswritevars
isinstancer   _parents)rootbufpropsr
   keyvalr   recurseseen >/tmp/pip-unpacked-wheel-7vhvci0g/matplotlib/_internal_utils.pyr    &   s"    
&z(graphviz_dump_transform.<locals>.recursezdigraph G {
z}
dotz-T   z-ozutf-8T)inputcheck)	setr   r   
subprocessrunr   suffixgetvalueencode)Z	transformdestr   r   r"   r   r#   graphviz_dump_transform   s    


 r/   )	__doc__ior   pathlibr   r)   Zmatplotlib.transformsr   r/   r"   r"   r"   r#   <module>   s
   