Files
aitsc/.venv/Lib/site-packages/jinja2/__pycache__/visitor.cpython-312.pyc

47 lines
5.2 KiB
Plaintext
Raw Normal View History

2025-02-23 09:07:52 +08:00
<EFBFBD>
2025-08-17 18:52:05 +08:00
-<2D><>hA<00><00><><00>dZddlZddlmZej
2025-02-23 09:07:52 +08:00
rddlZGd<05>dej<00>Z Gd<07>d<08>Z
Gd <09>d
e
<EFBFBD>Z y) zVAPI for traversing the AST nodes. Implemented by the compiler and
meta introspection.
<EFBFBD>N<>)<01>Nodec<00>`<00>eZdZdedej
dej
dej
2025-08-16 19:28:45 +08:00
fd<05>Zy)<07> VisitCallable<6C>node<64>args<67>kwargs<67>returnc<00><00>y<00>N<>)<04>selfrrr s <20>2D:\aitsc\.venv\Lib\site-packages\jinja2\visitor.py<70>__call__zVisitCallable.__call__ s<00><00>PS<50>N)<07>__name__<5F>
2025-02-23 09:07:52 +08:00
__module__<EFBFBD> __qualname__r<00>t<>Anyrr rrrr s%<00><00>S<><14>S<>a<EFBFBD>e<EFBFBD>e<EFBFBD>S<>q<EFBFBD>u<EFBFBD>u<EFBFBD>S<><11><15><15>Srrc<00><><00>eZdZdZdeddfd<05>Zdedejdejdejfd<08>Zdedejdejdejfd <09>Z y
) <0B> NodeVisitoraWalks 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.
rr
zt.Optional[VisitCallable]c<00>H<00>t|dt|<01>j<00><00>d<02>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.
<20>visit_N)<03>getattr<74>typer)rrs r<00> get_visitorzNodeVisitor.get_visitors%<00><00>
<17>t<EFBFBD>v<EFBFBD>d<EFBFBD>4<EFBFBD>j<EFBFBD>&9<>&9<>%:<3A>;<3B>T<EFBFBD>B<>Brrr c<00>l<00>|j|<01>}|<04> ||g|<02><01>i|<03><01>S|j|g|<02><01>i|<03><01>S)z Visit a node.)r<00> generic_visit)rrrr <00>fs r<00>visitzNodeVisitor.visit#sI<00><00> <10> <1C> <1C>T<EFBFBD> "<22><01> <0C>=<3D><14>T<EFBFBD>+<2B>D<EFBFBD>+<2B>F<EFBFBD>+<2B> +<2B>!<21>t<EFBFBD>!<21>!<21>$<24>8<><14>8<><16>8<>8rc<00>Z<00>|j<00>D]}|j|g|<02><01>i|<03><01><00>y)z9Called if no explicit visitor function exists for a node.N)<02>iter_child_nodesr!)rrrr <00>
child_nodes rrzNodeVisitor.generic_visit,s-<00><00><1E>/<2F>/<2F>1<>J<EFBFBD> <16>D<EFBFBD>J<EFBFBD>J<EFBFBD>z<EFBFBD> 3<>D<EFBFBD> 3<>F<EFBFBD> 3<>2rN)
rrr<00>__doc__rrrrr!rr rrrrsx<00><00> <08>C<01><04>C<01>)D<>C<01>9<>$<24>9<>q<EFBFBD>u<EFBFBD>u<EFBFBD>9<><01><05><05>9<>!<21>%<25>%<25>9<>4<>$<24>4<>q<EFBFBD>u<EFBFBD>u<EFBFBD>4<><01><05><05>4<>!<21>%<25>%<25>4rrc <00><><00>eZdZdZdedej dej defd<06>Zdedej dej dejefd<07>Z y) <09>NodeTransformera<72>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.
rrr r
c<00><><00>|j<00>D]<5D>\}}t|t<00>rkg}|D]^}t|t<00>r;|j|g|<02><01>i|<03><01>}|<07><01>,t|t<00>s|j |<07><00>N|j |<07><00>`||dd<00><>t|t<00>s<01><>|j|g|<02><01>i|<03><01>}|<08> t||<04><00><>t|||<08><00><>|Sr ) <09> iter_fields<64>
isinstance<EFBFBD>listrr!<00>extend<6E>append<6E>delattr<74>setattr) rrrr <00>field<6C> old_value<75>
new_values<EFBFBD>value<75>new_nodes rrzNodeTransformer.generic_visit=s<><00><00> $<24> 0<> 0<> 2<> <1C>E<EFBFBD>9<EFBFBD><19>)<29>T<EFBFBD>*<2A><1F>
<EFBFBD>&<26>E<EFBFBD>!<21>%<25><14>.<2E> *<2A><04>
<EFBFBD>
<EFBFBD>5<EFBFBD> B<>4<EFBFBD> B<>6<EFBFBD> B<><05> <20>=<3D>$<24>!+<2B>E<EFBFBD>4<EFBFBD>!8<>&<26>-<2D>-<2D>e<EFBFBD>4<>$<24><1E>%<25>%<25>e<EFBFBD>,<2C>'<27> *<2A> <09>!<21> <0C><1B>I<EFBFBD>t<EFBFBD>,<2C>%<25>4<EFBFBD>:<3A>:<3A>i<EFBFBD>A<>$<24>A<>&<26>A<><08><1B>#<23><1B>D<EFBFBD>%<25>(<28><1B>D<EFBFBD>%<25><18>2<>%!3<>&<14> rc<00>X<00>|j|g|<02><01>i|<03><01>}t|t<00>s|gS|S)z{As transformers may return lists in some places this method
can be used to enforce a list as return value.
)r!r*r+)rrrr <00>rvs r<00>
visit_listzNodeTransformer.visit_listSs4<00><00><18>T<EFBFBD>Z<EFBFBD>Z<EFBFBD><04> .<2E>t<EFBFBD> .<2E>v<EFBFBD> .<2E><02><19>"<22>d<EFBFBD>#<23><16>4<EFBFBD>K<EFBFBD><11> rN)
rrrr%rrrr<00>Listr7r rrr'r'2sa<00><00><08><14>$<24><14>q<EFBFBD>u<EFBFBD>u<EFBFBD><14><01><05><05><14>$<24><14>, <12>t<EFBFBD> <12>A<EFBFBD>E<EFBFBD>E<EFBFBD> <12>Q<EFBFBD>U<EFBFBD>U<EFBFBD> <12>q<EFBFBD>v<EFBFBD>v<EFBFBD>d<EFBFBD>|<7C> rr') r%<00>typingr<00>nodesr<00> TYPE_CHECKING<4E>typing_extensions<6E>te<74>Protocolrrr'r rr<00><module>r?sE<00><01><04><13><17><04>?<3F>?<3F>"<22>T<01><02> <0B> <0B>T<01>4<>4<>D*<12>k<EFBFBD>*r