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

Method _depth

dask/_expr.py:187–206  ·  view source on GitHub ↗

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

(self, cache=None)

Source from the content-addressed store, hash-verified

185 )
186
187 def _depth(self, cache=None):
188 """Depth of the expression tree
189
190 Returns
191 -------
192 depth: int
193 """
194 if cache is None:
195 cache = {}
196 if not self.dependencies():
197 return 1
198 else:
199 result = []
200 for expr in self.dependencies():
201 if expr._name in cache:
202 result.append(cache[expr._name])
203 else:
204 result.append(expr._depth(cache) + 1)
205 cache[expr._name] = result[-1]
206 return max(result)
207
208 def __setattr__(self, name: str, value: Any) -> None:
209 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