Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/vcgutils.cpython-37.pyc

B

�d{T��@s@dZdZddlZdddddd	d
d�Zddedededd
d
d
ededd
d
edd
d
d
d
edededededededededededd�Zddedededd
d
d
ededd
d
d
d
d�Zdddedd
dededededd
d
edededd
d
d
d�Zdd�ZGdd�d�ZdS)aKFunctions 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.




zrestructuredtext en�N)�dfs�treeZminbackwardZ
left_to_rightZ
right_to_leftZ
top_to_bottomZ
bottom_to_topZmaxdepthZmaxdepthslowZmindepthZmindepthslowZ	mindegreeZminindegreeZminoutdegreeZ	maxdegreeZmaxindegreeZmaxoutdegree)�yes�no) ZblackZwhiteZblueZredZgreenZyellowZmagentaZ	lightgreyZcyanZdarkgreyZdarkblueZdarkredZ	darkgreenZ
darkyellowZdarkmagentaZdarkcyanZgoldZ	lightblueZlightredZ
lightgreenZlightyellowZlightmagentaZ	lightcyanZlilacZ	turquoiseZ
aquamarineZkhakiZpurpleZyellowgreenZpinkZorangeZorchid)ZboxZellipseZrhombZtriangle)�centerZleft_justifyZ
right_justify)Zsolid�lineZnone)Z
continuousZdashedZdottedZ	invisible)�algos�booleans�colors�shapes�	textmodes�arrowstyles�
linestylesr
�rrrr	)�title�label�color�	textcolor�bordercolor�width�height�borderwidth�textmode�shape�shrink�stretchZorientation�vertical_order�horizontal_orderZxspaceZyspaceZlayoutalgorithmZlate_edge_labelsZdisplay_edge_labelsZdirty_edge_labelsZ
finetuningZmanhattan_edgesZsmanhattan_edgesZport_sharingZedgesZnodesZsplines)rrrrrrrrrrrrrrrr
)Z
sourcenameZ
targetnamerZ	linestyle�classZ	thicknessrrZ
arrowcolorZbackarrowcolorZ	arrowsizeZ
backarrowsizeZ
arrowstyleZbackarrowstyler�priority�anchorrcCsRxL|D]D}|tjkry(t|�}|dkr:|�|dt|��}WqYqXqW|S)z8Convert latin characters using vcg escape sequence.
    �z\fi%d)�string�
ascii_letters�ord�replace)�st�char�num�r)�H/opt/alt/python37/lib/python3.7/site-packages/logilab/common/vcgutils.py�latin_to_vcg�s


r+c@sReZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	dd�Z
dd�ZdS)�
VCGPrinterzA vcg graph writer.
    cCs||_d|_dS)N�)�_stream�_indent)�selfZ
output_streamr)r)r*�__init__�szVCGPrinter.__init__cKs,|j�d|j�|��|jtf|�dS)zopen a vcg graph
        z
%sgraph:{
N)r.�writer/�_inc_indent�_write_attributes�GRAPH_ATTRS)r0�argsr)r)r*�
open_graph�szVCGPrinter.open_graphcCs|��|j�d|j�dS)zclose a vcg graph
        z%s}
N)�_dec_indentr.r2r/)r0r)r)r*�close_graph�szVCGPrinter.close_graphcKs4|j�d|j|f�|jtf|�|j�d�dS)zdraw a node
        z%snode: {title:"%s"z}
N)r.r2r/r4�
NODE_ATTRS)r0rr6r)r)r*�node�szVCGPrinter.noder-cKs8|j�d|j|||f�|jtf|�|j�d�dS)z-draw an edge from a node to another.
        z*%s%sedge: {sourcename:"%s" targetname:"%s"z}
N)r.r2r/r4�
EDGE_ATTRS)r0Z	from_nodeZto_nodeZ	edge_typer6r)r)r*�edge�s
zVCGPrinter.edgec	Ks�x�|��D]�\}}y||}Wn(tk
rFtd||��f��YnX|sf|j�d|j||f�q
|dkr�|j�d|j|t|�f�q
||kr�|j�d|j||f�q
td|||f��q
WdS)z-write graph, node or edge attributes
        z/no such attribute %s
possible attributes are %sz
%s%s:"%s"
rz%s%s:%s
z=value %s isn't correct for attribute %s
correct values are %sN)�items�KeyError�	Exception�keysr.r2r/�int)r0Zattributes_dictr6�key�valueZ_typer)r)r*r4�szVCGPrinter._write_attributescCsd|j|_dS)zincrement indentation
        z  %sN)r/)r0r)r)r*r3�szVCGPrinter._inc_indentcCs|jdd�|_dS)zdecrement indentation
        N���)r/)r0r)r)r*r8�szVCGPrinter._dec_indentN)r-)�__name__�
__module__�__qualname__�__doc__r1r7r9r;r=r4r3r8r)r)r)r*r,�s
r,)	rI�
__docformat__r"Z	ATTRS_VALr5r:r<r+r,r)r)r)r*�<module>s�