3
tûœ]  ã            "   @   s,  d Z dRdSdTdUdVdWdXdBœZdCdCedD edD edD dEdEdEedF edG dEdEedH dEdEdEdEedH edI edI edI edI edI edI edI edI edI edI dJœZdCdCedD edD edD dEdEdEedF edG dEdEdEdEdKœZdCdCdCedL dEdCedD edD edD edD dEdEedM edM edF dEdEdEdNœZG dOdP„ dPƒZdQS )YaG  Functions to generate files readable with Georg Sander's vcg
(Visualization of Compiler Graphs).

You can download vcg at http://rw4.cs.uni-sb.de/~sander/html/gshome.html
Note that vcg exists as a debian package.

See vcg's documentation for explanation about the different values that
maybe used for the functions parameters.
ÚdfsÚtreeÚminbackwardÚleft_to_rightÚright_to_leftÚtop_to_bottomÚbottom_to_topÚmaxdepthÚmaxdepthslowÚmindepthÚmindepthslowÚ	mindegreeÚminindegreeÚminoutdegreeÚ	maxdegreeÚmaxindegreeÚmaxoutdegreeÚyesÚnoÚblackÚwhiteÚblueÚredÚgreenÚyellowÚmagentaÚ	lightgreyÚcyanÚdarkgreyÚdarkblueÚdarkredÚ	darkgreenÚ
darkyellowÚdarkmagentaÚdarkcyanÚgoldÚ	lightblueÚlightredÚ
lightgreenÚlightyellowÚlightmagentaÚ	lightcyanÚlilacÚ	turquoiseÚ
aquamarineÚkhakiÚpurpleÚyellowgreenÚpinkÚorangeÚorchidÚboxÚellipseÚrhombÚtriangleÚcenterÚleft_justifyÚright_justifyÚsolidÚlineÚnoneÚ
continuousÚdashedÚdottedÚ	invisible)ÚalgosÚbooleansÚcolorsÚshapesÚ	textmodesÚarrowstylesÚ
linestylesé    rD   é   rF   rE   rB   rC   )ÚtitleÚlabelÚcolorÚ	textcolorÚbordercolorÚwidthÚheightÚborderwidthÚtextmodeÚshapeÚshrinkÚstretchZorientationÚvertical_orderÚhorizontal_orderZxspaceZyspaceZlayoutalgorithmZlate_edge_labelsZdisplay_edge_labelsZdirty_edge_labelsZ
finetuningZmanhattan_edgesZsmanhattan_edgesZport_sharingÚedgesZnodesZsplines)rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rH   rG   )Z
sourcenameZ
targetnamerL   Z	linestyleÚclassZ	thicknessrM   rN   Z
arrowcolorZbackarrowcolorZ	arrowsizeZbackarrowsizeZ
arrowstyleZbackarrowstylerS   ÚpriorityÚanchorrX   c               @   sR   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zddd„Zdd„ Z	dd„ Z
dd„ ZdS )Ú
VCGPrinterzA vcg graph writer.
    c             C   s   || _ d| _d S )NÚ )Ú_streamÚ_indent)ÚselfZoutput_stream© rb   ú;/tmp/pip-build-fn42xldr/pylint/pylint/pyreverse/vcgutils.pyÚ__init__Ÿ   s    zVCGPrinter.__init__c             K   s,   | j jd| j ƒ | jƒ  | jtf|Ž dS )zopen a vcg graph
        z
%sgraph:{
N)r_   Úwriter`   Ú_inc_indentÚ_write_attributesÚGRAPH_ATTRS)ra   Úargsrb   rb   rc   Ú
open_graph£   s    zVCGPrinter.open_graphc             C   s   | j ƒ  | jjd| j ƒ dS )zclose a vcg graph
        z%s}
N)Ú_dec_indentr_   re   r`   )ra   rb   rb   rc   Úclose_graphª   s    zVCGPrinter.close_graphc             K   s4   | j jd| j|f ƒ | jtf|Ž | j jdƒ dS )zdraw a node
        z%snode: {title:"%s"z}
N)r_   re   r`   rg   Ú
NODE_ATTRS)ra   rK   ri   rb   rb   rc   Únode°   s    zVCGPrinter.noder^   c             K   s8   | j jd| j|||f ƒ | jtf|Ž | j jdƒ dS )z-draw an edge from a node to another.
        z*%s%sedge: {sourcename:"%s" targetname:"%s"z}
N)r_   re   r`   rg   Ú
EDGE_ATTRS)ra   Z	from_nodeZto_nodeZ	edge_typeri   rb   rb   rc   Úedge·   s
    zVCGPrinter.edgec             K   sÈ   xÂ|j ƒ D ]¶\}}y|| }W n( tk
rF   td||jƒ f ƒ‚Y nX |sf| jjd| j||f ƒ q
|dkrŒ| jjd| j|t|ƒf ƒ q
||kr®| jjd| j||f ƒ q
td|||f ƒ‚q
W dS )z-write graph, node or edge attributes
        z/no such attribute %s
possible attributes are %sz
%s%s:"%s"
rJ   z%s%s:%s
z=value %s isn't correct for attribute %s
correct values are %sN)ÚitemsÚKeyErrorÚ	ExceptionÚkeysr_   re   r`   Úint)ra   Zattributes_dictri   ÚkeyÚvalueÚ_typerb   rb   rc   rg   Ã   s     zVCGPrinter._write_attributesc             C   s   d| j  | _ dS )zincrement indentation
        z  %sN)r`   )ra   rb   rb   rc   rf   Ý   s    zVCGPrinter._inc_indentc             C   s   | j dd… | _ dS )zdecrement indentation
        Né   éþÿÿÿ)r`   )ra   rb   rb   rc   rk   â   s    zVCGPrinter._dec_indentN)r^   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rd   rj   rl   rn   rp   rg   rf   rk   rb   rb   rb   rc   r]   ›   s   
r]   N)r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   )r   r   ) r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   )r4   r5   r6   r7   )r8   r9   r:   )r;   r<   r=   )r>   r?   r@   rA   )r~   Z	ATTRS_VALrh   rm   ro   r]   rb   rb   rb   rc   Ú<module>   sæ                                                  