관리-도구
편집 파일: redefined_loop_name.cpython-311.pyc
� �܋f� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZ G d� d ej � � Zdd�ZdS )zPOptional checker to warn when loop variables are overwritten in the loop's body.� )�annotations)�nodes)�checkers)�utils)�HIGH)�PyLinterc �� � � e Zd ZdZddiZd� fd�Z ej d� � dd�� � Z ej d� � dd �� � Z ej d� � dd�� � Z � xZS )�RedefinedLoopNameChecker�redefined-loop-name�W2901)z!Redefining %r from loop (line %s)r z:Used when a loop variable is overwritten in the loop body.�linterr �return�Nonec �X �� t � � � |� � g | _ d S �N)�super�__init__�_loop_variables)�selfr � __class__s ��v/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/redefined_loop_name.pyr z!RedefinedLoopNameChecker.__init__ s. �� � ������ � � � � ���� �node�nodes.AssignNamec �b � |� � � }t |t j t j f� � sd S |� � � }| j D ]V\ }}}||ur�|j |v rBt j ||� � s-| � d|j |j f|t �� � d S �Wd S )Nr ��argsr � confidence) �assign_type� isinstancer �Assign� AugAssign�scoper �namer �in_for_else_branch�add_message� fromlinenor )r r r � node_scope� outer_for�outer_variables�outer_for_scopes r �visit_assignnamez)RedefinedLoopNameChecker.visit_assignname"