관리-도구
편집 파일: dunder_methods.cpython-311.pyc
� �܋f� � � � d dl mZ d dlmZ d dlmZmZ d dlmZ d dl m Z d dlmZ d dl mZ d dlmZ erd d lmZ G d � de � � Zdd�ZdS )� )�annotations)� TYPE_CHECKING)�Instance�nodes)�UninferableBase)�BaseChecker)� safe_infer)�DUNDER_METHODS)�HIGH)�PyLinterc �N � e Zd ZdZdZdZddiZdZdd �Ze dd �� � Z dd�ZdS )�DunderCallCheckera� Check for unnecessary dunder method calls. Docs: https://docs.python.org/3/reference/datamodel.html#basic-customization We exclude names in list pylint.constants.EXTRA_DUNDER_METHODS such as __index__ (see https://github.com/PyCQA/pylint/issues/6795) since these either have no alternative method of being called or have a genuine use case for being called manually. Additionally, we exclude classes that are not instantiated since these might be used to access the dunder methods of a base class of an instance. We also exclude dunder method calls on super() since these can't be written in an alternative manner. �unnecessary-dunder-call����C2801)z)Unnecessarily calls dunder method %s. %s.r ziUsed when a dunder method is manually called instead of using the corresponding function/method/operator.� �return�Nonec � � i | _ t j � � D ]4\ }}|| j j j k r| j � |� � �5d S �N)�_dunder_methodsr �items�linter�config� py_version�update)�self� since_vers�dunder_methodss �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/dunder_methods.py�openzDunderCallChecker.open0 s\ � �/1���*8�*>�*@�*@� <� <�&�J���T�[�/�:�:�:��$�+�+�N�;�;�;�� <� <� �node�nodes.NodeNG�boolc �� � | j }|�Yt |t j � � r6|j � d� � r|j � d� � rdS |j }|�YdS )zACheck if dunder method call is within a dunder method definition.N�__TF)�parent� isinstancer �FunctionDef�name� startswith�endswith)r# r( s r �within_dunder_defz#DunderCallChecker.within_dunder_def6 su � � ���� ��6�5�#4�5�5� ��K�*�*�4�0�0� � �K�(�(��.�.� � �t��]�F� � � �ur"