0x1949 Team - FAZEMRX - MANAGER
Edit File: visitor.cpython-310.pyc
o �:�`� � @ sZ d Z ddlZddlmZ ejrddlZG dd� dej�Z G dd� d�Z G d d � d e �ZdS )zVAPI for traversing the AST nodes. Implemented by the compiler and meta introspection. � N� )�Nodec @ s, e Zd Zdedejdejdejfdd�ZdS )� VisitCallable�node�args�kwargs�returnc O s d S �N� ��selfr r r r r �0/usr/lib/python3/dist-packages/jinja2/visitor.py�__call__ s zVisitCallable.__call__N)�__name__� __module__�__qualname__r �t�Anyr r r r r r s $r c @ sb e Zd ZdZdeddfdd�Zdedejdejdejfd d �Zdedejdejdejfdd�Z d S )�NodeVisitora Walks the abstract syntax tree and call visitor functions for every node found. The visitor functions may return values which will be forwarded by the `visit` method. Per default the visitor functions for the nodes are ``'visit_'`` + class name of the node. So a `TryFinally` node visit function would be `visit_TryFinally`. This behavior can be changed by overriding the `get_visitor` function. If no visitor function exists for a node (return value `None`) the `generic_visit` visitor is used instead. r r zt.Optional[VisitCallable]c C s t | dt|�j� �d�S )z�Return the visitor function for this node or `None` if no visitor exists for this node. In that case the generic visit function is used instead. �visit_N)�getattr�typer )r r r r r �get_visitor s zNodeVisitor.get_visitorr r c O s@ | � |�}|dur||g|�R i |��S | j|g|�R i |��S )z Visit a node.N)r � generic_visit)r r r r �fr r r �visit# s zNodeVisitor.visitc O s* |� � D ]}| j|g|�R i |�� qdS )z9Called if no explicit visitor function exists for a node.N)�iter_child_nodesr r r r r r , s �zNodeVisitor.generic_visitN) r r r �__doc__r r r r r r r r r r r s $ r c @ sR e Zd ZdZdedejdejdefdd�Zdedejdejdeje fdd �Z d S )�NodeTransformera� Walks the abstract syntax tree and allows modifications of nodes. The `NodeTransformer` will walk the AST and use the return value of the visitor functions to replace or remove the old node. If the return value of the visitor function is `None` the node will be removed from the previous location otherwise it's replaced with the return value. The return value may be the original node in which case no replacement takes place. r r r r c O s� |� � D ]^\}}t|t�rAg }|D ](}t|t�r4| j|g|�R i |��}|d u r)qt|t�s4|�|� q|�|� q||d d �<