MCPcopy
hub / github.com/dask/dask / _depth

Method _depth

dask/_expr.py:182–201  ·  view source on GitHub ↗

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

(self, cache=None)

Source from the content-addressed store, hash-verified

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