Your IP : 18.224.54.118


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

�

��bglJ���dZddlZddlmZddlmZddlmZddlmZddl	m
Z
	ddlZddlmZn#e
$rdd	lmZmZYnwxYwd
Zejdd�ZeddkZed
��ZejejejejhZejfZereejejhzZneejhzZedkreejfz
Zeej ej!hzZerd�Z"d�Z#n
edkrd�Z#nd�Z#Gd�de$��Z%d�Z&d�Z'e%de(fde&d���Z)Gd�de(��Z*gd�Z+dgZ,dgZ-d �Z.Gd!�d"e(��Z/Gd#�d$e)��Z0Gd%�d&e)��Z1Gd'�d(e)��Z2Gd)�d*e)��Z3Gd+�d,e)��Z4d-�Z5d.�Z6dS)/�$Checker of PEP-8 Naming Conventions.�N)�deque��fnmatch)�partial)�chain)�options)�iter_child_nodes)�astr
z0.10.0��)�type�ABCMeta)r�c���g}|D]`}t|tj��r(|�t	|j�����D|�||jf���a|S�N)�
isinstancer�Tuple�extend�_unpack_args�elts�append�id)�args�ret�args   �_/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pep8ext_naming.pyrr&si�����	*�	*�C��#�s�y�)�)�
*��
�
�<���1�1�2�2�2�2��
�
�C���=�)�)�)�)��
�c�4�t|jj��Sr)rr)�nodes r�get_arg_name_tuplesr!/s���D�I�N�+�+�+r�r�c�J�|jj|jjf}d�|D��S)Nc�*�g|]}|D]}||jf���S��r��.0rrs   r�
<listcomp>z'get_arg_name_tuples.<locals>.<listcomp>4�+��B�B�B�4�T�B�B�c��c�g��B�B�B�Br)r�
kwonlyargs�r �groupss  rr!r!2s)���)�.�$�)�"6�7��B�B�6�B�B�B�Brc�`�|jj|jj|jjf}d�|D��S)Nc�*�g|]}|D]}||jf���Sr&r'r(s   rr*z'get_arg_name_tuples.<locals>.<listcomp>8r+r)r�posonlyargsr,r-s  rr!r!6s0���)�'������9M�N��B�B�6�B�B�B�Brc��eZdZd�ZdS)�
_ASTCheckMetac�|�	|j�|����dS#t$rg|_YdSwxYwr)�_checksr�AttributeError)�cls�
class_name�bases�	namespaces    r�__init__z_ASTCheckMeta.__init__<sQ��	��K���s�s�u�u�%�%�%�%�%���	�	�	��C�K�K�K�K�	���s�"&�;�;N)�__name__�
__module__�__qualname__r;r&rrr3r3;s#����������rr3c�t�|j|j}}t|tj��r(t
dkr|t
|j��z
}|dz
}n<t|t��r't
dkr|t
|j��z
}|dz
}t||��}|r
|j
di|��}||dz|�d|��|fS)Nr"���� r&)�lineno�
col_offsetrr�ClassDef�PYTHON_VERSION�len�decorator_list�
FUNC_NODES�getattr�format)�selfr �code�kwargsrDrE�code_strs       r�_errrQCs�����d�o�J�F��$���%�%���F�"�"��c�$�-�.�.�.�F��a��
�
�	�D�*�	%�	%���F�"�"��c�$�-�.�.�.�F��a��
��t�T�"�"�H�
�-�"�8�?�,�,�V�,�,���:��>�d�d�d�H�H�#=�t�C�Crc�:��t�fd�|D����S)Nc3�8�K�|]}t�|��V��dSrr)r)�i�names  �r�	<genexpr>z_ignored.<locals>.<genexpr>Ts-�����0�0�A�w�t�Q���0�0�0�0�0�0r)�any)rU�ignores` r�_ignoredrYSs&����0�0�0�0��0�0�0�0�0�0r�BaseASTCheckzBase for AST Checks.)�__doc__�errc��eZdZdZdZdZdZdS)�
_FunctionType�classmethod�staticmethod�function�methodN)r<r=r>�CLASSMETHOD�STATICMETHOD�FUNCTION�METHODr&rrr^r^[s"�������K�!�L��H�
�F�F�Frr^)�setUp�tearDown�
setUpClass�
tearDownClass�
setUpTestData�failureException�longMessage�maxDiffr_r`c�Z�i}|D]}tj||<�|D]}tj||<�|Sr)r^rcrd)�classmethod_decorators�staticmethod_decorators�decorator_to_type�	decorators    r�_build_decorator_to_typertosR����+�A�A�	�'4�'@��)�$�$�,�B�B�	�'4�'A��)�$�$��rc��eZdZdZdZeZeee	��Z
ee��Z
d�Zed���Zed���Zd�Zd�Zd�Zd	�Zd
�Zed���ZdS)
�
NamingCheckerr�namingc�\�tj|_t��|_||_dSr)rZr5�visitorsr�parents�_node)rM�tree�filenames   rr;zNamingChecker.__init__�s"��$�,��
��w�w�����
�
�
rc
���tj|dtddddd���tj|dtddddd���tj|d	tddddd
���dS)Nz--ignore-names�store�stringTz[List of names or glob patterns the pep8-naming plugin should ignore. (Defaults to %default))�default�actionr�parse_from_config�comma_separated_list�helpz--classmethod-decoratorsz`List of method decorators pep8-naming plugin should consider classmethods (Defaults to %default)z--staticmethod-decoratorszaList of method decorators pep8-naming plugin should consider staticmethods (Defaults to %default))r	�register�_default_ignore_names�_default_classmethod_decorators� _default_staticmethod_decorators)r7�parsers  r�add_optionszNamingChecker.add_options�s������!1�!6� '�&�+/�.2�M�
	N�	N�	N�	N�	���!;�!@� '�&�+/�.2�*�
	+�	+�	+�	+�	���!<�!A� '�&�+/�.2�*�
	+�	+�	+�	+�	+�	+rc�v�t|j��|_t|j|j��|_dSr)�	frozenset�ignore_namesrtrprqrr)r7r	s  r�
parse_optionszNamingChecker.parse_options�s9��$�W�%9�:�:��� 8��*��+�!-�!-����rc�H�|jr|�|j��ndS)Nr&)r{�
visit_tree)rMs r�runzNamingChecker.run�s"��.2�j�@�t���t�z�*�*�*�b�@rc#�K�|�|��D]}|V��|j�|��t|��D]}|�|��D]}|V���|j���dSr)�
visit_noderzrr
r��pop)rMr �error�childs    rr�zNamingChecker.visit_tree�s������_�_�T�*�*�	�	�E��K�K�K�K�����D�!�!�!�%�d�+�+�	�	�E�����/�/�
�
�������
���������rc#�K�t|tj��r|�|��n*t|t��r|�|��d|jj���z}|j	}|j
}|jD]*}t||d��}|��||||��D]}|V���+dS)N�visit_)
rrrF�tag_class_functionsrJ�find_global_defs�	__class__r<�lowerrzr�ryrK)rMr rbrzr��visitor�visitor_methodr�s        rr�zNamingChecker.visit_node�s������d�C�L�)�)�	(��$�$�T�*�*�*�*�
��j�
)�
)�	(��!�!�$�'�'�'��D�N�3�9�9�;�;�;���,���(���}�	�	�G�$�W�f�d�;�;�N��%��'���g�|�D�D�
�
�������
�		�	rc��i}t|��D]�}t|tj��rCt|jtj��r$t|jjtj��s�`|jjj}||j	vr�{t|jj��dko|jjd}t|tj��r|j	|||j<��td�|j
D��d�|j
D����}td�|D����}|�t|��||��dS)z>Tag functions if they are methods, classmethods, staticmethodsrBrc3�XK�|]%}t|tj���|jV��&dSr)rr�Namer�r)�bs  rrVz4NamingChecker.tag_class_functions.<locals>.<genexpr>�s5����E�E�a�Z��3�8�-D�-D�E�Q�T�E�E�E�E�E�Erc3�XK�|]%}t|tj���|jV��&dSr)rr�	Attribute�attrr�s  rrVz4NamingChecker.tag_class_functions.<locals>.<genexpr>�s5����L�L��z�!�S�]�/K�/K�L�Q�V�L�L�L�L�L�Lrc3�,K�|]}|tv�|V��dSr)�METACLASS_BASES)r)rUs  rrVz4NamingChecker.tag_class_functions.<locals>.<genexpr>�s,����L�L�4�D�O�4K�4K�$�4K�4K�4K�4K�L�LrN)r
rr�Assign�value�Call�funcr�rrrrHrrr9rW�set_function_nodes_types)rM�cls_node�late_decorationr �	func_name�methr9�ismetaclasss        rr�z!NamingChecker.tag_class_functions�s_����$�X�.�.�
	M�
	M�D��t�S�Z�0�0�
��t�z�3�8�4�4�
��t�z����9�9�
���
��*�I��� 6�6�6����
��(�(�A�-�D�$�*�/�!�2D�D��$���)�)�
M�+/�+A�)�+L����(��
�E�E�8�>�E�E�E�L�L�X�^�L�L�L�
�
���L�L�5�L�L�L�L�L���%�%��X�&�&��_�	F�	F�	F�	F�	Frc���|D]�}t|��tvr$��t|��||��t	|t
��s�Rtj|_|j	dvs|rtj
|_|j	|vr||j	|_��|jr"�fd�|jD��}|r
|d|_��dS)N)�__new__�__init_subclass__c���g|]<}t|tj��r |j�jv�*�j|j��=Sr&)rrr�rrr)r)�drMs  �rr*z:NamingChecker.set_function_nodes_types.<locals>.<listcomp>�sU���9�9�9��&�q�#�(�3�3�9����!7�7�7��/���5�8�7�7rr)r�METHOD_CONTAINER_NODESr�r
rrJr^rf�
function_typerUrcrI)rM�nodesr�r�r �namess`     rr�z&NamingChecker.set_function_nodes_types�s����	2�	2�D��D�z�z�3�3�3��-�-�$�T�*�*�K��J�J�J��d�J�/�/�
��!.�!5�D���y�<�<�<��<�%2�%>��"��y�O�+�+�%4�T�Y�%?��"�"��$�
2�9�9�9�9�"&�"5�9�9�9���2�).�q��D�&��#	2�	2rc��t��}tt|����}|r�|���}t	|t
j��r|�|j��t	|t
j	ftz��s"|�t|����|��||_dSr)
�setrr
r�rr�Global�updater�rFrJr�global_names)�
func_def_noder��nodes_to_checkr s    rr�zNamingChecker.find_global_defs�s����u�u���/�
�>�>�?�?���	>�!�%�%�'�'�D��$��
�+�+�
0��#�#�D�J�/�/�/��d�S�\�O�j�$@�A�A�
>��%�%�&6�t�&<�&<�=�=�=�
�	>�&2�
�"�"�"rN)r<r=r>r[rU�__version__�versionrtr�r�rrr�r�r�r;r_r�r�r�r�r�r�r�r`r�r&rrrvrvxs������.�.��D��G�0�0�'�)I�K�K���9�2�3�3�L����
�+�+��[�+�<�-�-��[�-�A�A�A������� F�F�F�:2�2�2�*�
2�
2��\�
2�
2�
2rrvc��eZdZdZdZdd�ZdS)�ClassNameCheckz�
    Almost without exception, class names use the CapWords convention.

    Classes for internal use have a leading underscore in addition.
    z2class name '{name}' should use CapWords conventionNc#��K�|j}t||��rdS|�d��}|dd����rd|vr|�|d|���V�dSdS)N�_rB�N801�rU)rUrY�strip�isupperr\)rMr rzrXrUs     r�visit_classdefzClassNameCheck.visit_classdefs������y���D�&�!�!�	��F��z�z�#�����B�Q�B�x���!�!�	4�S�D�[�[��(�(�4��d�(�3�3�3�3�3�3�3�&1�[rr)r<r=r>r[r�r�r&rrr�r�s:��������
@�D�4�4�4�4�4�4rr�c�&�eZdZdZdZdZdd�ZeZdS)�FunctionNameCheckaV
    Function names should be lowercase, with words separated by underscores
    as necessary to improve readability.

    Functions *not* being methods '__' in front and back are not allowed.

    mixedCase is allowed only in contexts where that's already the
    prevailing style (e.g. threading.py), to retain backwards compatibility.
    z*function name '{name}' should be lowercasez9function name '{name}' should not start and end with '__'Nc#�zK�t|dtj��}|j}t	||��rdS|dvrdS|���|kr|�|d|���V�|tjkr8|dd�dkr,|dd�dkr |�|d|���V�dSdSdSdS)	Nr�)�__dir__�__getattr__�N802r�r
�__����N807)rKr^rerUrYr�r\)rMr rzrXr�rUs      r�visit_functiondefz#FunctionNameCheck.visit_functiondef%s�������o�}�7M�N�N�
��y���D�&�!�!�	��F��-�-�-��F��:�:�<�<�4����(�(�4��d�(�3�3�3�3�3��]�3�3�3���!��H��$�$��b�c�c��d�):�):��(�(�4��d�(�3�3�3�3�3�3�3�
4�3�$�$�):�):rr)r<r=r>r[r�r�r��visit_asyncfunctiondefr&rrr�r�sB��������8�D�F�D�4�4�4�4�/���rr�c�*�eZdZdZdZdZdZdd�ZeZdS)�FunctionArgNamesCheckz�
    The argument names of a function should be lowercase, with words separated
    by underscores.

    A classmethod should have 'cls' as first argument.
    A method should have 'self' as first argument.
    z*argument name '{name}' should be lowercasez5first argument of a classmethod should be named 'cls'z1first argument of a method should be named 'self'Nc#��K��fd�}|�jj��|�jj��fD]M\}}|�t||��r�|���|kr|�|d|���V�dS�Nt
���}|sdS|d\}}	t�dtj	��}
|
tj
kr/|	dkr(t|	|��s|�|d��V�n>|
tjkr.|	dkr(t|	|��s|�|d	��V�|D]J\}}|���|kr-t||��s|�|d|���V�dS�KdS)
Nc�@��	||jfS#t$r�|fcYSwxYwr)rr6)rr s �r�arg_namez9FunctionArgNamesCheck.visit_functiondef.<locals>.arg_nameCs?���
!��C�G�|�#��!�
!�
!�
!��S�y� � � �
!���s����N803r�rr�rM�N805r7�N804)r�vararg�kwargrYr�r\r!rKr^rerfrc)rMr rzrXr�rrU�arg_name_tuples�arg0�name0r�s `         rr�z'FunctionArgNamesCheck.visit_functiondefAs������	!�	!�	!�	!�	!�"��$�)�"2�3�3�X�X�d�i�o�5N�5N�N�	�	�I�C���|�x��f�5�5�|���z�z�|�|�t�#�#��h�h�s�F��h�6�6�6�6�6����$�.�d�3�3���	��F�%�a�(���e���o�}�7M�N�N�
��M�0�0�0�����x��v�'>�'>���h�h�t�V�,�,�,�,�,��
�m�7�
7�
7���~�~�h�u�f�&=�&=�~��h�h�t�V�,�,�,�,�,�(�	�	�I�C���z�z�|�|�t�#�#�H�T�6�,B�,B�#��h�h�s�F��h�6�6�6�6�6�����	�	rr)	r<r=r>r[r�r�r�r�r�r&rrr�r�5sH��������8�D�B�D�>�D�����@/���rr�c�2�eZdZdZdZdZdZdZdZd	d�Z	e	Z
dS)
�
ImportAsCheckz:
    Don't change the naming convention via an import
    z5constant '{name}' imported as non constant '{asname}'z7lowercase '{name}' imported as non lowercase '{asname}'z3camelcase '{name}' imported as lowercase '{asname}'z2camelcase '{name}' imported as constant '{asname}'z1camelcase '{name}' imported as acronym '{asname}'Nc#�\K�|jD�] }|j}|s�
|j}||d�}|���r&|���s|j|dfi|��V��S|���r*|���|kr|j|dfi|��V���|���r|j|dfi|��V���|���rUd�ttj|����|kr|j|dfi|��V���|j|dfi|��V���"dS)N)rU�asname�N811�N812�N813��N817�N814)
r�r�rUr�r\�islowerr��join�filter�str)rMr rzrXrUr��
original_name�
err_kwargss        r�visit_importfromzImportAsCheck.visit_importfromns������J�	?�	?�D��[�F��
�� �I�M�"/�6�B�B�J��$�$�&�&�
?��~�~�'�'�?�"�$�(�4��>�>�:�>�>�>�>�>���&�&�(�(�	
?��<�<�>�>�V�+�+�"�$�(�4��>�>�:�>�>�>�>�>�����!�!�
?��d�h�t�V�:�:�z�:�:�:�:�:�:����!�!�
?��7�7�6�#�+�}�=�=�>�>�&�H�H�"�$�(�4��>�>�:�>�>�>�>�>�>�"�$�(�4��>�>�:�>�>�>�>�>��%	?�	?rr)r<r=r>r[r�r�r�r�r�r��visit_importr&rrr�r�dsO��������C�D�D�D�@�D�?�D�>�D�?�?�?�?�*$�L�L�Lrr�c��eZdZdZdZdZdZd�Zed���Z	dd�Z
d	�ZeZd
�Z
e
Zd�ZeZd�Zd
�ZexZxZZed���Zed���Zed���ZdS)�VariablesCheckzO
    Class attributes and local variables in functions should be lowercase
    z1variable '{name}' in function should be lowercasez8variable '{name}' in class scope should not be mixedCasez9variable '{name}' in global scope should not be mixedCasec#�nK�t|��D]Q}t|tj��r	|j}n4t|t
��rt
|j|��}n�R|j}t|��D]:}t||��r�||��}|r|�|||���V��;dS)Nr�)�reversedrrrF�class_variable_checkrJr�function_variable_check�global_variable_check�_extract_namesrYr\)rM�assignment_targetrzrX�parent_func�checkerrU�
error_codes        r�_find_errorszVariablesCheck._find_errors�s�����#�G�,�,�	1�	1�K��+�s�|�4�4�
��3�����+�z�2�2�
�!�$�">��L�L����
��0�G�"�#4�5�5�	I�	I�D���f�%�%�
�� �����J��
I��h�h�0�*�4�h�H�H�H�H�H��	I�	Irc��t|tj��rct|jtj��r|jjdkrdSn1t|jtj��r|jjdkrdSdS)N�
namedtupleTF)rrr�r�r�r�r�r)�
node_values r�is_namedtupezVariablesCheck.is_namedtupe�sv���j�#�(�+�+�	 ��*�/�3�=�9�9�
 ��?�'�<�7�7��4�8��J�O�S�X�6�6�
 ��?�%��5�5��4��urNc#�K�|�|j��rdS|jD] }|�|||��D]}|V���!dSr)r	r��targetsr)rMr rzrX�targetr�s      r�visit_assignzVariablesCheck.visit_assign�so�������T�Z�(�(�	��F��l�	�	�F��*�*�6�7�F�C�C�
�
�������
�	�	rc#�K�|�|j��rdS|�|j||��D]}|V��dSr)r	r�rr�rMr rzrXr�s     r�visit_namedexprzVariablesCheck.visit_namedexpr�s[�������T�Z�(�(�	��F��&�&�t�{�G�V�D�D�	�	�E��K�K�K�K�	�	rc#�K�tr%|�|j||��D]}|V��dS|jD]%}|�|j||��D]}|V���&dSr)�PY2r�
optional_vars�items)rMr rzrXr��items      r�
visit_withzVariablesCheck.visit_with�s������	��*�*��&���9�9�
�
��������F��J�	�	�D��*�*��&���9�9�
�
�������
�	�	rc#�PK�|�|j||��D]}|V��dSr)rrrs     r�	visit_forzVariablesCheck.visit_for�s>�����&�&�t�{�G�V�D�D�	�	�E��K�K�K�K�	�	rc#�XK�|jr|�|||��D]}|V��dSdSr)rUrrs     r�visit_excepthandlerz"VariablesCheck.visit_excepthandler�sP�����9�	��*�*�4��&�A�A�
�
�������	�	�
�
rc#�dK�|jD]%}|�|j||��D]}|V���&dSr)�
generatorsrr)rMr rzrX�genr�s      r�visit_generatorexpz!VariablesCheck.visit_generatorexp�sT�����?�	�	�C��*�*�3�:�w��G�G�
�
�������
�	�	rc�(�t|��rdSdS)N�N816��
is_mixed_caser�s rr�z$VariablesCheck.global_variable_check��!������	��6�	�	rc�(�t|��rdSdS)N�N815r!r�s rr�z#VariablesCheck.class_variable_check�r#rc�P�||jvrdS|���|krdSdS)N�N806)r�r�)r��var_names  rr�z&VariablesCheck.function_variable_check�s4���t�(�(�(��4��>�>���x�'�'��4��vrr)r<r=r>r[r'r%r rr`r	r
r�visit_annassignr�visit_asyncwithr�visit_asyncforrr�visit_listcomp�visit_dictcomp�
visit_setcompr�r�r�r&rrr�r��s1��������?�D�E�D�F�D�I�I�I�"����\���������&�O�	�	�	�!�O�����N����
���
7I�H�N�H�^�m�����\������\������\���rr�c#��K�t|��}|tjur|jV�dS|tjtjfvr�|jD]�}t|��}|tjur
|jV��)|tjtjfvrt|��D]}|V���Zts)|tj	urt|j
��D]}|V����dS|tjur�trxt|j
tj��r|j
jD]}|jV��dSt|j
tj��r|j
jV�dS|j
jV�dS|j
V�dSdS)zYield assignment_target ids.N)rrr�rr�Listrrr�Starredr��
ExceptHandlerrrUr�r�)r�target_type�element�element_type�nrUs      rrr�s������(�)�)�K��c�h����"�"�"�"�"�"�	���C�H�-�	-�	-�(�-�		�		�G���=�=�L��s�x�'�'��j� � � � ��#�)�S�X�!6�6�6�'��0�0���A��G�G�G�G���
�\�S�[�8�8�'��
�6�6���A��G�G�G�G��		�		�
��)�	)�	)��	)��+�0�#�)�<�<�
0�-�2�7�"�"�D��'�M�M�M�M�"�"��-�2�C�M�B�B�
0�(�,�1�1�1�1�1�1�'�,�/�/�/�/�/�/�#�(�(�(�(�(�(�
*�	)rc��|���|ko.|�d��dd����S)Nr�rB)r��lstripr�r�s rr"r"s;���:�:�<�<�4��B�D�K�K��$4�$4�R�a�R�$8�$@�$@�$B�$B�Br)7r[�sys�collectionsrr�	functoolsr�	itertoolsr�flake8_polyfillr	rr
�ImportError�flake8.utilr��version_inforGrr�r��If�While�For�Withr��FunctionDefrJ�	TryExcept�
TryFinally�Try�AsyncFunctionDef�	AsyncWith�AsyncForrr!rr3rQrY�objectrZr^r�r�r�rtrvr�r�r�r�r�rr"r&rr�<module>rMs���*�*�
�
�
�
�������������������������#�#�#�#�#�#�2��J�J�J�$�$�$�$�$�$�$���2�2�2�1�1�1�1�1�1�1�1�1�1�2�������!�"�1�"�%���Q��1����)�/�0�0���&�#�)�S�W�c�h�?���o�
�
��(��s�}�c�n�=�=����s�w�i�'���F����3�'�)�)�J��s�}�c�l�;�;���C����,�,�,�,��f���C�C�C�C�C�C�C�
�����D����
D�
D�
D� 1�1�1��}�^�f�Y�)?��M�M�O�O�������F��������$1�/��$2�#3� ����L2�L2�L2�L2�L2�F�L2�L2�L2�^4�4�4�4�4�\�4�4�4�"/�/�/�/�/��/�/�/�:,/�,/�,/�,/�,/�L�,/�,/�,/�^$�$�$�$�$�L�$�$�$�Db�b�b�b�b�\�b�b�b�J)�)�)�@C�C�C�C�Cs�
1�
A�A

?>