Hacked By AnonymousFox

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

�

�܋f1e���dZddlmZddlZddlmZddlZddlmZddlm	Z	ddlm
Zddlm
Z
dd	lmZdd
lmZerddlmZGd�d
e	��Zdd�ZdS)zHPylint plugin for checking in Sphinx, Google, or Numpy style docstrings.�)�annotationsN)�
TYPE_CHECKING)�nodes)�BaseChecker)�utils)�_check_docs_utils)�	Docstring)�HIGH)�PyLinterc�h�eZdZdZdZddddddd	d
dgifdd
ddd
dgifddddd
dgifdddd
dgifdddddd�Zd d!d"d#d$d%�fd&d!d"d#d'd%�fd(d!d"d#d)d%�fd*d!d"d#d+d%�fd,d-d.d/eej��d0d1�ffZ	d2d3hZ
d4d5hZdad:�ZeZ
dbd=�Zdbd>�Zdbd?�ZdcdA�ZdddC�ZdedE�ZeZdfdN�ZdfdO�ZdgdQ�Z	dhdidY�Zdjd^�Zdkd`�ZdRS)l�DocstringParameterCheckera�Checker for Sphinx, Google, or Numpy style docstrings.

    * Check that all function, method and constructor parameters are mentioned
      in the params and types part of the docstring.  Constructor parameters
      can be documented in either the class docstring or ``__init__`` docstring,
      but not both.
    * Check that there are no naming inconsistencies between the signature and
      the documentation, i.e. also report documented parameters that are missing
      in the signature. This is important to find cases where parameters are
      renamed only in the code, not in the documentation.
    * Check that all explicitly raised exceptions in a function are documented
      in the function docstring. Caught exceptions are ignored.

    Activate this checker by adding the line::

        load-plugins=pylint.extensions.docparams

    to the ``MAIN`` section of your ``.pylintrc``.
    �parameter_documentation)z@"%s" has constructor parameters documented in class and __init__�multiple-constructor-doczAPlease remove parameter declarations in the class or constructor.)z#"%s" not documented as being raised�missing-raises-docz:Please document exceptions for all raised exception types.)zRedundant returns documentation�redundant-returns-docz>Please remove the return/rtype documentation from this method.)zRedundant yields documentation�redundant-yields-docz8Please remove the yields documentation from this method.zMissing return documentation�missing-return-docz8Please add documentation about what this method returns.�	old_names)�W9007zold-missing-returns-doc)z!Missing return type documentation�missing-return-type-docz1Please document the type returned by this method.zMissing yield documentation�missing-yield-docz:Please add documentation about what this generator yields.)�W9009zold-missing-yields-doc)z Missing yield type documentation�missing-yield-type-docz0Please document the type yielded by this method.z'"%s" missing in parameter documentation�missing-param-docz5Please add parameter declarations for all parameters.)�W9003zold-missing-param-docz,"%s" missing in parameter type documentation�missing-type-docz:Please add parameter type declarations for all parameters.)�W9004zold-missing-type-doc)z)"%s" differing in parameter documentation�differing-param-docz-Please check parameter names in declarations.)z."%s" differing in parameter type documentation�differing-type-docz2Please check parameter names in type declarations.)z,"%s" useless ignored parameter documentation�useless-param-docz2Please remove the ignored parameter documentation.)z1"%s" useless ignored parameter type documentation�useless-type-docz7Please remove the ignored parameter type documentation.)z!Missing any documentation in "%s"�missing-any-param-docz/Please add parameter and/or type documentation.)�W9005�W9006�W9008�W9010�W9011�W9012�W9013�W9014�W9015�W9016�W9017�W9018�W9019�W9020�W9021zaccept-no-param-docT�ynz<y or n>zmWhether to accept totally missing parameter documentation in the docstring of a function that has parameters.)�default�type�metavar�helpzaccept-no-raise-doczoWhether to accept totally missing raises documentation in the docstring of a function that raises an exception.zaccept-no-return-doczoWhether to accept totally missing return documentation in the docstring of a function that returns a statement.zaccept-no-yields-doczWWhether to accept totally missing yields documentation in the docstring of a generator.zdefault-docstring-type�choicer3z<docstring type>zRIf the docstring type cannot be guessed the specified docstring type will be used.)r4r3r5�choicesr6�__init__�__new__�self�cls�node�nodes.FunctionDef�return�Nonec��tj|j|jjj��}|jjj}|rtj||j	��rdStj|��|jz
}|jjj
}|dkr||krdS|�||��|�||��|�||��dS)z�Called for function and method definitions (def).

        :param node: Node for a function or method definition in the AST
        :type node: :class:`astroid.scoped_nodes.Function`
        N���)r�docstringify�doc_node�linter�config�default_docstring_type�no_docstring_rgx�re�match�name�
checker_utils�get_node_last_lineno�lineno�docstring_min_length�check_functiondef_params�check_functiondef_returns�check_functiondef_yields)r;r=�node_docrH�lines�	max_liness      �l/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/docparams.py�visit_functiondefz+DocstringParameterChecker.visit_functiondef�s����%��M�4�;�-�D�
�
��
 �;�-�>���	���)9�4�9� E� E�	��F��2�4�8�8�4�;�F���K�&�;�	��r�>�>�e�i�/�/��F��%�%�d�H�5�5�5��&�&�t�X�6�6�6��%�%�d�H�5�5�5�5�5�rSr	c���d}|j|jvr�tj|��}|��t	j|j|jjj	��}|�
|||��|���p|���pd}|���p|���pd}|�
||j||��|�
||j||��dS�N)rK�constructor_namesrL�node_frame_classrrCrDrErFrG�check_single_constructor_params�
has_params�params_documented_elsewhere�check_arguments_in_docstring�args)r;r=rS�node_allow_no_param�
class_node�	class_doc�class_allow_no_params       rVrPz2DocstringParameterChecker.check_functiondef_params�s&��#���9��.�.�.�&�7��=�=�J��%�!�.��'���);�)R���	��4�4�Y��*�U�U�U�
�(�(�*�*�� �<�<�>�>���$��'�'�)�)���;�;�=�=���%��1�1��t�y�*�6J����	
�)�)��d�i��':�	
�	
�	
�	
�	
rXc�j�|js|���s|���rdS|�tj��}|���s|���r:td�|D����s|�	d|t���dSdSdS)Nc3�>K�|]}tj|��V��dSrZ)r�returns_something)�.0�ret_nodes  rV�	<genexpr>zFDocstringParameterChecker.check_functiondef_returns.<locals>.<genexpr>sF����H
�H
�2:�E�#�H�-�-�H
�H
�H
�H
�H
�H
rXr�r=�
confidence)�supports_yields�is_generator�is_abstract�nodes_of_class�astroid�Return�has_returns�	has_rtype�any�add_messager
)r;r=rS�return_nodess    rVrQz3DocstringParameterChecker.check_functiondef_returns�s����(�	�T�->�->�-@�-@�	�T�EU�EU�EW�EW�	��F��*�*�7�>�:�:��� � �"�"�	R�h�&8�&8�&:�&:�	R�C�H
�H
�>J�H
�H
�H
�E
�E
�	R�
���4�4�D��Q�Q�Q�Q�Q�	R�	R�	R�	RrXc���|jr|���rdS|���s|���r/|���s|�d|���dSdSdS)Nr)r=)rnrp�
has_yields�has_yields_typerorw)r;r=rSs   rVrRz2DocstringParameterChecker.check_functiondef_yields	s����'�	�4�+;�+;�+=�+=�	��F�
���!�!�	@�%-�%=�%=�%?�%?�	@��#�#�%�%�	@�
���3�$��?�?�?�?�?�	@�	@�	@�	@rX�nodes.Raisec���|�d���}t|tj��sdS|jjj}|rtj||j	��rdStj|��}|sdS|jstj
|��}|r|}tj|j|jjj��}|jjjr|���sdS|���s+|jr"d�|D��}|�||��dS|���}d�|D��}	t+��}
|D]]}|	D]>��|j	krnJt-�fd�|���D����rn�?|
�|j	���^|�|
|��dS)NT��futurec��h|]	}|j��
S��rK�ri�excs  rV�	<setcomp>z8DocstringParameterChecker.visit_raise.<locals>.<setcomp>3s��=�=�=��3�8�=�=�=rXc�D�h|]}|�d��d��S)�.rB)�splitr�s  rVr�z8DocstringParameterChecker.visit_raise.<locals>.<setcomp>:s'��!V�!V�!V��#�)�)�C�.�.��"4�!V�!V�!VrXc3�.�K�|]}�|jkV��dSrZr�)ri�ancestor�	found_excs  �rVrkz8DocstringParameterChecker.visit_raise.<locals>.<genexpr>As*�����W�W�h�y�H�M�1�W�W�W�W�W�WrX)�frame�
isinstancerr�FunctionDefrErFrHrIrJrKr�possible_exc_typesrD�get_setters_propertyrCrG�accept_no_raise_doc�
exceptions�matching_sections�doc�_add_raise_message�setrv�	ancestors�add)
r;r=�	func_noderH�
expected_excs�	property_r��missing�found_excs_full_names�found_excs_class_names�missing_excs�expectedr�s
            @rV�visit_raisez%DocstringParameterChecker.visit_raises����J�J�d�J�+�+�	��)�W�%8�9�9�	��F� �;�-�>���	���)9�9�>� J� J�	��F��0��6�6�
��	��F��!�	&��2�9�=�=�I��
&�%�	�� ����� 2� I�
�
���;��1�	�#�.�.�:J�:J�	��F��$�$�&�&�	��w�
<�=�=�}�=�=�=���'�'���;�;�;��F� #��� 0� 0��"W�!V�@U�!V�!V�!V���u�u��%�	0�	0�H�3�
0�
0�	���
�-�-��E��W�W�W�W�(�BT�BT�BV�BV�W�W�W�W�W���E��� � ���/�/�/������i�8�8�8�8�8rX�nodes.Returnc��tj|��sdS|jjjrdS|�d���}|jjj}|rtj||j	��rdStj
|j|jjj��}tj|��}|���s3|���r|s|�d|t$���|jrdS|���s5|���r|s!|�d|t$���dSdSdS)NTr~rrlr)rrhrErF�accept_no_return_docr�rHrIrJrKrCrDrGrL�decorated_with_propertyrt�has_property_returnsrwr
�returnsru�has_property_type)r;r=r�rHr��is_propertys      rV�visit_returnz&DocstringParameterChecker.visit_returnHsl���&�t�,�,�	��F��;��2�	��F�)-���4��)@�)@�	� �;�-�>���	���)9�9�>� J� J�	��F�� ����� 2� I�
�
��$�;�I�F�F�����!�!�	T�c�&>�&>�&@�&@�	T�[�	T����1�	�d��S�S�S���	��F��
�
���	Y�C�$9�$9�$;�$;�	Y��	Y����6�Y�SW��X�X�X�X�X�	Y�	Y�	Y�	YrX�nodes.Yield | nodes.YieldFromc�J�|jjjrdS|�d���}|jjj}|rtj||j��rdStj	|j
|jjj��}|jr)|�
��}|���}n(|���}|���}|s|�d|t$���|s&|js!|�d|t$���dSdSdS)NTr~rrlr)rErF�accept_no_yields_docr�rHrIrJrKrrCrDrGrnrzr{rtrurwr
r�)r;r=r�rHr��doc_has_yields�doc_has_yields_types       rV�visit_yieldz%DocstringParameterChecker.visit_yieldesA���;��2�	��F�)-���4��)@�)@�	� �;�-�>���	���)9�9�>� J� J�	��F�� ����� 2� I�
�
����	2� �^�^�-�-�N�"%�"5�"5�"7�"7��� �_�_�.�.�N�"%�-�-�/�/���	S����0�y�T��R�R�R�#�	X�y�'8�	X����5�I�RV��W�W�W�W�W�	X�	X�	X�	XrX�found_argument_names�set[str]�
message_id�str�not_needed_names�expected_argument_names�warning_node�nodes.NodeNGc��||z
|z
}t��}|D]0}|�dd��|vr�|�|���1|rA|�|d�t|����f|t���dSdS)a�Compare the found argument names with the expected ones and
        generate a message if there are arguments missing.

        :param found_argument_names: argument names found in the docstring

        :param message_id: pylint message id

        :param not_needed_names: names that may be omitted

        :param expected_argument_names: Expected argument names

        :param warning_node: The node to be analyzed
        �*��, �rar=rmN�r��replacer�rw�join�sortedr
)	r;r�r�r�r�r�� potential_missing_argument_names�missing_argument_namesrKs	         rV�_compare_missing_argsz/DocstringParameterChecker._compare_missing_args�s���,
$�&:�:��,�(�
"%����4�	-�	-�D��|�|�C��$�$�(<�<�<��"�&�&�t�,�,�,�,�!�	������i�i��'=� >� >�?�?�A�!��	
�
�
�
�
�
�	�	rXc�v�t��}|D]Y}|�dd��|vr*|�|�dd�����D|�|���Z||z|z
|z
}|rA|�|d�t|����f|t���dSdS)a�Compare the found argument names with the expected ones and
        generate a message if there are extra arguments found.

        :param found_argument_names: argument names found in the docstring

        :param message_id: pylint message id

        :param not_needed_names: names that may be omitted

        :param expected_argument_names: Expected argument names

        :param warning_node: The node to be analyzed
        r�r�r�r�Nr�)	r;r�r�r�r�r�� modified_expected_argument_namesrK�differing_argument_namess	         rV�_compare_different_argsz1DocstringParameterChecker._compare_different_args�s���,69�U�U�(�+�	;�	;�D��|�|�C��$�$�(<�<�<�0�4�4�T�\�\�#�r�5J�5J�K�K�K�K�0�4�4�T�:�:�:�:�.�0D�
D��
�%�
&�	!�$�	������i�i��'?� @� @�A�A�C�!��	
�
�
�
�
�
�	�	rX�ignored_argument_namesc��||z}|rA|�|d�t|����f|t���dSdS)aqCompare the found argument names with the ignored ones and
        generate a message if there are ignored arguments found.

        :param found_argument_names: argument names found in the docstring
        :param message_id: pylint message id
        :param ignored_argument_names: Expected argument names
        :param warning_node: The node to be analyzed
        r�r�N)rwr�r�r
)r;r�r�r�r��existing_ignored_argument_namess      rV�_compare_ignored_argsz/DocstringParameterChecker._compare_ignored_args�sn��+A�CW�*W�'�*�	������i�i��'F� G� G�H�H�J�!��	
�
�
�
�
�
�	�	rXNr��arguments_node�astroid.Arguments�astroid.NodeNG�accept_no_param_doc�bool | Nonec���|jsdS|�|jjj}|���}d�|jD��}|�d�|jD����|�d�|jD����|j	�
��}t��}|jjj��r�fd�|D��}|j
�:|�d|j
����|�d|j
����|j�:|�d|j����|�d|j����|���\}	}
|	s|
s|rd}|�|
d	||��t%|j��D],\}}|j|r|
�|j���-t%|j��D],\}}|j|r|
�|j���-t%|j��D],\}}|j|r|
�|j���-|s�||	z
|j	|zz
}
||
z
||zz
}|
|cxkr|kr;nn8t/|��d
kr%|�d|jf|t2���n=|�|	d
|j	|z||��|�|
d||z||��|�|	d|j	||��|�|
d|||��|�|	d||��dS)a;Check that all parameters are consistent with the parameters mentioned
        in the parameter documentation (e.g. the Sphinx tags 'param' and 'type').

        * Undocumented parameters except 'self' are noticed.
        * Undocumented parameter types except for 'self' and the ``*<args>``
          and ``**<kwargs>`` parameters are noticed.
        * Parameters mentioned in the parameter documentation that don't or no
          longer exist in the function parameter list are noticed.
        * If the text "For the parameters, see" or "For the other parameters,
          see" (ignoring additional white-space) is mentioned in the docstring,
          missing parameter documentation is tolerated.
        * If there's no Sphinx style, Google style or NumPy style parameter
          documentation at all, i.e. ``:param`` is never mentioned etc., the
          checker assumes that the parameters are documented in another format
          and the absence is tolerated.

        :param doc: Docstring for the function, method or class.
        :type doc: :class:`Docstring`

        :param arguments_node: Arguments node for the function, method or
            class constructor.
        :type arguments_node: :class:`astroid.scoped_nodes.Arguments`

        :param warning_node: The node to assign the warnings to
        :type warning_node: :class:`astroid.scoped_nodes.Node`

        :param accept_no_param_doc: Whether to allow no parameters to be
            documented. If None then this value is read from the configuration.
        :type accept_no_param_doc: bool or None
        Nc��h|]	}|j��
Sr�r��ri�args  rVr�zIDocstringParameterChecker.check_arguments_in_docstring.<locals>.<setcomp>s��"K�"K�"K��3�8�"K�"K�"KrXc3�$K�|]}|jV��dSrZr�r�s  rVrkzIDocstringParameterChecker.check_arguments_in_docstring.<locals>.<genexpr>s$����&U�&U�C�s�x�&U�&U�&U�&U�&U�&UrXc3�$K�|]}|jV��dSrZr�r�s  rVrkzIDocstringParameterChecker.check_arguments_in_docstring.<locals>.<genexpr> s$����&V�&V�C�s�x�&V�&V�&V�&V�&V�&VrXc�>��h|]}��|���|��Sr�)rJ)rir�r�s  �rVr�zIDocstringParameterChecker.check_arguments_in_docstring.<locals>.<setcomp>&s=���3�3�3��)�/�/��4�4�3��3�3�3rXr�z**Tr!rr"r�rrrrr )r�rErFr�r_ra�update�
kwonlyargs�posonlyargs�not_needed_param_in_docstring�copyr�r��varargr��kwarg�match_param_docsr��	enumeraterrK�kwonlyargs_annotations�posonlyargs_annotations�lenrwr
r�r�)r;r�r�r�r��tolerate_missing_paramsr��not_needed_type_in_docstring�#expected_but_ignored_argument_names�params_with_doc�params_with_type�index�arg_name�missing_param_doc�missing_type_docr�s               @rVr`z6DocstringParameterChecker.check_arguments_in_docstring�sU���N�w�	��F��&�"&�+�"4�"H��"%�"A�"A�"C�"C��#L�"K�~�7J�"K�"K�"K���&�&�&U�&U�>�;T�&U�&U�&U�U�U�U��&�&�&V�&V�>�;U�&V�&V�&V�V�V�V�'+�'I�'N�'N�'P�'P�$�.1�e�e�+�!%��!3�!J��!�	�3�3�3�3�2�3�3�3�/�� �,�#�'�'�(C�N�,A�(C�(C�D�D�D�(�,�,�-H��1F�-H�-H�I�I�I���+�#�'�'�(C�^�-A�(C�(C�D�D�D�(�,�,�-H�.�2F�-H�-H�I�I�I�,/�,@�,@�,B�,B�)��)��	+�'7�	+�<O�	+�&*�#�
	
�"�"���/��		
�	
�	
� )��)<�=�=�	4�	4�O�E�8��)�%�0�
4� �$�$�X�]�3�3�3��(��)B�C�C�	4�	4�O�E�8��4�U�;�
4� �$�$�X�]�3�3�3��(��)C�D�D�	4�	4�O�E�8��5�e�<�
4� �$�$�X�]�3�3�3��&� 	�!8�?�!J��2�5X�X�!��!8�:J� J�,�/R�R� ��"�%<�P�P�P�P�@P�P�P�P�P�P��/�0�0�A�5�5�� � �+�&�+�-�%�#�	!������*�*�#�'��6�9�:�+� �
����*�*�$�&�0�3V�V�+� ����	
�$�$��!��.�#��	
�	
�	
�	
�$�$�� �(�#��	
�	
�	
�	
�"�"���/��		
�	
�	
�	
�	
rXrd�init_docrc�nodes.ClassDefc��|���r:|���r(|�d|jf|t���dSdSdS)Nrr�)r^rwrKr
)r;rdr�rcs    rVr]z9DocstringParameterChecker.check_single_constructor_params�sw�����!�!�	�h�&9�&9�&;�&;�	����*� �o�'���	
�
�
�
�
�
�	�	�	�	rX�missing_exceptionsc��|���r'	|�d��n#t$rYnwxYw|rA|�dd�t|����f|t���dSdS)z�Adds a message on :param:`node` for the missing exception type.

        :param missing_exceptions: A list of missing exception types.
        :param node: The node show the message on.
        �NotImplementedErrorrr�r�N)rp�remove�KeyErrorrwr�r�r
)r;r�r=s   rVr�z,DocstringParameterChecker._add_raise_message�s��������	�
�"�)�)�*?�@�@�@�@���
�
�
���
�����	����$��i�i��'9� :� :�;�;�=���	
�
�
�
�
�
�	�	s�,�
9�9)r=r>r?r@)r=r>rSr	r?r@)r=r|r?r@)r=r�r?r@)r=r�r?r@)r�r�r�r�r�r�r�r�r�r�r?r@)
r�r�r�r�r�r�r�r�r?r@rZ)
r�r	r�r�r�r�r�r�r?r@)rdr	r�r	rcr�r?r@)r�r�r=r>r?r@)�__name__�
__module__�__qualname__�__doc__rK�msgs�listr�DOCSTRING_TYPES�optionsr[r�rW�visit_asyncfunctiondefrPrQrRr�r�r��visit_yieldfromr�r�r�r`r]r�r�rXrVr
r
s���������(%�D�
�

�

�

�
+� �F�
�?�@�A�	
�
�
*��H�
�>�?�@�	
�
�
6��C�
�=�>�?�	
�
;��H�
�<�=�>�	
�
�

�

�

�

�_T�T�D�p
"���%��	
�
�
	
�
"���%�'�	
�
�
	
�
#���%�'�	
�
�
	
�
#���%�A�	
�
�		
�
%� �$�-��4�� 5�6�6�=�
�
�
	
�Y7�G�r$�Y�/��%+�U�O�!�6�6�6�6�2/��
�
�
�
�B
R�
R�
R�
R�	@�	@�	@�	@�29�29�29�29�hY�Y�Y�Y�:X�X�X�X�8"�O�&�&�&�&�P)�)�)�)�V����<,0�P
�P
�P
�P
�P
�d	�	�	�	������rXr
rErr?r@c�J�|�t|����dSrZ)�register_checkerr
)rEs rV�registerr�s%��
���5�f�=�=�>�>�>�>�>rX)rErr?r@)r��
__future__rrI�typingrrrr�pylint.checkersrrrL�pylint.extensionsr�#pylint.extensions._check_docs_utilsr	�pylint.interfacesr
�pylint.lintrr
rr�rXrV�<module>r
s��
O�N�"�"�"�"�"�"�	�	�	�	� � � � � � �����������'�'�'�'�'�'�2�2�2�2�2�2�8�8�8�8�8�8�9�9�9�9�9�9�"�"�"�"�"�"��%�$�$�$�$�$�$�F
�F
�F
�F
�F
��F
�F
�F
�R?�?�?�?�?�?rX

Hacked By AnonymousFox1.0, Coded By AnonymousFox