관리-도구
편집 파일: modified_iterating_checker.cpython-311.pyc
� �܋f� � � � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m Z erd dlmZ ddhZ d dhZ G d � dej � � Zdd�ZdS )� )�annotations)� TYPE_CHECKING)�nodes)�checkers� interfaces)�utils)�PyLinter�append�remove�addc �� � e Zd ZdZdZdddd�ZdZ ej dd d � � d#d�� � Z d$d�Z d%d�Zed&d�� � Z ed'd�� � Zed&d�� � Zd(d�Zd(d�Zd(d�Zd)d!�Zd"S )*�ModifiedIterationCheckerz�Checks for modified iterators in for loops iterations. Currently supports `for` loops for Sets, Dictionaries and Lists. �modified_iteration)zkIterated list '%s' is being modified inside for loop body, consider iterating through a copy of it instead.�modified-iterating-listz�Emitted when items are added or removed to a list being iterated through. Doing so can result in unexpected behaviour, that is why it is preferred to use a copy of the list.)z`Iterated dict '%s' is being modified inside for loop body, iterate through a copy of it instead.�modified-iterating-dictziEmitted when items are added or removed to a dict being iterated through. Doing so raises a RuntimeError.)z_Iterated set '%s' is being modified inside for loop body, iterate through a copy of it instead.�modified-iterating-setzhEmitted when items are added or removed to a set being iterated through. Doing so raises a RuntimeError.)�W4701�E4702�E4703� r r r �node� nodes.For�return�Nonec �T � |j }|j D ]}| � ||� � �d S �N)�iter�body�._modified_iterating_check_on_node_and_children)�selfr �iter_obj� body_nodes �{/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/modified_iterating_checker.py� visit_forz"ModifiedIterationChecker.visit_for6 sC � � �9���� U� U�I��?�?� �8�T�T�T�T� U� U� r"