
    c"                       U d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZ dddd	d
dddZi ddddded         ded         ded         ddddddded         ded         ddddded         d dd!dd"dd#ded         ed$         ed$         ed$         ed$         ed$         ed$         ed$         ed$         ed$         ed$         d%Zdded         ed         ed         ddded         ed         ddddd&Zi d'dd(dddd)ed*         d+dd,dded         ded         d-ed         d.ed         d/dd0dd1ed2         d3ed2         ded         d4dd5dd!diZej        d6ej        d6ej        d7iZd8ed9<   ej        d:d;dd<ej        d:d;d=d<ej        d:d;d>d=d?ej        d:d;d@dAej        d:d;d@dAiZdBedC<   e	j        dDe	j        dEe	j        dFe	j        dGiZ dHedI<    G dJ dKe          Z!dLS )MaH  Functions to generate files readable with George Sander's vcg
(Visualization of Compiler Graphs).

You can download vcg at https://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.
    )annotations)Mapping)Any)EdgeTypeLayoutNodePropertiesNodeTypePrinter)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titlelabelcolorrN   	textcolorbordercolorwidth   heightborderwidthtextmoderP   shaperO   shrinkstretchorientationrL   vertical_orderhorizontal_orderxspaceyspacerM   )layoutalgorithmlate_edge_labelsdisplay_edge_labelsdirty_edge_labels
finetuningmanhattan_edgessmanhattan_edgesport_sharingedgesnodessplines)rS   rT   rU   rV   rW   rX   rZ   r[   r\   r]   r^   r_   ra   rb   
sourcename
targetname	linestylerR   class	thickness
arrowcolorbackarrowcolor	arrowsizebackarrowsize
arrowstylerQ   backarrowstylepriorityanchorr>   r?   zdict[NodeType, str]SHAPESrE   rG   )ry   rz   rx   
   rJ   )ry   rz   rr   rx   r"   )ry   rz   rV   z$dict[EdgeType, dict[str, str | int]]ARROWSr   r   r   r   zdict[Layout, str]ORIENTATIONc                  V    e Zd ZddZddZ	 dddZedd            Z	 dddZddZ	dS ) 
VCGPrinterreturnNonec                   |                      d           |                                  |                     t          | j        dddd           | j        r.|                     t          t          | j                            dS dS )zEmit the header lines.zgraph:{
r   r   r   )rS   re   rf   rl   rj   )r`   N)emit_inc_indent_write_attributesGRAPH_ATTRSrS   layoutr   selfs    <lib/python3.11/site-packages/pylint/pyreverse/vcg_printer.py_open_graphzVCGPrinter._open_graph   s    		+*!"! 	 	
 	
 	
 ; 	V"";K<T"UUUUU	V 	V    c                X    |                                   |                     d           dS )z2Emit the lines needed to properly close the graph.}N)_dec_indentr   r   s    r   _close_graphzVCGPrinter._close_graph   s'    		#r   Nnamestrtype_r	   
propertiesNodeProperties | Nonec                   |t          |          }n|j        ||_        |                     d| dd           |                     t          |                     |          t          |                    |                     d           dS )	zVCreate a new node.

        Nodes can be classes, packages, participants etc.
        N)rT   znode: {title:""Fforce_newline)rT   r]   r   )r   rT   r   r   
NODE_ATTRS_build_label_for_noder}   )r   r   r   r   s       r   	emit_nodezVCGPrinter.emit_node   s      	$'d333JJ 	$#J		+D+++5	AAA,,Z88- 	 	
 	
 	

 			#r   r   c                F   | j         dk    rdnd}d| | j         d}| j        	| j        |S | j        pg }| j        pg }d |D             }t	          d | j        g|z   |z   D                       }d|d	z   z  }| d
| }|D ]	}| d| }
|r| d
| }|D ]
}	| d|	 d}|S )Nr!   z09 z\fbz\fnc                    g | ]	}|j         
S  )r   ).0funcs     r   
<listcomp>z4VCGPrinter._build_label_for_node.<locals>.<listcomp>   s    666d	666r   c              3  4   K   | ]}t          |          V  d S N)len)r   r   s     r   	<genexpr>z3VCGPrinter._build_label_for_node.<locals>.<genexpr>   s(      UU4SYYUUUUUUr   _   z\n\fz\n\f08z\n\f10z())	fontcolorrT   attrsmethodsmax)
r   r   rT   r   r   method_namesmaxlenrF   attrr   s
             r   r   z VCGPrinter._build_label_for_node   s/   (2e;CFF	7y7*"2777 	
(: 	L &B$*66g666UUJ,<+=+Lu+TUUUUUfqj!%%t%% 	, 	,D++T++EE 	*))4))E  	. 	.D--T---EEr   	from_nodeto_noder   rT   
str | Nonec                    |                      d| d| dd           t          |         }|r||d<    | j        t          fi | |                      d           dS )	zACreate an edge from one node to another to display relationships.zedge: {sourcename:"z" targetname:"r   Fr   rT   r   N)r   r   r   
EDGE_ATTRS)r   r   r   r   rT   
attributess         r   	emit_edgezVCGPrinter.emit_edge  s     			F9FFGFFF 	 	
 	
 	
 E]
 	("'Jw	
 	
	
 	
 	
 			#r   attributes_dictMapping[str, Any]argsr   c           	        |                                 D ]\  }}	 ||         }n:# t          $ r-}t          d| d|                                           |d}~ww xY w|s|                     | d| d           g|dk    r)|                     | dt          |           d           ||v r|                     | d| d           t          d	| d
| dt                     dS )z%Write graph, node or edge attributes.zno such attribute z
possible attributes are Nz:"z"
rY   :
zvalue z isn't correct for attribute z correct values are )itemsKeyErrorAttributeErrorkeysr   int
ValueErrortype)r   r   r   keyvalue_typees          r   r   zVCGPrinter._write_attributes  sU    **,, 	 	JC',   $```H\H\H^H^`` 
  			S..E...////! 		S113u::1112222% 		S,,5,,,---- `U````Z^``  	 	s   $
A(AA)r   r   r   )r   r   r   r	   r   r   r   r   )r   r   r   r   )
r   r   r   r   r   r   rT   r   r   r   )r   r   r   r   r   r   )
__name__
__module____qualname__r   r   r   staticmethodr   r   r   r   r   r   r   r      s        V V V V    -1	    ,    \4 !    *     r   r   N)"__doc__
__future__r   collections.abcr   typingr   pylint.pyreverse.printerr   r   r   r	   r
   	ATTRS_VALr   r   r   PACKAGECLASS	INTERFACEr}   __annotations__USESINHERITS
IMPLEMENTSASSOCIATIONAGGREGATIONr   LEFT_TO_RIGHTRIGHT_TO_LEFTTOP_TO_BOTTOMBOTTOM_TO_TOPr   r   r   r   r   <module>r      s  
   # " " " " " # # # # # #       X X X X X X X X X X X X X X& !D 6<,Au; ;	BQQ Yx  8$	
 9X& Q a 1 	+& Yx  a q 9W% a   a!" a#$ !)!*-$Z0":.J' ,!*-j)z"z"$9  > x 8$X&+&x  
 !! Q <(	
 Q  Yx  8$ )H% i)  Q )M* i. 	+&  !" a#$ % 
* eNE	     M  
   
  	    
   -0    : /
/
/
/	"    k k k k k k k k k kr   