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

Method walk

dask/array/numpy_compat.py:129–145  ·  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

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