Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
visitor.cpython-313.pyc50 linesDownload Raw Back to __pycache__
1�

2��j�
���SrSSKrSSKJr \R3(aSSKr"SS\R5r	"SS5r4"S	S5\65rg)zVAPI for traversing the AST nodes. Implemented by the compiler and7meta introspection.8�N�)�Nodec�j�\rSrSrS\S\RS\RS\R4SjrSrg)	�
VisitCallable��node�args�kwargs�returnc��g�N�)�selfrr	r9s    �TD:\code\apps\devtools\python\user_packages\Python313\site-packages\jinja2/visitor.py�__call__�VisitCallable.__call__
s��PS�rN)	�__name__�10__module__�__qualname__�__firstlineno__r�t�Anyr�__static_attributes__rrrrrs%��S��S�a�e�e�S�q�u�u�S����Srrc���\rSrSrSrS\SS4SjrS\S\RS\RS\R4S	jr	S\S\RS\RS\R4S11jr12Srg)
�NodeVisitor�a�Walks the abstract syntax tree and call visitor functions for every13node found.  The visitor functions may return values which will be14forwarded by the `visit` method.15 16Per default the visitor functions for the nodes are ``'visit_'`` +17class name of the node.  So a `TryFinally` node visit function would18be `visit_TryFinally`.  This behavior can be changed by overriding19the `get_visitor` function.  If no visitor function exists for a node20(return value `None`) the `generic_visit` visitor is used instead.21rrzt.Optional[VisitCallable]c�H�[US[U5R3S5$)z�Return the visitor function for this node or `None` if no visitor22exists for this node.  In that case the generic visit function is23used instead.24�visit_N)�getattr�typer)rrs  r�get_visitor�NodeVisitor.get_visitors%��25�t�v�d�4�j�&9�&9�%:�;�T�B�Brr	r26c�n�URU5nUbU"U/UQ70UD6$UR"U/UQ70UD6$)z
Visit a node.)r"�
generic_visit)rrr	r27�fs     r�visit�NodeVisitor.visit#sG�����T�"���=��T�+�D�+�F�+�+��!�!�$�8��8��8�8rc�^�UR5HnUR"U/UQ70UD6 M g)z9Called if no explicit visitor function exists for a node.N)�iter_child_nodesr')rrr	r28�29child_nodes     rr%�NodeVisitor.generic_visit,s+���/�/�1�J��J�J�z�3�D�3�F�3�2rrN)rrrr�__doc__rr"rrr'r%rrrrrrsx��	�C��C�)D�C�9�$�9�q�u�u�9����9�!�%�%�9�4�$�4�q�u�u�4����4�!�%�%�4rrc	��\rSrSrSrS\S\RS\RS\4SjrS\S\RS\RS\R\4Sjr30S	rg31)�NodeTransformer�2a�Walks the abstract syntax tree and allows modifications of nodes.32 33The `NodeTransformer` will walk the AST and use the return value of the34visitor functions to replace or remove the old node.  If the return35value of the visitor function is `None` the node will be removed36from the previous location otherwise it's replaced with the return37value.  The return value may be the original node in which case no38replacement takes place.39rr	r40rc���UR5H�upE[U[5(az/nUHln[U[5(aCUR"U/UQ70UD6nUcM3[U[5(dURU5 M[UR
U5 Mn XeSS&M�[U[5(dM�UR"U/UQ70UD6nUc
[X5 M�[XU5 M� U$r
)	�iter_fields�41isinstance�listrr'�extend�append�delattr�setattr)	rrr	r42�field�	old_value�43new_values�value�new_nodes	         rr%�NodeTransformer.generic_visit=s��� $� 0� 0� 2��E��)�T�*�*��44�&�E�!�%��.�.� $�45�46�5� B�4� B�6� B�� �=�$�!+�E�4�!8�!8�&�-�-�e�4�$��%�%�e�,�'� *�!���I�t�,�,��:�:�i�A�$�A�&�A���#��D�(��D��2�%!3�&�rc�b�UR"U/UQ70UD6n[U[5(dU/$U$)zkAs transformers may return lists in some places this method47can be used to enforce a list as return value.48)r'r3r4)rrr	r49�rvs     r�50visit_list�NodeTransformer.visit_listSs5���Z�Z��
.�t�
.�v�
.���"�d�#�#��4�K��	rrN)rrrrr-rrrr%�ListrArrrrr/r/2sa����$��q�u�u������$��,	�t�	�A�E�E�	�Q�U�U�	�q�v�v�d�|�	rr/)r-�typingr�nodesr�
TYPE_CHECKING�typing_extensions�te�Protocolrrr/rrr�<module>rJsE������?�?�"�T����T�4�4�D*�k�*r
codekingpro/portable-devtools · Team Ai