Skip to content

Commit

Permalink
Revert 'recursively_apply' hiding (TBD in another PR).
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Dec 7, 2022
1 parent 437e423 commit abb8396
Show file tree
Hide file tree
Showing 37 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions src/awkward/_connect/jax/trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def action(node, **kwargs):
if isinstance(node, ak.contents.NumpyArray):
data_ptrs.append(node.data)

layout._recursively_apply(action=action, return_array=False, numpy_to_regular=False)
layout.recursively_apply(action=action, return_array=False, numpy_to_regular=False)

return data_ptrs

Expand All @@ -43,7 +43,7 @@ def action(node, **kwargs):
buffer, parameters=node.parameters, backend=backend
)

return layout._recursively_apply(action=action, numpy_to_regular=False)
return layout.recursively_apply(action=action, numpy_to_regular=False)


T = TypeVar(
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_connect/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def unary_action(layout, **ignore):
assert isinstance(result, tuple) and len(result) == 1
return result[0]

out = inputs[where]._recursively_apply(
out = inputs[where].recursively_apply(
unary_action, behavior, function_name=ufunc.__name__, allow_records=False
)

Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/bitmaskedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def _completely_flatten(self, backend, options):
else:
return [self]

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._backend.nplike.known_shape:
Expand All @@ -636,7 +636,7 @@ def _recursively_apply_impl(
def continuation():
return make(
self._mask,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -653,7 +653,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/bytemaskedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ def _completely_flatten(self, backend, options):
else:
return [self]

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._backend.nplike.known_shape:
Expand All @@ -1019,7 +1019,7 @@ def _recursively_apply_impl(
def continuation():
return make(
self._mask,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -1034,7 +1034,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ def completely_flatten(
def _completely_flatten(self, backend, options):
raise ak._errors.wrap_error(NotImplementedError)

def _recursively_apply(
def recursively_apply(
self,
action: ActionType,
behavior: dict | None = None,
Expand All @@ -1536,7 +1536,7 @@ def _recursively_apply(
return_array: bool = True,
function_name: str | None = None,
) -> Content | None:
return self._recursively_apply_impl(
return self._recursively_apply(
action,
behavior,
1,
Expand All @@ -1552,7 +1552,7 @@ def _recursively_apply(
},
)

def _recursively_apply_impl(
def _recursively_apply(
self,
action: ActionType,
behavior: dict | None,
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/contents/emptyarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def _to_numpy(self, allow_missing):
def _completely_flatten(self, backend, options):
return []

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if options["return_array"]:
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/indexedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def _to_numpy(self, allow_missing):
def _completely_flatten(self, backend, options):
return self.project()._completely_flatten(backend, options)

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if (
Expand All @@ -1038,7 +1038,7 @@ def _recursively_apply_impl(
def continuation():
return make(
index,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -1052,7 +1052,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/indexedoptionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ def _completely_flatten(self, backend, options):
else:
return [self]

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if (
Expand Down Expand Up @@ -1569,7 +1569,7 @@ def _recursively_apply_impl(
def continuation():
return make(
index,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -1583,7 +1583,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/listarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ def _completely_flatten(self, backend, options):
flat = next.content[next.offsets[0] : next.offsets[-1]]
return flat._completely_flatten(backend, options)

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if (
Expand All @@ -1429,7 +1429,7 @@ def continuation():
return ListArray(
starts,
stops,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand All @@ -1443,7 +1443,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/listoffsetarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,7 @@ def _completely_flatten(self, backend, options):
flat = self._content[self._offsets[0] : self._offsets[-1]]
return flat._completely_flatten(backend, options)

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._backend.nplike.known_shape and self._backend.nplike.known_data:
Expand All @@ -2019,7 +2019,7 @@ def _recursively_apply_impl(
def continuation():
return ListOffsetArray(
offsets,
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand All @@ -2033,7 +2033,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand Down
4 changes: 2 additions & 2 deletions src/awkward/contents/numpyarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,11 +1287,11 @@ def _completely_flatten(self, backend, options):
)
]

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._data.ndim != 1 and options["numpy_to_regular"]:
return self.to_RegularArray()._recursively_apply_impl(
return self.to_RegularArray()._recursively_apply(
action, behavior, depth, depth_context, lateral_context, options
)

Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/recordarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ def _completely_flatten(self, backend, options):
)
)

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._backend.nplike.known_shape:
Expand All @@ -980,7 +980,7 @@ def continuation():
)
return RecordArray(
[
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -1000,7 +1000,7 @@ def continuation():

def continuation():
for content in contents:
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/regulararray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ def _completely_flatten(self, backend, options):
flat = self._content[: self._length * self._size]
return flat._completely_flatten(backend, options)

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if self._backend.nplike.known_shape:
Expand All @@ -1293,7 +1293,7 @@ def _recursively_apply_impl(

def continuation():
return RegularArray(
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand All @@ -1309,7 +1309,7 @@ def continuation():
else:

def continuation():
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth + 1,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/unionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ def _completely_flatten(self, backend, options):
)
return out

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if options["return_array"]:
Expand All @@ -1523,7 +1523,7 @@ def continuation():
self._tags,
self._index,
[
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -1540,7 +1540,7 @@ def continuation():

def continuation():
for content in self._contents:
content._recursively_apply_impl(
content._recursively_apply(
action,
behavior,
depth,
Expand Down
6 changes: 3 additions & 3 deletions src/awkward/contents/unmaskedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def _completely_flatten(self, backend, options):
else:
return [self]

def _recursively_apply_impl(
def _recursively_apply(
self, action, behavior, depth, depth_context, lateral_context, options
):
if options["return_array"]:
Expand All @@ -475,7 +475,7 @@ def _recursively_apply_impl(

def continuation():
return make(
self._content._recursively_apply_impl(
self._content._recursively_apply(
action,
behavior,
depth,
Expand All @@ -489,7 +489,7 @@ def continuation():
else:

def continuation():
self._content._recursively_apply_impl(
self._content._recursively_apply(
action,
behavior,
depth,
Expand Down
4 changes: 2 additions & 2 deletions src/awkward/operations/ak_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def getfunction2(layout, depth, **kwargs):
"characters of a string; please split it into lists"
)
)
nextlayout = layout._recursively_apply(
nextlayout = layout.recursively_apply(
getgetfunction1(inside), behavior
)
return newaxis(nextlayout, outside)
Expand All @@ -350,7 +350,7 @@ def getfunction2(layout, depth, **kwargs):

def apply(x, i):
layout = ak.operations.to_layout(x, allow_record=False, allow_other=False)
return layout._recursively_apply(getgetfunction2(i), behavior)
return layout.recursively_apply(getgetfunction2(i), behavior)

toflatten = []
if nested is None or nested is False:
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def action(layout, **kwargs):

layout = ak.operations.to_layout(array, allow_record=False, allow_other=False)
behavior = ak._util.behavior_of(array)
layout._recursively_apply(action, behavior=behavior)
layout.recursively_apply(action, behavior=behavior)

return ak._util.wrap(output[0], behavior, highlevel)
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_fill_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ def action(layout, depth, depth_context, **kwargs):
return maybe_fillna(layout)

depth_context = {"posaxis": axis}
out = arraylayout._recursively_apply(action, behavior, depth_context=depth_context)
out = arraylayout.recursively_apply(action, behavior, depth_context=depth_context)

return ak._util.wrap(out, behavior, highlevel)
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_firsts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def action(layout, depth, depth_context, **kwargs):
depth_context["posaxis"] = posaxis

depth_context = {"posaxis": posaxis}
out = layout._recursively_apply(
out = layout.recursively_apply(
action, behavior, depth_context, numpy_to_regular=True
)

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_from_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ def remove_revertable(layout, **kwargs):
if hasattr(layout, "__pyarrow_original"):
del layout.__pyarrow_original

out._recursively_apply(remove_revertable)
out.recursively_apply(remove_revertable)

return ak._util.wrap(out, behavior, highlevel)
Loading

0 comments on commit abb8396

Please sign in to comment.