Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint/__pycache__/graph.cpython-311.pyc

�

�܋f����dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZdd
�ZGd�d��Z
dd�Z	d d!d�Zd"d�ZdS)#z^Graph manipulation utilities.

(dot generation adapted from pypy/translator/tool/make_dot.py)
�)�annotationsN)�Sequence)�Any�filename�str�return�tuple[str, str, str]c��tj�|��}tj�tj�|����}tj�|��ddd�}|||fS)zDTransforms /some/path/foo.png into ('/some/path', 'foo.png', 'png').����N)�os�path�basename�dirname�abspath�splitext)rr�storedir�targets    �]/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/graph.py�target_info_from_filenamersh���w����)�)�H��w���r�w���x�8�8�9�9�H�
�W�
�
�h�
'�
'��
+�A�B�B�
/�F��X�v�%�%�c�j�eZdZdZ						dd d�Zd!d�Zee��Z	d"d#d�Zd$d�Z	d%d�Z
d&d�ZdS)'�
DotBackendzDot File back-end.N�utf-8�dot�	graphnamer�rankdir�
str | None�sizer�ratio�charset�renderer�additional_param�dict[str, Any] | Noner�Nonec�*�|�i}||_||_g|_d|_|�dt|���d���|r|�d|����|r|�d|����|r|�d|�d���|r<|���dvs
Jd|�����|�d	|�d���|���D]*}|�d
�|�����+dS)Nzdigraph z {zrankdir=zratio=zsize="�">�
iso-8859-1�latin1rzunsupported charset z	charset="�=)	rr"�lines�_source�emit�normalize_node_id�lower�items�join)	�selfrrrr r!r"r#�params	         r�__init__zDotBackend.__init__ sf���#�!��"��� ��
� "��
�#'����	�	�>�.�y�9�9�>�>�>�?�?�?��	,��I�I�*��*�*�+�+�+��	(��I�I�&�u�&�&�'�'�'��	(��I�I�&�t�&�&�&�'�'�'��	.��=�=�?�?�'����0�g�/�/�	���

�I�I�,�'�,�,�,�-�-�-�%�+�+�-�-�	'�	'�E��I�I�c�h�h�u�o�o�&�&�&�&�	'�	'rc��|j�6|�d��d�|j��|_|`|jS)zReturns self._source.Nz}
�
)r,r-r1r+)r2s r�
get_sourcezDotBackend.get_sourceAs>���<���I�I�e�����9�9�T�Z�0�0�D�L��
��|�r�
outputfile�mapfilec�0�d}|j}|�[d}tjd|��\}}tjd|��\}}tj|��tj|��nRt|��\}	}	}|s
d}|dz|z}||vr-tjd|��\}}tj|��n|}t
j|dd�	��5}
|
�|j	��ddd��n#1swxYwY||vr�tj|j���td
|�d|j�d����|r%tj|jd
d|d||d|g	d���n!tj|jd||d|gd���tj|��|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�gvN�pngz.gvz.png�.�w�utf8)�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�tempfile�mkstempr
�closer�codecs�open�write�source�shutil�whichr"�RuntimeError�
subprocess�run�unlink)r2r8r9�graphviz_extensions�namer�pdot�dot_sourcepath�ppng�_�files           r�generatezDotBackend.generateKs:��,���~�����F�#+�#3�E�4�#@�#@� �D�.�'�/���=�=��D�*��H�T�N�N�N��H�T�N�N�N�N�4�Z�@�@�L�A�q�&��
7���'�#�-��6�
��0�0�0�'/�'7��t�'D�'D�$��n��������!+��
�[���v�
>�
>�
>�	$�$��J�J�t�{�#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$��,�,�,��|�D�M�*�*�2�"�A�
�A�A�t�}�A�A�A����
�
����
�!�����&��"�
��
�
�
�
�
����]�D�&�.�$�
�S������
�I�n�%�%�%��s�C7�7C;�>C;�linec�:�|j�|��dS)zAdds <line> to final output.N)r+�append)r2rWs  rr-zDotBackend.emit�s���
���$�����r�name1�name2�propsc��d�|���D��}t|��t|��}}|�|�d|�dd�t	|�����d���dS)z}Emit an edge from <name1> to <name2>.

        For edge properties: see https://www.graphviz.org/doc/info/attrs.html
        c�$�g|]
\}}|�d|�d���S�z="r'���.0�prop�values   r�
<listcomp>z(DotBackend.emit_edge.<locals>.<listcomp>��-��F�F�F���u�D�$�$�E�$�$�$�F�F�Frz -> � [�, �];N)r0r.r-r1�sorted)r2rZr[r\�attrs�n_from�n_tos       r�	emit_edgezDotBackend.emit_edge�s}��
G�F����
�
�F�F�F��(��/�/�1B�5�1I�1I����	�	�V�E�E��E�E����6�%�=�=�)A�)A�E�E�E�F�F�F�F�FrrPc	���d�|���D��}|�t|���dd�t	|�����d���dS)zzEmit a node with given properties.

        For node properties: see https://www.graphviz.org/doc/info/attrs.html
        c�$�g|]
\}}|�d|�d���Sr_r`ras   rrez(DotBackend.emit_node.<locals>.<listcomp>�rfrrgrhriN)r0r-r.r1rj)r2rPr\rks    r�	emit_nodezDotBackend.emit_node�sd��
G�F����
�
�F�F�F���	�	�&�t�,�,�L�L��	�	�&��-�-�0H�0H�L�L�L�M�M�M�M�Mr)NNNrrN)rrrrrrr rr!rr"rr#r$rr%)rr)NN)r8rr9rrr)rWrrr%)rZrr[rr\rrr%)rPrr\rrr%)�__name__�
__module__�__qualname__�__doc__r4r7�propertyrHrVr-rnrqr`rrrrs���������
#�����26�'�'�'�'�'�B�����X�j�
!�
!�F�DH�=�=�=�=�=�~ � � � �G�G�G�G�N�N�N�N�N�Nrr�nidc��d|�d�S)z)Returns a suitable DOT node id for `nid`.r'r`)rws rr.r.�s���s�:�:�:�r�
graph_dict�dict[str, set[str]]�vertices�list[str] | None�Sequence[list[str]]c��|sdSg}|�!t|�����}|D]!}t|gt��||���"|S)z�Return a list of detected cycles based on an ordered graph (i.e. keys are
    vertices and values are lists of destination vertices representing edges).
    r`)�list�keys�_get_cycles�set)ryr{�result�vertices    r�
get_cyclesr��sd�����r� �F����
���)�)�*�*���<�<���J��C�E�E�6�7�;�;�;�;��Mrr�	list[str]�visited�set[str]r��list[list[str]]r�r%c��||vr�|g}|ddd�D] }||krn|�d|���!t|��}|�|��}||d�|d|�z}||vr|�|��dS|�|��	||D].}||vr(t	|||||��|�|���/n#t$rYnwxYw|���dS)z6Recursive function doing the real work for get_cycles.Nrr)�insert�min�indexrYr��add�KeyError�pop)	ryrr�r�r��cycle�node�
start_fromr�s	         rr�r��sA���$����	�����2��J�	"�	"�D��w������L�L��D�!�!�!�!���Z�Z�
����J�'�'���e�f�f�
��a��g��.�������M�M�%� � � ����K�K�����
��w�'�	"�	"�D��7�"�"��J��g�v�t�D�D�D����D�!�!�!��		"��
�
�
�
���
�����H�H�J�J�J�J�Js�7C�
C#�"C#)rrrr	)rwrrr)N)ryrzr{r|rr})ryrzrr�r�r�r�r�r�rrr%)ru�
__future__rrEr
rIrLrB�collections.abcr�typingrrrr.r�r�r`rr�<module>r�s��
��
#�"�"�"�"�"�
�
�
�
�	�	�	�	�
�
�
�
���������$�$�$�$�$�$�������&�&�&�&�@N�@N�@N�@N�@N�@N�@N�@N�F����CG�
�
�
�
�
� �����r

Hacked By AnonymousFox1.0, Coded By AnonymousFox