
    c`                        d Z ddlmZ ddlZddlmZ ddl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 ddZ G d de	j                  ZddZdS )zLooks for comparisons to zero.    )annotationsN)TYPE_CHECKING)nodes)checkers)utils)HIGH)PyLinternodestr | nodes.NodeNGreturnboolc                ^    t          | t          j                  o| j        dk    o| j        duS )Nr   F)
isinstanceastroidConstvalue)r
   s    ?lib/python3.11/site-packages/pylint/extensions/comparetozero.py_is_constant_zeror      s0     	4''WDJ!OW
RW@W    c                  V    e Zd ZdZdZddiZdZ ej        d          dd
            Z	dS )CompareToZeroCheckerzChecks for comparisons to zero.

    Most of the time you should use the fact that integers with a value of 0 are false.
    An exception to this rule is when 0 is allowed in the program and has a
    different meaning than None!
    compare-to-zeroC2001)z-"%s" can be simplified to "%s" as 0 is falseyr   z4Used when Pylint detects comparison to a 0 constant. r
   nodes.Comparer   Nonec                   g d}d|j         fg}|                    |j                   t          |          }t	          t          j        |           }t          t          |          dz
            D ]}||         }||dz            }||dz            }	d}
t          |          r	||v rd}
|	}n||v rt          |	          rd}
|}|
r}|
                                 d| d|	
                                 }|dv r|
                                nd	|
                                 }|                     d
||f|t                     d S )N)!=z==is notis       FT >   r   r   znot r   )argsr
   
confidence)leftextendopsiterlist	itertoolschainrangelenr   	as_stringadd_messager   )selfr
   
_operatorsr)   iter_opsall_opsops_idxop_1op_2op_3error_detectedoporiginal
suggestions                 r   visit_comparez"CompareToZeroChecker.visit_compare3   s    211

 13DI.?

4899y122S\\A-.. 	 	G7#D7Q;'D7Q;'D"N !&& 4:+= !%# (9$(?(? !% "nn..JJJJ8H8HJJ //1BLLNNN000 
   %"J/#	 !   -	 	r   N)r
   r   r   r   )
__name__
__module____qualname____doc__namemsgsoptionsr   only_required_for_messagesr>   r   r   r   r   r      sh          D 
D G%U%&788' ' ' 98' ' 'r   r   linterr	   r   c                J    |                      t          |                      d S )N)register_checkerr   )rG   s    r   registerrJ   ^   s%    
08899999r   )r
   r   r   r   )rG   r	   r   r   )rB   
__future__r   r,   typingr   r   r   pylintr   pylint.checkersr   pylint.interfacesr   pylint.lintr	   r   BaseCheckerr   rJ   r   r   r   <module>rR      s  
 % $ " " " " " "                              ! ! ! ! ! ! " " " " " " %$$$$$$   < < < < <8/ < < <~: : : : : :r   