관리-도구
편집 파일: visitor.cpython-311.pyc
� �܋f� � � � d Z ddlZddlmZ ej rddlZ G d� dej � � Z G d� d� � Z G d � d e � � ZdS )zVAPI for traversing the AST nodes. Implemented by the compiler and meta introspection. � N� )�Nodec �D � e Zd Zdedej dej dej fd�ZdS )� VisitCallable�node�args�kwargs�returnc � � d S �N� ��selfr r r s �E/opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/visitor.py�__call__zVisitCallable.__call__ s � ��C� N)�__name__� __module__�__qualname__r �t�Anyr r r r r r sJ � � � � � � �� �a�e� �q�u� ��� � � � � � r r c � � e Zd ZdZdeddfd�Zdedej dej dej fd�Zdedej dej dej fd �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 �N � 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 s r �get_visitorzNodeVisitor.get_visitor s( � � �t�;�d�4�j�j�&9�;�;�T�B�B�Br r r c �j � | � |� � }|� ||g|�R i |��S | j |g|�R i |��S )z Visit a node.)r � generic_visit)r r r r �fs r �visitzNodeVisitor.visit# s] � ����T�"�"���=��1�T�+�D�+�+�+�F�+�+�+�!�t�!�$�8��8�8�8��8�8�8r c �V � |� � � D ]} | j |g|�R i |�� �dS )z9Called if no explicit visitor function exists for a node.N)�iter_child_nodesr"