
    e                    r    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y)z!Ellipsis checker for Python code.    )annotations)TYPE_CHECKING)nodes)BaseChecker)only_required_for_messages)PyLinterc                  6    e Zd ZdZddiZ ed      dd       Zy)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   c                   |j                         dk(  rt        |j                  t        j                        rt        |j                  j                  t        j
                  t        j                  f      r |j                  j                  j                  s,t        |j                  j                  j                        dkD  r| j                  d|       yyyy)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   )nodeN)pytype
isinstanceparentr   ExprClassDefFunctionDefdoc_nodelenbodyadd_message)selfr   s     B/usr/lib/python3/dist-packages/pylint/checkers/ellipsis_checker.pyvisit_constzEllipsisChecker.visit_const!   s     KKM004;;

3 t{{11ENNEDUDU3VW**33t{{))../!3 3$? 4 4 1    N)r   znodes.ConstreturnNone)__name__
__module____qualname__namemsgsr   r    r   r   r
   r
      s2    !D 
	D   67@ 8@r   r
   c                8    | j                  t        |              y )N)register_checkerr
   )linters    r   registerr*   9   s    
OF34r   N)r)   r   r   r    )__doc__
__future__r   typingr   astroidr   pylint.checkersr   pylint.checkers.utilsr   pylint.lintr   r
   r*   r&   r   r   <module>r2      s3   
 ( "    ' <$"@k "@J5r   