Hacked By AnonymousFox

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

�

�܋f�3���ddlmZ	ddlZddlZdZn#e$r	ddlZdZYnwxYwddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZm Z m!Z!dd	l"m#Z#dd
l$m%Z%ej&dkrddlm'Z'nddl(m'Z'erdd
l)m*Z*ddl+m,Z,dZ-e'dZ.e'dZ/e'dZ0e'dZ1e'dZ2e'dZ3ee.e/e0e1e2e3fZ4ede5e6ee7ee7eee7ee6df��Z8e-dfdwd�Z9gd �Z:dxd$�Z;dyd'�Z<dzd+�Z=d{d.�Z>	d|d}d4�Z?	d~dd<�Z@d�d?�ZAd�dD�ZBe	d�d�dL���ZCe	d�d�dO���ZCe	d�d�dS���ZCe	d�d�dW���ZCe	d�d�d[���ZCe	d�d�d_���ZC	d|d�dc�ZCd�d�dg�ZDd�dh�ZEd�dl�ZFd�dm�ZGd�dq�ZH	d|d�ds�ZId�dt�ZJGdu�dv��ZKdS)��)�annotationsNTF)�Sequence)�BufferedReader�BytesIO)	�
TYPE_CHECKING�Any�List�Pattern�TextIO�Tuple�TypeVar�Union�overload)�Module�modutils�nodes)�PY_EXTS)�
OptionDict)��)�Literal)�BaseChecker)�PyLinter�O)zsuggestion-modezanalyse-fallback-blockszallow-global-unused-variables)zmax-line-lengthzdocstring-min-lengthzignored-modules)zno-docstring-rgxzdummy-variables-rgxzignored-argument-nameszmixin-class-rgx)zexclude-too-few-public-methodszignore-paths�
py-version�T_GlobalOptionReturnTypes.��text�str�line_len�int�indent�returnc�X�d�tj||||�����S)z'Wrap the text on the given line length.�
)�width�initial_indent�subsequent_indent)�join�textwrap�wrap)rr r"s   �c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/utils/utils.py�normalize_textr-Zs7���9�9��
����6�	
�	
�	
����)�=�-�+�a�int | float�bc��||k||kz
S�N�)r2r4s  r,�cmpr8is��
��E�a�!�e��r.�old�newc�t�t||z
��}tt||���|r|d�pd��}|S)zUGiven an old and new int value, return a string representing the
    difference.
    z.2fr)�abs�CMPSr8)r9r:�diff�diff_strs    r,�diff_stringr@msC���s�S�y�>�>�D��s�3��}�}�%�E�t�'=�4�
�
�'C��E�E�H��Or.�node�nodes.NodeNG�tuple[str, str]c�p�|�d���}dg}}|rpt|t��r|j}n$|�t|dd����	|j�d���}n#t$rYnwxYw|�p|���|d�	|��fS)z6Return the module name and the frame id in the module.T)�futurer�namez<lambda>�.)
�frame�
isinstancerrF�append�getattr�parent�AttributeError�reverser))rArH�module�objs    r,�get_module_and_frameidrQvs����J�J�d�J�#�#�E��b�C�F�
���e�V�$�$�	;��Z�F�F��J�J�w�u�f�j�9�9�:�:�:�	��L�&�&�d�&�3�3�E�E���	�	�	��E�	�������K�K�M�M�M��3�8�8�C�=�=� � s�A;�;
B�B�title�	characterc�2�|�d|t|��z�d�S)zgPermit to get a title formatted as ReStructuredText test (underlined with a
    chosen character).
    r%)�len)rRrSs  r,�
get_rst_titlerV�s&���1�1�y�3�u�:�:�-�1�1�1�1r.�section�
str | None�options�!list[tuple[str, OptionDict, Any]]�docc��d}|r|t|d��z
}|rt|��}||�d�z
}|D]�\}}}|�d��}|d|�d�z
}|r0t|t��sJ�t|d���}	||	�d	�z
}|r@|d
kr:t	t||����}|d|�dd
���d�z
}��|S)zHFormat an option's section using as a ReStructuredText formatted output.r�'z

�help�:z:
z  �r"r%rz
  Default: ``z`` z```` ``z``
)rVr-�getrIr�_format_option_value�replace)
rWrYr[�result�
formatted_doc�optname�optdict�value�help_opt�formatted_helps
          r,�get_rst_sectionrk�s$���F��.��-���-�-�-��
�)�&�s�+�+�
��]�(�(�(�(��#*�	N�	N����%��;�;�v�&�&���"�g�"�"�"�"���	,��h��,�,�,�,�,�+�H�T�B�B�B�N���+�+�+�+�F��	N�W��,�,��,�W�e�<�<�=�=�E��M��
�
�e�Y�(G�(G�M�M�M�M�F���Mr.�strict�stream�BufferedReader | BytesIO�encoding�errors�Literal['strict']�codecs.StreamReaderc���	tj|ptj����}n5#t$r(tjtj����}YnwxYw|||��Sr6)�codecs�	getreader�sys�getdefaultencoding�LookupError)rmrorp�
reader_clss    r,�decoding_streamrz�sv��
@��%�h�&J�#�2H�2J�2J�K�K�
�
���@�@�@��%�c�&<�&>�&>�?�?�
�
�
�@�����:�f�f�%�%�%s�'*�/A�A�nodes.Module�list[tokenize.TokenInfo]c��|���5}|j}ttj|����cddd��S#1swxYwYdSr6)rm�readline�list�tokenize)rArmr~s   r,�tokenize_moduler��s���	
�����1�&��?���H�%�h�/�/�0�0�1�1�1�1�1�1�1�1�1�1�1�1����1�1�1�1�1�1s�(A
�
A�A�linterr�	directory�Nonec��i}tj|��D�]5}tj�|��\}}||vs|dkr�0|tvr|dksT|s�tj�tj�||����r�|�d��s�	tj	tj�||����}t|d��r|�|��d||<��#t$rY��t$r,}td|�d|��tj���Yd	}~��-d	}~wwxYw��7d	S)
z�Load all module and package in the given directory, looking for a
    'register' function in each one, used to register pylint checkers.
    �__pycache__�__init__rG�register�zProblem importing module z: ��fileN)�os�listdir�path�splitextr�isdirr)�
startswithr�load_module_from_file�hasattrr��
ValueError�ImportError�printrv�stderr)r�r��imported�filename�base�	extensionrO�excs        r,�register_pluginsr��s����H��J�y�)�)�'�'���'�*�*�8�4�4���i��8���t�}�4�4���� � ��
�"�"��#��G�M�M�"�'�,�,�y�$�"?�"?�@�@�#�!�+�+�C�0�0�	#�
'�!�7��G�L�L��H�5�5�����6�:�.�.�'��O�O�F�+�+�+�%&�H�T�N����
�
�
����
V�
V�
V��C�(�C�C�c�C�C�#�*�U�U�U�U�U�U�U�U�U�����
V�����)'�'s�+2D�
E	�	E	�!E�E	�checkerr�option�GLOBAL_OPTION_BOOL�default�bool | None�boolc��dSr6r7�r�r�r�s   r,�get_global_optionr���	���Cr.�GLOBAL_OPTION_INT�
int | Nonec��dSr6r7r�s   r,r�r��r�r.�GLOBAL_OPTION_LIST�list[str] | None�	list[str]c��dSr6r7r�s   r,r�r���	���Cr.�GLOBAL_OPTION_PATTERN�Pattern[str] | None�Pattern[str]c��dSr6r7r�s   r,r�r��r�r.�GLOBAL_OPTION_PATTERN_LIST�list[Pattern[str]] | None�list[Pattern[str]]c��dSr6r7r�s   r,r�r��r�r.�GLOBAL_OPTION_TUPLE_INT�tuple[int, ...] | None�tuple[int, ...]c��dSr6r7r�s   r,r�r�r�r.�GLOBAL_OPTION_NAMES� T_GlobalOptionReturnTypes | None�&T_GlobalOptionReturnTypes | None | Anyc��tjdtd���t|jj|�dd����S)aDEPRECATED: Retrieve an option defined by the given *checker* or
    by all known option providers.

    It will look in the list of all options providers
    until the given *option* will be found.
    If the option wasn't found, the *default* value will be returned.
    zkget_global_option has been deprecated. You can use checker.linter.config to get all global options instead.���
stacklevelr0�_)�warnings�warn�DeprecationWarningrKr��configrcr�s   r,r�r�sN��
�M�	C���	�����7�>�(�&�.�.��c�*B�*B�C�C�Cr.�,�string�sepc�@�d�|�|��D��S)a&Return a list of stripped string by splitting the string given as
    argument on `sep` (',' by default), empty strings are discarded.

    >>> _splitstrip('a, b, c   ,  4,,')
    ['a', 'b', 'c', '4']
    >>> _splitstrip('a')
    ['a']
    >>> _splitstrip('a,
b,
c,')
    ['a', 'b', 'c']

    :type string: str or unicode
    :param string: a csv line

    :type sep: str or unicode
    :param sep: field separator, default to the comma (',')

    :rtype: str or unicode
    :return: the unquoted string (or the input string if it wasn't quoted)
    c�^�g|]*}|����|�����+Sr7��strip)�.0�words  r,�
<listcomp>z_splitstrip.<locals>.<listcomp>5s-��G�G�G�T�$�*�*�,�,�G�D�J�J�L�L�G�G�Gr.)�split)r�r�s  r,�_splitstripr�!s%��(H�G�V�\�\�#�%6�%6�G�G�G�Gr.c�^�|s|S|ddvr
|dd�}|ddvr
|dd�}|S)z�Remove optional quotes (simple or double) from the string.

    :param string: an optionally quoted string
    :return: the unquoted string (or the input string if it wasn't quoted)
    rz"'r�N���r7)r�s r,�_unquoter�8sN�����
�
�a�y�E���������
�b�z�U����������Mr.rh�list[str] | tuple[str] | str�
Sequence[str]c�\�t|ttf��r|St|��Sr6)rIr�tupler�)rhs r,�
_check_csvr�Gs+���%�$���'�'�����u���r.c�x�d�|���D��}d}d|�d��|��zS)zReturn string as a comment.c�6�g|]}|�����Sr7r�)r��lines  r,r�z_comment.<locals>.<listcomp>Os ��:�:�:�d�T�Z�Z�\�\�:�:�:r.r%�# )�
splitlinesr))r��linesr�s   r,�_commentr�MsC��:�:�f�&7�&7�&9�&9�:�:�:�E�
�C��S�*�*�*�/�/�%�(�(�(�(r.rgrrc�n����dd��dkr d�d�|D����}n�t|ttf��r"d��fd�|D����}n�t|t
��r2d�d�|���D����}ngt|d	��r|j}nO��d��d
kr|rdnd}n/t|t��r|�
��rd
|�d
�}t|��S)zfReturn the user input's value from a 'compiled' value.

    TODO: 3.0: Remove deprecated function
    �typeN�
py_versionrGc3�4K�|]}t|��V��dSr6)r)r��items  r,�	<genexpr>z'_format_option_value.<locals>.<genexpr>Zs(����5�5�t��T���5�5�5�5�5�5r.r�c3�8�K�|]}t�|��V��dSr6)rb)r�r�rgs  �r,r�z'_format_option_value.<locals>.<genexpr>\s.�����O�O��-�g�t�<�<�O�O�O�O�O�Or.c3�*K�|]\}}|�d|��V��dS)r_Nr7)r��k�vs   r,r�z'_format_option_value.<locals>.<genexpr>^s0����>�>���1�A������>�>�>�>�>�>r.�match�yn�yes�nor])rar)rIrr��dict�itemsr��patternr�isspace)rgrhs` r,rbrbTs6���
�{�{�6�4� � �L�0�0����5�5�u�5�5�5�5�5���	�E�D�%�=�	)�	)�
����O�O�O�O��O�O�O�O�O���	�E�4�	 �	 �����>�>����
�
�>�>�>�>�>���	���	 �	 ���
���	���V�	�	��	$�	$��(���D���	�E�3�	�	��E�M�M�O�O���E������u�:�:�r.rc�V�tjdtd���|rtt	|��|���td|�d�|���tj��5tjdt���t||��d	d	d	��d	S#1swxYwYd	S)
z0Format an option's section using the INI format.zEformat_section has been deprecated. It will be removed in pylint 3.0.r�r�r��[�]�ignore)�categoryN)r�r�r�r�r��catch_warnings�filterwarnings�_ini_format)rmrWrYr[s    r,�format_sectionr�is���
�M�O�������
�*�
�h�s�m�m�&�)�)�)�)�	�.�g�.�.�.�v�&�&�&�&�	�	 �	"�	"�%�%����3E�F�F�F�F��F�G�$�$�$�%�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%�%�%s�%,B�B"�%B"c�P�tjdtd���|D�]�\}}}d|vr(t|dt��sJ�d|dvr�3t||��}|�d��}|rJt|t��sJ�t|d���}t|�	��t||�	��nt|�	��|d
vrtd|�d�|�	����t|���
��}tjd
t|����r^ddt|��zz}|�d�t|���d��D����}|dd�}t|�d|��|�	�����dS)z$Format options using the INI format.zB_ini_format has been deprecated. It will be removed in pylint 3.0.r�r��kwargs�	new_namesr^r�r`r�>r��False�#r/z^([\w-]+,)+[\w-]+$z
 � c3� K�|]	}|dzV��
dS)r�Nr7)r��xs  r,r�z_ini_format.<locals>.<genexpr>�s&����&N�&N�1�q�3�w�&N�&N�&N�&N�&N�&Nr.r�Nr�)r�r�r�rIr�rbrarr-r�r��rer�rUr)r�)rmrYrfrgrhri�	separators       r,r�r�}s����M�L�������
$+�5�5����%��w����g�h�/��6�6�6�6�6��g�h�/�/�/��$�W�e�4�4���;�;�v�&�&���	��h��,�,�,�,�,�%�h�t�<�<�<�H��v������(��(�(�(�(�(��v������%�%�%��.�g�.�.�.�v�.�.�.�.�.���J�J�$�$�&�&�E��x�-�s�5�z�z�:�:�
#�!�C�#�g�,�,�$6�6�	�!���&N�&N��E�
�
�8H�8H��8M�8M�&N�&N�&N�N�N���c�r�c�
���W�&�&�u�&�&�V�4�4�4�4�4�15�5r.c�"�eZdZdZdd�Zdd	�Zd
S)
�IsortDriverzAA wrapper around isort API that changed between versions 4 and 5.r��argparse.Namespacer#r�c���tr2tj�|j|j���|_dStjd|j|j���|_dS)N)�extra_standard_library�known_third_partyr)�
file_contents�known_standard_libraryr
)	�HAS_ISORT_5�isort�settings�Configrr
�
isort5_config�SortImports�
isort4_obj)�selfr�s  r,r�zIsortDriver.__init__�sk���	�!&��!6�!6�
(.�'D�"(�":�
"7�"�"�D����$�/� �'-�'D�"(�":����D�O�O�Or.�packagerc��tr%tj�||j��S|j�|��Sr6)rr�api�place_modulerr)rrs  r,rzIsortDriver.place_module�s<���	G��9�)�)�'�4�3E�F�F�F���+�+�G�4�4�4r.N)r�r
r#r�)rrr#r)�__name__�
__module__�__qualname__�__doc__r�rr7r.r,r	r	�sB������K�K�����$5�5�5�5�5�5r.r	)rrr r!r"rr#r)r2r3r4r3r#r!)r9r3r:r3r#r)rArBr#rC)rRrrSrr#rr6)rWrXrYrZr[rXr#r)rl)rmrnrorrprqr#rr)rAr{r#r|)r�rr�rr#r�).)r�rr�r�r�r�r#r�)r�rr�r�r�r�r#r!)r�rr�r�r�r�r#r�)r�rr�r�r�r�r#r�)r�rr�r�r�r�r#r�)r�rr�r�r�r�r#r�)r�rr�r�r�r�r#r�)r�)r�rr�rr#r�)r�rr#r)rhr�r#r�)rgrrhrr#r)
rmrrWrrYrZr[rXr#r�)rmrrYrZr#r�)L�
__future__r�	isort.apir�isort.settingsrr��argparsertr�rrvr*r�r��collections.abcr�iorr�typingrrr	r
rrr
rr�astroidrrr�pylint.constantsr�
pylint.typingr�version_infor�typing_extensions�pylint.checkers.base_checkerr�pylint.lintr�DEFAULT_LINE_LENGTHr�r�r�r�r�r�r�r�r!rrr-r=r8r@rQrVrkrzr�r�r�r�r�r�r�rbr�r�r	r7r.r,�<module>r/s~��
#�"�"�"�"�"�����������K�K�������L�L�L��K�K�K�����
����
�
�
�
�	�	�	�	�	�	�	�	�
�
�
�
�������������$�$�$�$�$�$�&�&�&�&�&�&�&�&�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�,�+�+�+�+�+�+�+�+�+�$�$�$�$�$�$�$�$�$�$�$�$���v����������)�)�)�)�)�)��%�8�8�8�8�8�8�$�$�$�$�$�$����%���
�E�F���.�/������%�%U�V��!�,�/������������$�G������I��C�L������	�#�s�(�O���� 3�"������������������!�!�!�!�"2�2�2�2�������8!)�	&�	&�	&�	&�	&�1�1�1�1�'�'�'�'�B
�MP�����
���
�KN�����
���
�!$�����
���
�$'�����
���
�*-�����
���
�'*�����
���15�D�D�D�D�D�*H�H�H�H�H�.��������)�)�)�)�����2�	%�%�%�%�%�(5�5�5�5�D5�5�5�5�5�5�5�5�5�5s�
�!�!

Hacked By AnonymousFox1.0, Coded By AnonymousFox