V{tx d Z ddlmZ ddlZddlZddlZddlZddlZddlm Z ddl
mZ dd
Z G d d Z
ddZ d d!dZd"dZdS )#z^Graph manipulation utilities.
(dot generation adapted from pypy/translator/tool/make_dot.py)
)annotationsN)Sequence)Anyfilenamestrreturntuple[str, str, str]c t j | }t j t j | }t j | d dd }|||fS )zDTransforms /some/path/foo.png into ('/some/path', 'foo.png', 'png'). N)ospathbasenamedirnameabspathsplitext)r r storedirtargets ^/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pylint/graph.pytarget_info_from_filenamer sh w))Hwrwx8899H
W
h
'
'
+ABB
/FXv%% c j e Zd ZdZ dd dZd!dZ ee Z d"d#dZd$dZ d%dZ
d&dZdS )'
DotBackendzDot File back-end.Nutf-8dot graphnamer rankdir
str | Nonesizer ratiocharsetrendereradditional_paramdict[str, Any] | Noner Nonec * |i }|| _ || _ g | _ d | _ | dt | d |r| d| |r| d| |r| d| d |r<| dv s
J d| | d | d | D ]*}| d
| +d S )Nzdigraph z {zrankdir=zratio=zsize="">
iso-8859-1latin1r zunsupported charset z charset="=) r r" lines_sourceemitnormalize_node_idloweritemsjoin) selfr r r r r! r" r# params r __init__zDotBackend.__init__ sf #!"
"
#' >.y99>>>??? ,II***+++ (II&u&&''' (II&t&&&''' .==?? ' 0g//
II,',,,---%++-- ' 'EIIchhuoo&&&& ' 'r c | j 6| d d | j | _ | `| j S )zReturns self._source.Nz}
)r, r- r1 r+ )r2 s r
get_sourcezDotBackend.get_sourceA s> <IIe99TZ00DL
|r
outputfilemapfilec 0 d}| j }|[d}t j d| \ }}t j d| \ }}t j | t j | nRt | \ } } }|s
d}|dz |z }||vr-t j d| \ }}t j | n|}t
j |dd 5 }
|
| j ddd n# 1 swxY w Y ||vrt j | j t d
| d| j d |r%t j | j d
d|d||d|g d n!t j | j d||d|gd t j | |S )a+ Generates a graph file.
:param str outputfile: filename and path [defaults to graphname.png]
:param str mapfile: filename and path
:rtype: str
:return: a path to the generated file
:raises RuntimeError: if the executable for rendering was not found
)r gvNpngz.gvz.png.wutf8)encodingzCannot generate `z` because 'zg' executable not found. Install graphviz, or specify a `.gv` outputfile to produce the DOT source code.z-Tcmapxz-oz-TT)check)r tempfilemkstempr
closer codecsopenwritesourceshutilwhichr" RuntimeError
subprocessrununlink)r2 r8 r9 graphviz_extensionsnamer pdotdot_sourcepathppng_files r generatezDotBackend.generateK s: ,~F#+#3E4#@#@ D.'/==D*HTNNNHTNNNN4Z@@LAq&
7'#-6
000'/'7t'D'D$n!+
[v
>
>
> $$JJt{### $ $ $ $ $ $ $ $ $ $ $ $ $ $ $,,,|DM**2"A
A At} A A A
!&"
]D&.$
S
In%%%s C77C;>C;linec : | j | dS )zAdds