Skip to content

Commit ed3fc4b

Browse files
committed
skip to return parents
1 parent 524fcd3 commit ed3fc4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bigframes/core/bigframe_node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def unique_nodes(
301301

302302
def iter_nodes_topo(
303303
self: BigFrameNode,
304-
) -> Generator[Tuple[BigFrameNode, Sequence[BigFrameNode]], None, None]:
304+
) -> Generator[BigFrameNode, None, None]:
305305
"""Returns nodes in reverse topological order, using Kahn's algorithm."""
306306
child_to_parents: Dict[
307307
BigFrameNode, list[BigFrameNode]
@@ -319,8 +319,8 @@ def iter_nodes_topo(
319319

320320
while queue:
321321
item = queue.popleft()
322+
yield item
322323
parents = child_to_parents.get(item, [])
323-
yield item, parents
324324
for parent in parents:
325325
out_degree[parent] -= 1
326326
if out_degree[parent] == 0:
@@ -364,7 +364,7 @@ def bottom_up(
364364
Returns the transformed root node.
365365
"""
366366
results: dict[BigFrameNode, BigFrameNode] = {}
367-
for node, _ in list(self.iter_nodes_topo()):
367+
for node in list(self.iter_nodes_topo()):
368368
# child nodes have already been transformed
369369
result = node.transform_children(lambda x: results[x])
370370
result = transform(result)
@@ -375,7 +375,7 @@ def bottom_up(
375375
def reduce_up(self, reduction: Callable[[BigFrameNode, Tuple[T, ...]], T]) -> T:
376376
"""Apply a bottom-up reduction to the tree."""
377377
results: dict[BigFrameNode, T] = {}
378-
for node, _ in list(self.iter_nodes_topo()):
378+
for node in list(self.iter_nodes_topo()):
379379
# child nodes have already been transformed
380380
child_results = tuple(results[child] for child in node.child_nodes)
381381
result = reduction(node, child_results)

0 commit comments

Comments
 (0)