Skip to content

Commit 7f7faf1

Browse files
committed
bundle.nodes added in parallel to doc.nodes
1 parent 908f56a commit 7f7faf1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

udapi/core/bundle.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,12 @@ def address(self):
116116
def draw(self, **kwargs):
117117
"""Pretty print the trees using TextModeTrees."""
118118
TextModeTrees(**kwargs).process_bundle(self)
119+
120+
@property
121+
def nodes(self):
122+
"""An iterator over all nodes (excluding empty nodes) in all trees in this bundle."""
123+
for tree in self:
124+
# tree.descendants is slightly slower than tree._descendants,
125+
# but it seems safer, see the comment in udapi.core.block.Block.process.process_tree().
126+
for node in tree.descendants:
127+
yield node

0 commit comments

Comments
 (0)