Skip to content

Commit

Permalink
fix: Record is not in contents, but in record
Browse files Browse the repository at this point in the history
  • Loading branch information
ianna committed Sep 27, 2022
1 parent 3008f23 commit 463e7e2
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/awkward/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ def _jax_unflatten(cls, aux_data, children):
class Record(NDArrayOperatorsMixin):
"""
Args:
data (#ak.contents.Record, #ak.Record, str, or dict):
data (#ak.record.Record, #ak.Record, str, or dict):
Data to wrap or convert into a record.
If a string, the data are assumed to be JSON.
If a dict, calls #ak.from_iter, which assumes all inner
Expand Down Expand Up @@ -1532,19 +1532,19 @@ def __init__(
@property
def layout(self):
"""
The #ak.contents.Record that contains composable #ak.contents.Content
The #ak.record.Record that contains composable #ak.contents.Content
elements to determine how the array is structured.
See #ak.Array.layout for a more complete description.
The #ak.contents.Record is not a subclass of #ak.contents.Content in
The #ak.record.Record is not a subclass of #ak.contents.Content in
Python (note: [Record](../_static/classawkward_1_1Record.html) *is* a
subclass of [Content](../_static/classawkward_1_1Content.html) in
C++!) and it is not composable with them: #ak.contents.Record contains
C++!) and it is not composable with them: #ak.record.Record contains
one #ak.contents.RecordArray (which is a #ak.contents.Content), but
#ak.contents.Content nodes cannot contain a #ak.contents.Record.
#ak.contents.Content nodes cannot contain a #ak.record.Record.
A #ak.contents.Record is not an independent entity from its
A #ak.record.Record is not an independent entity from its
#ak.contents.RecordArray; it's really just a marker indicating which
element to select. The XML representation reflects that:
Expand Down
8 changes: 4 additions & 4 deletions src/awkward/nplike.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def asarray(self, array, dtype=None, order=None):
ak.highlevel.Array,
ak.highlevel.Record,
ak.contents.Content,
ak.contents.Record,
ak.record.Record,
),
):
out = ak.operations.ak_to_cupy.to_cupy(array)
Expand Down Expand Up @@ -600,7 +600,7 @@ def ascontiguousarray(self, array, dtype=None):
ak.highlevel.Array,
ak.highlevel.Record,
ak.contents.Content,
ak.contents.Record,
ak.record.Record,
),
):
out = ak.operations.ak_to_cupy.to_cupy(array)
Expand Down Expand Up @@ -730,7 +730,7 @@ def to_rectilinear(self, array, *args, **kwargs):
ak.Record,
ak.ArrayBuilder,
ak.contents.Content,
ak.contents.Record,
ak.record.Record,
ak._ext.ArrayBuilder,
),
):
Expand Down Expand Up @@ -782,7 +782,7 @@ def ascontiguousarray(self, array, dtype=None):
ak.highlevel.Array,
ak.highlevel.Record,
ak.contents.Content,
ak.contents.Record,
ak.record.Record,
),
):
out = ak.operations.ak_to_jax.to_jax(array)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_from_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def from_iter(
behavior (None or dict): Custom #ak.behavior for the output array, if
high-level.
allow_record (bool): If True, the outermost element may be a record
(returning #ak.Record or #ak.contents.Record type, depending on
(returning #ak.Record or #ak.record.Record type, depending on
`highlevel`); if False, the outermost element must be an array.
initial (int): Initial size (in bytes) of buffers used by the
[ak::ArrayBuilder](_static/classawkward_1_1ArrayBuilder.html).
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_is_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def is_tuple(array):
"""
Args:
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.contents.Record, #ak.ArrayBuilder):
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.record.Record, #ak.ArrayBuilder):
Array or record to check.
If `array` is a record, this returns True if the record is a tuple.
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_is_valid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def is_valid(array, exception=False):
"""
Args:
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.contents.Record, #ak.ArrayBuilder):
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.record.Record, #ak.ArrayBuilder):
Array or record to check.
exception (bool): If True, validity errors raise exceptions.
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_packed.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def packed(array, highlevel=True, behavior=None):
- #ak.contents.ByteMaskedArray becomes an #ak.contents.IndexedOptionArray if it contains records, stays a #ak.contents.ByteMaskedArray otherwise
- #ak.contents.BitMaskedArray becomes an #ak.contents.IndexedOptionArray if it contains records, stays a #ak.contents.BitMaskedArray otherwise
- #ak.contents.UnionArray gets projected contents
- #ak.contents.Record becomes a record over a single-item #ak.contents.RecordArray
- #ak.record.Record becomes a record over a single-item #ak.contents.RecordArray
Example:
Expand Down
8 changes: 4 additions & 4 deletions src/awkward/operations/ak_to_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ def to_layout(
"""
Args:
array: Data to convert into a low-level #ak.contents.Content layout
or maybe #ak.contents.Record, its record equivalent, or other types.
allow_record (bool): If True, allow #ak.contents.Record as an output;
or maybe #ak.record.Record, its record equivalent, or other types.
allow_record (bool): If True, allow #ak.record.Record as an output;
otherwise, if the output would be a scalar record, raise an error.
allow_other (bool): If True, allow non-Awkward outputs; otherwise,
if the output would be another type, raise an error.
numpytype (tuple of NumPy types): Dtypes to allow from NumPy arrays.
Converts `array` (many types supported, including all Awkward Arrays and
Records) into a #ak.contents.Content and maybe #ak.contents.Record or
Records) into a #ak.contents.Content and maybe #ak.record.Record or
other types.
This function is usually used to sanitize inputs for other functions; it
would rarely be used in a data analysis because #ak.contents.Content and
#ak.contents.Record are lower-level than #ak.Array.
#ak.record.Record are lower-level than #ak.Array.
"""
with ak._util.OperationErrorContext(
"ak.to_layout",
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_validity_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def validity_error(array, exception=False):
"""
Args:
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.contents.Record, #ak.ArrayBuilder):
array (#ak.Array, #ak.Record, #ak.contents.Content, #ak.record.Record, #ak.ArrayBuilder):
Array or record to check.
exception (bool): If True, validity errors raise exceptions.
Expand Down

0 comments on commit 463e7e2

Please sign in to comment.