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

Method _depth

dask/_expr.py:197–216  ·  view source on GitHub ↗

Depth of the expression tree Returns ------- depth: int

(self, cache=None)

Source from the content-addressed store, hash-verified

195 )
196
197 def _depth(self, cache=None):
198 """Depth of the expression tree
199
200 Returns
201 -------
202 depth: int
203 """
204 if cache is None:
205 cache = {}
206 if not self.dependencies():
207 return 1
208 else:
209 result = []
210 for expr in self.dependencies():
211 if expr._name in cache:
212 result.append(cache[expr._name])
213 else:
214 result.append(expr._depth(cache) + 1)
215 cache[expr._name] = result[-1]
216 return max(result)
217
218 def __setattr__(self, name: str, value: Any) -> None:
219 if name in ["operands", "_determ_token"]:

Callers 2

test_depthFunction · 0.80

Calls 2

dependenciesMethod · 0.95
maxFunction · 0.85

Tested by 2

test_depthFunction · 0.64