관리-도구
편집 파일: dict_init_mutate.cpython-311.pyc
� �܋f? � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZ erddl mZ G d � d e� � Zdd�ZdS )z:Check for use of dictionary mutation after initialization.� )�annotations)� TYPE_CHECKING)�nodes)�BaseChecker)�only_required_for_messages)�HIGH)�PyLinterc �D � e Zd ZdZddiZ ed� � d d�� � Zd S )�DictInitMutateChecker�dict-init-mutate�C3401)z>Declare all known key/values when initializing the dictionary.r zXDictionaries can be initialized with a single statement using dictionary literal syntax.�node�nodes.Assign�return�Nonec �T � t |j t j � � sdS |j d }t |j � � dk st |t j � � sdS |� � � }|r2t |t j � � rt |j � � dk rdS |j d }t |t j � � sdS |j }t |t j � � sdS |j |j k r| � d|t �� � dS dS )z� Detect dictionary mutation immediately after initialization. At this time, detecting nested mutation is not supported. Nr � r )r � confidence)� isinstance�valuer �Dict�targets�len� AssignName�next_sibling�Assign� Subscript�Name�name�add_messager )�selfr � dict_name� first_sibling�sibling_target�sibling_names �s/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/extensions/dict_init_mutate.py�visit_assignz"DictInitMutateChecker.visit_assign s! � � �$�*�e�j�1�1� ��F��L��O� ��t�|����!�!��I�u�?O�)P�)P�!��F��)�)�+�+� �� ��m�U�\�:�:� � �=�(�)�)�Q�.�.��F�&�.�q�1���.�%�/�:�:� ��F�%�+���,�� �3�3� ��F��� ��.�.����/�d�t��L�L�L�L�L� /�.� N)r r r r )�__name__� __module__�__qualname__r �msgsr r'