관리-도구
편집 파일: ellipsis_checker.cpython-311.pyc
� �܋f� � �z � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z erddlmZ G d� d e� � Z dd�ZdS )z!Ellipsis checker for Python code.� )�annotations)� TYPE_CHECKING)�nodes)�BaseChecker)�only_required_for_messages)�PyLinterc �D � e Zd ZdZddiZ ed� � dd �� � Zd S )�EllipsisChecker�unnecessary_ellipsis�W2301)zUnnecessary ellipsis constant�unnecessary-ellipsisz�Used when the ellipsis constant is encountered and can be avoided. A line of code consisting of an ellipsis is unnecessary if there is a docstring on the preceding line or if there is a statement in the same scope.r �node�nodes.Const�return�Nonec �t � |� � � dk r�t |j t j � � r~t |j j t j t j f� � r|j j j s"t |j j j � � dk r| � d|�� � dS dS dS dS )a_ Check if the ellipsis constant is used unnecessarily. Emits a warning when: - A line consisting of an ellipsis is preceded by a docstring. - A statement exists in the same scope as the ellipsis. For example: A function consisting of an ellipsis followed by a return statement on the next line. zbuiltins.Ellipsis� r )r N)�pytype� isinstance�parentr �Expr�ClassDef�FunctionDef�doc_node�len�body�add_message)�selfr s �q/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/ellipsis_checker.py�visit_constzEllipsisChecker.visit_const! s� � � �K�K�M�M�0�0�0��4�;�� �3�3� 1� �t�{�1�E�N�E�DU�3V�W�W� 1� ��*�3� 1� �t�{�)�.�/�/�!�3�3� ���3�$��?�?�?�?�?� 1�0�0�0� 4�3� N)r r r r )�__name__� __module__�__qualname__�name�msgsr r � r! r r r s[ � � � � � �!�D�� � �D� �� 6�7�7�@� @� @� 8�7�@� @� @r! r �linterr r r c �J � | � t | � � � � d S )N)�register_checkerr )r( s r �registerr+ 9 s$ � � ���O�F�3�3�4�4�4�4�4r! N)r( r r r )�__doc__� __future__r �typingr �astroidr �pylint.checkersr �pylint.checkers.utilsr �pylint.lintr r r+ r'