Hacked By AnonymousFox
�
�܋f1e � � � d Z ddlmZ ddlZddlmZ ddlZddlmZ ddlm Z ddlm
Z ddlm
Z
dd lmZ dd
lmZ erddlmZ G d� 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 � e Zd ZdZdZddddddd d
dgifdd
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:�ZeZ
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�choicer3 z<docstring type>zRIf the docstring type cannot be guessed the specified docstring type will be used.)r4 r3 r5 �choicesr6 �__init__�__new__�self�cls�node�nodes.FunctionDef�return�Nonec � � t j |j | j j j � � }| j j j }|rt j ||j � � rdS t j |� � |j z
}| j j j
}|dk r||k rdS | � ||� � | � ||� � | � ||� � 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� rS r c �� � d }|j | j v r�t j |� � }|��t j |j | j j j � � }| �
|||� � |� � � p|� � � pd }|� � � p|� � � pd }| �
||j ||� � | �
||j ||� � d S �N)rK �constructor_namesrL �node_frame_classr rC rD rE rF rG �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 rV rP z2DocstringParameterChecker.check_functiondef_params� s& � � #���9��.�.�.�&�7��=�=�J��%�!�.��'���);�)R�� � � �4�4�Y��*�U�U�U�
�(�(�*�*� � �<�<�>�>��� $� �'�'�)�)� ��;�;�=�=��� %� �1�1��t�y�*�6J�� � �
�)�)��d�i��':�
�
�
�
�
rX c �j � |j s|� � � s|� � � rd S |� t j � � }|� � � s|� � � r:t d� |D � � � � s| � d|t �� � d S d S d S )Nc 3 �>