o
    @jt                     @   sB   d dl mZmZ ddlmZmZ G dd dZG dd deZdS )	    )AnyList   )BaseNodeNodec                   @   s4   e Zd ZdZdeddfddZdeddfddZdS )	Visitora^  Read-only visitor pattern.

    Subclass this to gather information from an AST.
    To generally define which nodes not to descend in to, overload
    `generic_visit`.
    To handle specific node types, add methods like `visit_Pattern`.
    If you want to still descend into the children of the node, call
    `generic_visit` of the superclass.
    nodereturnNc                 C   sZ   t |tr|D ]}| | qd S t |tsd S t|j}t| d| | j}|| d S Nvisit_)
isinstancelistvisitr   type__name__getattrgeneric_visit)selfr   childnodenamer    r   d/var/www/www-root/data/www/ai-bot.pdev.uz/venv/lib/python3.10/site-packages/fluent/syntax/visitor.pyr      s   


zVisitor.visitc                 C   s    t | D ]}| | qd S N)varsvaluesr   )r   r   	propvaluer   r   r   r      s   zVisitor.generic_visit)r   
__module____qualname____doc__r   r   r   r   r   r   r   r   r      s    
r   c                   @   s4   e Zd ZdZdedefddZdedefddZdS )	TransformerzIn-place AST Transformer pattern.

    Subclass this to create an in-place modified variant
    of the given AST.
    If you need to keep the original AST around, pass
    a `node.clone()` to the transformer.
    r   r	   c                 C   s4   t |ts|S t|j}t| d| | j}||S r
   )r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )   s
   

zTransformer.visitc                 C   s   t | D ]?\}}t|tr+g }|D ]}| |}|d ur#|| q||d d < qt|trE| |}|d u r?t|| qt||| q|S r   )	r   itemsr   r   r   appendr   delattrsetattr)r   r   propnamer   new_valsr   new_valr   r   r   r   1   s    




zTransformer.generic_visitN)r   r   r   r   r   r   r   r   r   r   r   r   r       s    r   N)typingr   r   astr   r   r   r   r   r   r   r   <module>   s    