HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint/__pycache__/graph.cpython-311.opt-1.pyc
�

�h����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    �A/opt/cloudlinux/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|�d|�d���|���D]*}|�d�|�����+dS)	Nzdigraph z {zrankdir=zratio=zsize="�"z	charset="�=)rr"�lines�_source�emit�normalize_node_id�items�join)	�selfrrrr r!r"r#�params	         r�__init__zDotBackend.__init__ s+���#�!��"��� ��
� "��
�#'����	�	�>�.�y�9�9�>�>�>�?�?�?��	,��I�I�*��*�*�+�+�+��	(��I�I�&�u�&�&�'�'�'��	(��I�I�&�t�&�&�&�'�'�'��	.�
�I�I�,�'�,�,�,�-�-�-�%�+�+�-�-�	'�	'�E��I�I�c�h�h�u�o�o�&�&�&�&�	'�	'rc��|j�6|�d��d�|j��|_|`|jS)zReturns self._source.Nz}
�
)r*r+r.r))r/s 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)r/r5r6�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)r/rTs  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)r-r,r+r.�sorted)r/rWrXrY�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�FrrMc	���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]r^s   rrbz(DotBackend.emit_node.<locals>.<listcomp>�rcrrdrerfN)r-r+r,r.rg)r/rMrYrhs    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)r5rr6rrr)rTrrr%)rWrrXrrYrrr%)rMrrYrrr%)�__name__�
__module__�__qualname__�__doc__r1r4�propertyrErSr+rkrnr]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])rts 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)rvrx�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�indexrVr~�add�KeyError�pop)	rvrr�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	)rtrrr)N)rvrwrxryrrz)rvrwrr�r�r�r�r�r�rrr%)rr�
__future__rrBr
rFrIr?�collections.abcr�typingrrrr,r�r~r]rr�<module>r�s��
��
#�"�"�"�"�"�
�
�
�
�	�	�	�	�
�
�
�
���������$�$�$�$�$�$�������&�&�&�&�@N�@N�@N�@N�@N�@N�@N�@N�F����CG�
�
�
�
�
� �����r