AlkantarClanX12

Your IP : 18.226.200.180


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/astroid/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/astroid/__pycache__/transforms.cpython-311.pyc

�

�܋f���\�ddlmZddlZddlmZddlmZerddlmZGd�d��Z	dS)�)�annotationsN)�
TYPE_CHECKING)�_invalidate_cache)�NodeNGc�F�eZdZdZd�Zdd�Zd�Zd�Zddd�Zddd�Z	d
�Z
d	S)�TransformVisitoraPA 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�tjt��|_dS�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|krn�=|S)zdCall matching transforms for the given node if any and return the
        transformed node.
        )�	__class__rr)rr�clsr�transform_func�	predicate�rets       r�
_transformzTransformVisitor._transforms}���n���_�S�)�
�)3�
	�
	�%�N�I�� �I�I�d�O�O� �$�n�T�*�*���?�%�'�'�'��D��=�C�'�'��E���rc���t|d��rF|jD]>}t||��}|�|��}||krt	|||���?|�|��S)N�_astroid_fields)�hasattrr�getattr�_visit_generic�setattrr)rr�name�value�visiteds     r�_visitzTransformVisitor._visit2sy���4�*�+�+�	1��,�
1�
1����d�+�+���-�-�e�4�4���e�#�#��D�$��0�0�0�����t�$�$�$rc���t|t��r�fd�|D��St|t��rt�fd�|D����S|rt|t��r|S��|��S)Nc�:��g|]}��|����S��r ��.0�childrs  �r�
<listcomp>z3TransformVisitor._visit_generic.<locals>.<listcomp>=s'���A�A�A�5�D�'�'��.�.�A�A�Arc3�B�K�|]}��|��V��dSr
r)r*s  �r�	<genexpr>z2TransformVisitor._visit_generic.<locals>.<genexpr>?s1�����F�F���,�,�U�3�3�F�F�F�F�F�Fr)�
isinstancer
�tuple�strr%)rrs` rr zTransformVisitor._visit_generic;s�����d�D�!�!�	B�A�A�A�A�D�A�A�A�A��d�E�"�"�	G��F�F�F�F��F�F�F�F�F�F��	�z�$��,�,�	��K��{�{�4� � � rN�Nonec�J�|j|�||f��dS)a7Register `transform(node)` function to be applied on the given
        astroid's `node_class` if `predicate` is None or returns true
        when called with the node as argument.

        The transform function may return a value which is then used to
        substitute the original node in the tree.
        N)r�append�r�
node_class�	transformrs    r�register_transformz#TransformVisitor.register_transformEs*��	
��
�#�*�*�I�y�+A�B�B�B�B�Brc�J�|j|�||f��dS)zUnregister the given transform.N)r�remover6s    r�unregister_transformz%TransformVisitor.unregister_transformOs(����
�#�*�*�I�y�+A�B�B�B�B�Brc�,�|�|��S)z�Walk the given astroid *tree* and transform each encountered node.

        Only the nodes which have transforms registered will actually
        be replaced or changed.
        )r%)r�modules  r�visitzTransformVisitor.visitSs���{�{�6�"�"�"r)rrrrr
)rr3)�__name__�
__module__�__qualname__�__doc__rrr%r r9r<r?r(rrrrs���������8�8�8�����(%�%�%�!�!�!�C�C�C�C�C�C�C�C�C�C�#�#�#�#�#rr)
�
__future__rr�typingr�astroid.contextr�astroidrrr(rr�<module>rHs���
#�"�"�"�"�"����� � � � � � �-�-�-�-�-�-���������I#�I#�I#�I#�I#�I#�I#�I#�I#�I#r