MCPcopy
hub / github.com/dask/dask / walk

Method walk

dask/array/numpy_compat.py:133–149  ·  view source on GitHub ↗

Iterate over x, yielding (index, value, entering), where * ``index``: a tuple of indices up to this point * ``value``: equal to ``x[index[0]][...][index[-1]]``. On the first iteration, is ``x`` itself * ``entering``: bool. The result of ``recurs

(self, x, index=())

Source from the content-addressed store, hash-verified

131 return f(x, **kwargs)
132
133 def walk(self, x, index=()):
134 """
135 Iterate over x, yielding (index, value, entering), where
136
137 * ``index``: a tuple of indices up to this point
138 * ``value``: equal to ``x[index[0]][...][index[-1]]``. On the first iteration, is
139 ``x`` itself
140 * ``entering``: bool. The result of ``recurse_if(value)``
141 """
142 do_recurse = self.recurse_if(x)
143 yield index, x, do_recurse
144
145 if not do_recurse:
146 return
147 for i, xi in enumerate(x):
148 # yield from ...
149 yield from self.walk(xi, index + (i,))
150
151
152# Implementation taken directly from numpy:

Callers 15

__repr__Method · 0.45
to_htmlMethod · 0.45
test_from_arrayFunction · 0.45
test_shuffle_no_assignFunction · 0.45
test_analyzeFunction · 0.45
_check_task_shuffleFunction · 0.45
assert_not_repartitionsFunction · 0.45
test_walkFunction · 0.45

Calls

no outgoing calls

Tested by 15

test_from_arrayFunction · 0.36
test_shuffle_no_assignFunction · 0.36
test_analyzeFunction · 0.36
_check_task_shuffleFunction · 0.36
assert_not_repartitionsFunction · 0.36
test_walkFunction · 0.36
test_avoid_alignmentFunction · 0.36