MCPcopy Create free account
hub / github.com/dask/dask / walk

Method walk

dask/_expr.py:801–821  ·  view source on GitHub ↗

Iterate through all expressions in the tree Returns ------- nodes Generator of Expr instances in the graph. Ordering is a depth-first search of the expression tree

(self)

Source from the content-addressed store, hash-verified

799 return g
800
801 def walk(self) -> Generator[Expr]:
802 """Iterate through all expressions in the tree
803
804 Returns
805 -------
806 nodes
807 Generator of Expr instances in the graph.
808 Ordering is a depth-first search of the expression tree
809 """
810 stack = [self]
811 seen = set()
812 while stack:
813 node = stack.pop()
814 if node._name in seen:
815 continue
816 seen.add(node._name)
817
818 for dep in node.dependencies():
819 stack.append(dep)
820
821 yield node
822
823 def find_operations(self, operation: type | tuple[type]) -> Generator[Expr]:
824 """Search the expression graph for a specific operation type

Callers 1

find_operationsMethod · 0.95

Calls 4

setClass · 0.85
popMethod · 0.80
addMethod · 0.45
dependenciesMethod · 0.45

Tested by

no test coverage detected