관리-도구
편집 파일: transforms.cpython-311.pyc
� �܋f� � �\ � d dl mZ d dlZd dlmZ d dlmZ erd dlmZ G d� d� � Z dS )� )�annotationsN)� TYPE_CHECKING)�_invalidate_cache)�NodeNGc �F � e Zd ZdZd� Zdd�Zd� Zd� Zddd�Zddd�Z d � Z d S )�TransformVisitoraP A visitor for handling transforms. The standard approach of using it is to call :meth:`~visit` with an *astroid* module and the class will take care of the rest, walking the tree and running the transforms for each encountered node. Based on its usage in AstroidManager.brain, it should not be reinstantiated. c �B � t j t � � | _ d S �N)�collections�defaultdict�list� transforms)�selfs �c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/astroid/transforms.py�__init__zTransformVisitor.__init__ s � �%�1�$�7�7����� �noder �returnc � � |j }| j | }|D ]<\ }}|� ||� � r* ||� � }|�t � � |}|j |k r n�=|S )zdCall matching transforms for the given node if any and return the transformed node. )� __class__r r )r r �clsr �transform_func� predicate�rets r � _transformzTransformVisitor._transform s} � � �n���_�S�)� �)3� � �%�N�I�� �I�I�d�O�O� �$�n�T�*�*�� �?�%�'�'�'��D��=�C�'�'��E���r c �� � t |d� � rF|j D ]>}t ||� � }| � |� � }||k rt |||� � �?| � |� � S )N�_astroid_fields)�hasattrr �getattr�_visit_generic�setattrr )r r �name�value�visiteds r �_visitzTransformVisitor._visit2 sy � ��4�*�+�+� 1��,� 1� 1����d�+�+���-�-�e�4�4���e�#�#��D�$��0�0�0�����t�$�$�$r c � � � t |t � � r� fd�|D � � S t |t � � rt � fd�|D � � � � S |rt |t � � r|S � � |� � S )Nc �: �� g | ]}�� |� � ��S � �r ��.0�childr s �r � <listcomp>z3TransformVisitor._visit_generic.<locals>.<listcomp>= s'