Skip to content

Commit 02858f8

Browse files
feat: Adding awkward.semipublic submodule (#3152)
* Renaming _prettyprint to prettyprint (no longer private) * _prettyprint remains as a deprecated submodule * highlevel.py: removing unnecessary prettyprint imports * Fixing (deprecated) _prettyprint with explicit imports. * Putting remove_structure in contents.remove_structure submodule. Also adding a unit test for this and prettyprint. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ef1e851 commit 02858f8

File tree

7 files changed

+554
-491
lines changed

7 files changed

+554
-491
lines changed

src/awkward/_do.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from awkward._nplikes.numpy_like import NumpyMetadata
1212
from awkward._typing import Any, AxisMaybeNone, Literal
1313
from awkward.contents.content import ActionType, Content
14+
from awkward.contents.remove_structure import remove_structure
1415
from awkward.errors import AxisError
1516
from awkward.forms import form
1617
from awkward.record import Record
@@ -191,44 +192,6 @@ def pad_none(
191192
return layout._pad_none(length, axis, 1, clip)
192193

193194

194-
def remove_structure(
195-
layout: Content | Record,
196-
backend: Backend | None = None,
197-
flatten_records: bool = True,
198-
function_name: str | None = None,
199-
drop_nones: bool = True,
200-
keepdims: bool = False,
201-
allow_records: bool = False,
202-
list_to_regular: bool = False,
203-
):
204-
if isinstance(layout, Record):
205-
return remove_structure(
206-
layout._array[layout._at : layout._at + 1],
207-
backend,
208-
flatten_records,
209-
function_name,
210-
drop_nones,
211-
keepdims,
212-
allow_records,
213-
)
214-
215-
else:
216-
if backend is None:
217-
backend = layout._backend
218-
arrays = layout._remove_structure(
219-
backend,
220-
{
221-
"flatten_records": flatten_records,
222-
"function_name": function_name,
223-
"drop_nones": drop_nones,
224-
"keepdims": keepdims,
225-
"allow_records": allow_records,
226-
"list_to_regular": list_to_regular,
227-
},
228-
)
229-
return tuple(arrays)
230-
231-
232195
def flatten(layout: Content, axis: int = 1) -> Content:
233196
offsets, flattened = layout._offsets_and_flattened(axis, 1)
234197
return flattened

0 commit comments

Comments
 (0)