Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reduce qualified names of Content, Form, Type subclasses #1757

Merged
merged 4 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/awkward/_connect/jax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

def register_pytrees():
for cls in [
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.emptyarray.EmptyArray,
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.numpyarray.NumpyArray,
ak.contents.listarray.ListArray,
ak.contents.listoffsetarray.ListOffsetArray,
ak.contents.recordarray.RecordArray,
ak.contents.unionarray.UnionArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.BitMaskedArray,
ak.contents.ByteMaskedArray,
ak.contents.EmptyArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.NumpyArray,
ak.contents.ListArray,
ak.contents.ListOffsetArray,
ak.contents.RecordArray,
ak.contents.UnionArray,
ak.contents.UnmaskedArray,
ak.record.Record,
]:
jax.tree_util.register_pytree_node(
Expand Down Expand Up @@ -67,7 +67,7 @@ def _find_numpyarray_nodes(layout):
data_ptrs = []

def find_nparray_ptrs(node, **kwargs):
if isinstance(node, ak.contents.numpyarray.NumpyArray):
if isinstance(node, ak.contents.NumpyArray):
data_ptrs.append(node.data)

layout.recursively_apply(action=find_nparray_ptrs, return_array=False)
Expand All @@ -77,7 +77,7 @@ def find_nparray_ptrs(node, **kwargs):

def _replace_numpyarray_nodes(layout, buffers):
def replace_numpyarray_nodes(node, **kwargs):
if isinstance(node, ak.contents.numpyarray.NumpyArray):
if isinstance(node, ak.contents.NumpyArray):
buffer = buffers[0]
buffers.pop(0)
return ak.contents.NumpyArray(
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def _impl(array):
elif isinstance(array, (ak.contents.ListArray, ak.contents.ListOffsetArray)):
return _impl(array.toRegularArray())

elif isinstance(array, ak.contents.recordarray.RecordArray):
elif isinstance(array, ak.contents.RecordArray):
raise ak._errors.wrap_error(
ValueError(f"{module.__name__} does not support record structures")
)
Expand Down
34 changes: 17 additions & 17 deletions src/awkward/contents/bitmaskedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def toIndexedOptionArray64(self):
self._lsb_order,
),
)
return ak.contents.indexedoptionarray.IndexedOptionArray(
return ak.contents.IndexedOptionArray(
index[0 : self._length],
self._content,
self._identifier,
Expand Down Expand Up @@ -427,11 +427,11 @@ def simplify_optiontype(self):
if isinstance(
self._content,
(
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.ByteMaskedArray,
ak.contents.BitMaskedArray,
ak.contents.UnmaskedArray,
),
):
return self.toIndexedOptionArray64().simplify_optiontype()
Expand All @@ -448,11 +448,11 @@ def _mergeable(self, other, mergebool):
if isinstance(
other,
(
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.ByteMaskedArray,
ak.contents.BitMaskedArray,
ak.contents.UnmaskedArray,
),
):
return self._content.mergeable(other.content, mergebool)
Expand Down Expand Up @@ -579,11 +579,11 @@ def _validity_error(self, path):
elif isinstance(
self._content,
(
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.BitMaskedArray,
ak.contents.ByteMaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.UnmaskedArray,
),
):
return "{0} contains \"{1}\", the operation that made it might have forgotten to call 'simplify_optiontype()'"
Expand Down Expand Up @@ -677,7 +677,7 @@ def packed(self):
if content.length > self._length:
content = content[: self._length]

return ak.contents.indexedoptionarray.IndexedOptionArray(
return ak.contents.IndexedOptionArray(
next._index,
content,
next._identifier,
Expand Down
52 changes: 26 additions & 26 deletions src/awkward/contents/bytemaskedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def toIndexedOptionArray64(self):
),
)

return ak.contents.indexedoptionarray.IndexedOptionArray(
return ak.contents.IndexedOptionArray(
index, self._content, self._identifier, self._parameters, self._nplike
)

Expand Down Expand Up @@ -412,7 +412,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta
next = self._content._carry(nextcarry, True)
out = next._getitem_next_jagged(reducedstarts, reducedstops, slicecontent, tail)

out2 = ak.contents.indexedoptionarray.IndexedOptionArray(
out2 = ak.contents.IndexedOptionArray(
outindex, out, self._identifier, self._parameters, self._nplike
)
return out2.simplify_optiontype()
Expand All @@ -435,7 +435,7 @@ def _getitem_next(self, head, tail, advanced):

next = self._content._carry(nextcarry, True)
out = next._getitem_next(head, tail, advanced)
out2 = ak.contents.indexedoptionarray.IndexedOptionArray(
out2 = ak.contents.IndexedOptionArray(
outindex,
out,
self._identifier,
Expand Down Expand Up @@ -544,11 +544,11 @@ def simplify_optiontype(self):
if isinstance(
self._content,
(
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.ByteMaskedArray,
ak.contents.BitMaskedArray,
ak.contents.UnmaskedArray,
),
):
return self.toIndexedOptionArray64().simplify_optiontype()
Expand All @@ -570,7 +570,7 @@ def num(self, axis, depth=0):
next = self._content._carry(nextcarry, False)
out = next.num(posaxis, depth)

out2 = ak.contents.indexedoptionarray.IndexedOptionArray(
out2 = ak.contents.IndexedOptionArray(
outindex, out, None, self.parameters, self._nplike
)
return out2.simplify_optiontype()
Expand All @@ -590,7 +590,7 @@ def _offsets_and_flattened(self, axis, depth):
if offsets.length == 0:
return (
offsets,
ak.contents.indexedoptionarray.IndexedOptionArray(
ak.contents.IndexedOptionArray(
outindex, flattened, None, self._parameters, self._nplike
),
)
Expand Down Expand Up @@ -625,11 +625,11 @@ def _mergeable(self, other, mergebool):
if isinstance(
other,
(
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.ByteMaskedArray,
ak.contents.BitMaskedArray,
ak.contents.UnmaskedArray,
),
):
return self._content.mergeable(other.content, mergebool)
Expand Down Expand Up @@ -683,7 +683,7 @@ def _local_index(self, axis, depth):

next = self._content._carry(nextcarry, False)
out = next._local_index(posaxis, depth)
out2 = ak.contents.indexedoptionarray.IndexedOptionArray(
out2 = ak.contents.IndexedOptionArray(
outindex,
out,
self._identifier,
Expand All @@ -693,7 +693,7 @@ def _local_index(self, axis, depth):
return out2.simplify_optiontype()

def numbers_to_type(self, name):
return ak.contents.bytemaskedarray.ByteMaskedArray(
return ak.contents.ByteMaskedArray(
self._mask,
self._content.numbers_to_type(name),
self._valid_when,
Expand Down Expand Up @@ -770,7 +770,7 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth):
out = next._combinations(
n, replacement, recordlookup, parameters, posaxis, depth
)
out2 = ak.contents.indexedoptionarray.IndexedOptionArray(
out2 = ak.contents.IndexedOptionArray(
outindex, out, None, parameters, self._nplike
)
return out2.simplify_optiontype()
Expand Down Expand Up @@ -946,11 +946,11 @@ def _validity_error(self, path):
elif isinstance(
self._content,
(
ak.contents.bitmaskedarray.BitMaskedArray,
ak.contents.bytemaskedarray.ByteMaskedArray,
ak.contents.indexedarray.IndexedArray,
ak.contents.indexedoptionarray.IndexedOptionArray,
ak.contents.unmaskedarray.UnmaskedArray,
ak.contents.BitMaskedArray,
ak.contents.ByteMaskedArray,
ak.contents.IndexedArray,
ak.contents.IndexedOptionArray,
ak.contents.UnmaskedArray,
),
):
return "{0} contains \"{1}\", the operation that made it might have forgotten to call 'simplify_optiontype()'"
Expand Down Expand Up @@ -983,15 +983,15 @@ def _pad_none(self, target, axis, depth, clip):
)
)
next = self.project()._pad_none(target, posaxis, depth, clip)
return ak.contents.indexedoptionarray.IndexedOptionArray(
return ak.contents.IndexedOptionArray(
index,
next,
None,
self._parameters,
self._nplike,
).simplify_optiontype()
else:
return ak.contents.bytemaskedarray.ByteMaskedArray(
return ak.contents.ByteMaskedArray(
self._mask,
self._content._pad_none(target, posaxis, depth, clip),
self._valid_when,
Expand Down Expand Up @@ -1081,7 +1081,7 @@ def packed(self):
if content.length > self._mask.length:
content = content[: self._mask.length]

return ak.contents.indexedoptionarray.IndexedOptionArray(
return ak.contents.IndexedOptionArray(
next._index,
content,
next._identifier,
Expand Down
Loading