MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / walk

Function walk

tools/python-3.11.9-amd64/Lib/ast.py:380–391  ·  view source on GitHub ↗

Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context.

(node)

Source from the content-addressed store, hash-verified

378
379
380def walk(node):
381 """
382 Recursively yield all descendant nodes in the tree starting at *node*
383 (including *node* itself), in no specified order. This is useful if you
384 only want to modify nodes in place and don't care about the context.
385 """
386 from collections import deque
387 todo = deque([node])
388 while todo:
389 node = todo.popleft()
390 todo.extend(iter_child_nodes(node))
391 yield node
392
393
394class NodeVisitor(object):

Callers 1

increment_linenoFunction · 0.70

Calls 3

dequeFunction · 0.85
iter_child_nodesFunction · 0.85
extendMethod · 0.45

Tested by

no test coverage detected