Hacked By AnonymousFox
�
�܋f` � � � d Z ddlmZ ddlZddlmZ ddlZddlmZ ddlm Z ddl
mZ ddlm
Z
erdd lmZ dd�Z G d� de j � � Zdd�ZdS )zLooks for comparisons to zero.� )�annotationsN)�
TYPE_CHECKING)�nodes)�checkers)�utils)�HIGH)�PyLinter�node�str | nodes.NodeNG�return�boolc �^ � t | t j � � o| j dk o| j duS )Nr F)�
isinstance�astroid�Const�value)r
s �p/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/comparetozero.py�_is_constant_zeror s0 � � �4���'�'�W�D�J�!�O�W��
�RW�@W�� c �V � e Zd ZdZdZddiZdZ ej d� � dd
�� � Z dS )
�CompareToZeroCheckerz�Checks 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 fg}|� |j � � t |� � }t t j |� � � }t t |� � dz
� � D ]�}|| }||dz }||dz } d}
t |� � r ||v rd}
| }n||v rt | � � rd}
|}|
r}|�
� � � d|� d| �
� � � �}|dv r|�
� � nd |�
� � � �}
| � d
||
f|t �� � ��d S )N)�!=z==�is not�is� � � FT� > r r znot 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�
�
13�D�I��.?���
�
�4�8������9�9���y���1�2�2���S��\�\�A�-�.�.� � �G��7�#�D��7�Q�;�'�D��7�Q�;�'�D�"�N� !��&�&�
�4�:�+=�+=�!%�������#�#�(9�$�(?�(?�#�!%�����
�"�n�n�.�.�J�J��J�J����8H�8H�J�J�� �/�/�/� �L�L�N�N�N�0������0�0� �
� � �%�"�J�/��#� !� � � ��- � r N)r
r r r )
�__name__�
__module__�__qualname__�__doc__�name�msgs�optionsr �only_required_for_messagesr>