
    c                    z    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 erddlmZ  G d d	e          ZddZdS )z!Ellipsis checker for Python code.    )annotations)TYPE_CHECKING)nodes)BaseChecker)only_required_for_messages)PyLinterc                  D    e Zd ZdZddiZ ed          dd	            Zd
S )EllipsisCheckerunnecessary_ellipsisW2301)zUnnecessary ellipsis constantunnecessary-ellipsiszUsed 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   |                                 dk    rt          |j        t          j                  r~t          |j        j        t          j        t          j        f          r|j        j        j        s"t          |j        j        j	                  dk    r| 
                    d|           dS dS dS dS )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.
        zbuiltins.Ellipsis   r   )r   N)pytype
isinstanceparentr   ExprClassDefFunctionDefdoc_nodelenbodyadd_message)selfr   s     @lib/python3.11/site-packages/pylint/checkers/ellipsis_checker.pyvisit_constzEllipsisChecker.visit_const!   s     KKMM00	@4;
33	@
 t{1ENEDU3VWW	@ *3	@ t{).//!3	@ 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$    
OF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'   r!   r   <module>r3      s   
 ( ' " " " " " "                   ' ' ' ' ' ' < < < < < < %$$$$$$"@ "@ "@ "@ "@k "@ "@ "@J5 5 5 5 5 5r!   