Hacked By AnonymousFox

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

�

�܋f� ��.�dZddlmZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
mZddlZddlmZddlmZe	rEddlmZmZeejgee
ee
eefdffZe
eeeefZdZd-d�Zd.d
�Zejd��Zejd��Zejd��Zd/d�Z d0d�Z!d0d�Z"dZ#dZ$dZ%de#e$ze%ze#e$e%zd�Z&e#e$e%dd�Z'Gd�d��Z(Gd �d!��Z)d1d$�Z*d2d'�Z+d3d)�Z,d.d*�Z-d4d,�Z.dS)5z8Generic classes/functions for pyreverse core/extensions.�)�annotationsN)�
TYPE_CHECKING�Any�Callable�Optional�Tuple�Union)�nodes)�InferenceResult)�ClassDiagram�PackageDiagramz.pyreverserc�return�	list[str]c�Z�g}tj�dd��}|r�tj�|t
��}	t
|d���5}|������}ddd��n#1swxYwYn#t$rYnwxYw|S)z,Read config file and return list of options.�HOME��utf-8)�encodingN)
�os�environ�get�path�join�RCFILE�open�read�split�OSError)�options�home�rcfile�file_handles    �g/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/pyreverse/utils.py�get_default_optionsr$!s����G�
�:�>�>�&�"�%�%�D�������d�F�+�+��	��f�w�/�/�/�
5�;�%�*�*�,�,�2�2�4�4��
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5����	�	�	��D�	�����Ns6�B�'B�B�B�B�B�B�
B(�'B(�Nonec��t��}|���|D]"}tj�d|���#dS)z#Insert default options to sys.argv.�N)r$�reverse�sys�argv�insert)r�args  r#�insert_default_optionsr-/sO��!�#�#�G��O�O����� � �������3����� � �z^__([^\W_]_*)+__$z^__(_*[^\W_])+_?$z^_\w*$�name�strc��t�|��rd}n<t�|��rd}nt�|��rd}nd}|S)zIReturn the visibility from a name: public, protected, private or special.�special�private�	protected�public)�SPECIAL�match�PRIVATE�	PROTECTED)r/�
visibilitys  r#�get_visibilityr;=s`���}�}�T�����
�
�	���t�	�	���
�
�	����	�	�� �
�
��
��r.�node�nodes.ClassDef�boolc��|jdkS)N�	interface��type�r<s r#�is_interfacerDK����9��#�#r.c��|jdkS)N�	exceptionrArCs r#�is_exceptionrHPrEr.���)�ALL�PUB_ONLYr6�OTHER)r2r4r3r5c�"�eZdZdZdd�Zd
d
�ZdS)�FilterMixInz7Filter nodes according to a mode and nodes' visibility.�moder0rr%c���d}|�d��D]H}	|t|z
}�#t$r(}td|��tj���Yd}~�Ad}~wwxYw||_dS)zInit filter modes.r�+zUnknown filter mode )�fileN)r�MODES�KeyError�printr)�stderr�_FilterMixIn__mode)�selfrQrY�nummod�exs     r#�__init__zFilterMixIn.__init__ks������j�j��o�o�	D�	D�F�
D��%��-�'�����
D�
D�
D��1�R�1�1��
�C�C�C�C�C�C�C�C�C�����
D��������s�,�
A�A�Ar<�nodes.NodeNG | strr>c�j�tt|d|����}|jt|zS)z*Return true if the node should be treated.r/)r;�getattrrY�VIS_MOD)rZr<r:s   r#�	show_attrzFilterMixIn.show_attrus0��#�G�D�&�$�$?�$?�@�@�
��;���!4�4�4�4r.N)rQr0rr%)r<r^rr>)�__name__�
__module__�__qualname__�__doc__r]rb�r.r#rPrPhsB������A�A�����5�5�5�5�5�5r.rPc�*�eZdZdZdd�Zd
d�Zdd
�ZdS)�
LocalsVisitoraVisit a project by traversing the locals dictionary.

    * visit_<class name> on entering a node, where class name is the class of
    the node in lower case

    * leave_<class name> on leaving a node, where class name is the class of
    the node in lower case
    rr%c�:�i|_t��|_dS)N)�_cache�set�_visited)rZs r#r]zLocalsVisitor.__init__�s��AC���+.�5�5��
�
�
r.r<�nodes.NodeNG�_CallbackTupleTc	�2�|j}|j�|��}|�l|j���}t|d|��t|dd����}t|d|��t|dd����}||f|j|<n|\}}||fS)z0Get callbacks from handler for the visited node.N�visit_�
visit_default�leave_�
leave_default)�	__class__rkrrc�lowerr`)rZr<�klass�methods�kid�e_method�l_methods       r#�
get_callbackszLocalsVisitor.get_callbacks�s�������+�/�/�%�(�(���?��.�&�&�(�(�C���n�s�n�n�g�d�O�T�&J�&J���H���n�s�n�n�g�d�O�T�&J�&J���H�#+�H�!5�D�K����!(��H�h���!�!r.rc�V�||jvrdS|j�|��|�|��}|d�|d|��t|d��r,|���D]}|�|���|d�|d|��SdS)z.Launch the visit starting from the given node.Nr�localsr')rm�addr|�hasattr�values�visit)rZr<rx�
local_nodes    r#r�zLocalsVisitor.visit�s����4�=� � ��4��
���$�����$�$�T�*�*���1�:�!��G�A�J�t�����4��"�"�	'�"�k�k�m�m�
'�
'�
��
�
�:�&�&�&�&��1�:�!��7�1�:�d�#�#�#��tr.N�rr%)r<rnrro)r<rnrr)rcrdrerfr]r|r�rgr.r#riri{sZ��������1�1�1�1�"�"�"�"�"�����r.ri�ann�nodes.Name | nodes.NodeNGc��t|tj��r|j�|jSt|tj��r|���SdS)Nr)�
isinstancer
�Namer/�NodeNG�	as_string)r�s r#�get_annotation_labelr��sK���#�u�z�"�"��s�x�';��x���#�u�|�$�$���}�}����
�2r.�#nodes.AssignAttr | nodes.AssignName�#nodes.Name | nodes.Subscript | Nonec�Z�d}t|jtj��r
|jj}n�t|tj��ri|jj}	t
t|j|j	j
����}|j|jjj
��}n#t$rYnwxYw|S	|���^}}n#t j$rd}YnwxYwt%|��}|r.t'|dd���|�d��sd|�d�n|}|r||_
|S)z!Return the annotation for `node`.Nr�valuerz	Optional[�])r��parentr
�	AnnAssign�
annotation�
AssignAttr�dict�zipr~�argsrrr�r/�AttributeError�infer�astroid�InferenceErrorr�r`�
startswith)r<r��init_methodr�default�_�labels       r#�get_annotationr��sd���C��$�+�u��/�/�
��k�$���	�D�%�*�	+�	+���k�(��	��s�;�#5�{�7G�7S�T�T�U�U�K�!�+�/�$�+�"3�"8�9�9�C�C���	�	�	��D�	�����
���j�j�l�l���!�!���!������������
!��%�%�E�
�
��w���1�1�9��$�$�Z�0�0�:�
"��!�!�!�!��		�
������Js%�AB"�"
B/�.B/�5C�C �C �set[InferenceResult]c�~�t|��}	|rct|tj��s%t|tj��r|jdkr|hSt
|�����St
|�����S#tj	$r|r|hn
t
��cYSwxYw)z�Return a set containing the node annotation if it exists
    otherwise return a set of the inferred types using the NodeNG.infer method.
    �|)
r�r�r
�	Subscript�BinOp�oprlr�r�r�)r<r�s  r#�
infer_noder��s���
��
�
�C�	'��	$��#�u��/�/�
��3���,�,�
�14��3����u���s�y�y�{�{�#�#�#��4�:�:�<�<� � � ���!�'�'�'��&��u�u����&�&�&�'���s�AB� B�6 B�"B<�;B<c�x�tjd���%td��tjd��dSdS)z�Check if the ``dot`` command is available on the machine.

    This is needed if image output is desired and ``dot`` is used to convert
    from *.dot or *.gv into the final output format.
    �dotNz?'Graphviz' needs to be installed for your chosen output format.� )�shutil�whichrWr)�exitrgr.r#�check_graphviz_availabilityr��s<���|�E���"�
�O�P�P�P���������#�"r.�
output_formatc�f�tjddgddd���}tjd|j������}|st
d	��d
S|�d��}||���vr+t
d|�d
|����tj
d��d
Sd
S)z�Check if the ``dot`` command supports the requested output format.

    This is needed if image output is desired and ``dot`` is used to convert
    from *.gv into the final output format.
    r�z-T?TFr)�capture_output�checkrz$.*Use one of: (?P<formats>(\S*\s?)+))�pattern�stringz�Unable to determine Graphviz supported output formats. Pyreverse will continue, but subsequent error messages regarding the output format may come from Graphviz directly.N�formatszFormat z, is not supported by Graphviz. It supports: r�)�
subprocess�run�rer7rX�striprW�grouprr)r�)r��
dot_outputr7�supported_formatss    r#�!check_if_graphviz_supports_formatr��s�����	���t�5�7����J�
�H�7�� �&�&�(�(�
�
�
�E���
�
K�	
�	
�	
�
	�����I�.�.���-�3�3�5�5�5�5�
�d�m�d�d�Qb�d�d�	
�	
�	
�	��������	6�5r.)rrr�)r/r0rr0)r<r=rr>)r�r�rr0)r<r�rr�)r<r�rr�)r�r0rr%)/rf�
__future__rrr�r�r�r)�typingrrrrrr	r�r
�astroid.typingr�pylint.pyreverse.diagramsrr
r��
_CallbackTrorr$r-�compiler6r8r9r;rDrH�_SPECIAL�
_PROTECTED�_PRIVATErUrarPrir�r�r�r�r�rgr.r#�<module>r�s���
?�>�"�"�"�"�"�"�	�	�	�	�	�	�	�	�
�
�
�
�����
�
�
�
�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�G�����������*�*�*�*�*�*��H�F�F�F�F�F�F�F�F��	���
�e�L�!�5���)E�#F��L�M�	O��J��H�Z�0�(�:�2F�F�G�O�
������ � � � ��"�*�)�
*�
*��
�"�*�)�
*�
*���B�J�y�!�!�	�����$�$�$�$�
$�$�$�$�
��
�
�����:�%��0��
�(�
"�		�	������	���5�5�5�5�5�5�5�5�&-�-�-�-�-�-�-�-�`���� � � � �F'�'�'�'�$���������r.

Hacked By AnonymousFox1.0, Coded By AnonymousFox