관리-도구
편집 파일: comparison_placement.cpython-311.pyc
� �܋f0 � � � d Z ddlmZ ddlmZ ddlmZ ddlmZm Z erddl mZ ddd d d�Z e d� � Z G d � de� � Zdd�ZdS )zjChecks for yoda comparisons (variable before constant) See https://en.wikipedia.org/wiki/Yoda_conditions. � )�annotations)� TYPE_CHECKING)�nodes)�BaseChecker�utils)�PyLinter�>�>=�<�<=)r r r r )z==z!=r r r r c �l � e Zd ZdZdZddddddgifiZd Zdd�Z ej d� � dd�� � Z dS )�"MisplacedComparisonConstantCheckerz1Checks the placement of constants in comparisons.zcomparison-placement�C2201zComparison should be %s�misplaced-comparison-constantz�Used when the constant is placed on the left side of a comparison. It is usually clearer in intent to place it in the right hand side of the comparison.� old_names)�C0122z!old-misplaced-comparison-constant� �node� nodes.Compare�left�nodes.NodeNG�right�operator�str�return�Nonec �� � t |t j � � rd S t � ||� � }|� � � � d|� d|j ��}| � d||f�� � d S )N� r )r �args)� isinstancer �Const�REVERSED_COMPS�get� as_string�value�add_message)�selfr r r r � suggestions �w/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/comparison_placement.py�_check_misplaced_constantz<MisplacedComparisonConstantChecker._check_misplaced_constant* s} � � �e�U�[�)�)� ��F�!�%�%�h��9�9�����)�)�E�E�H�E�E�t�z�E�E� ����8�t�:�-��X�X�X�X�X� c �� � t |j � � dk rd S |j }|j d \ }}|t v r4t |t j � � r| � ||||� � d S d S d S )N� r )�len�opsr �COMPARISON_OPERATORSr r r! r* )r'