From 10bede146f25ffbf12de07659dacd04f146c0a1a Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Fri, 28 Oct 2022 15:21:01 -0500 Subject: [PATCH 1/3] chore: remove Identifier (once known as Identities) from codebase. --- docs-doxygen/index.md | 11 +- docs-sphinx/prepare_docstrings.py | 1 - docs-sphinx/redirects.json | 1 - docs-sphinx/reference/toctree.txt | 5 - src/awkward/__init__.py | 1 - src/awkward/_broadcasting.py | 2 +- src/awkward/_connect/cling.py | 69 +----- .../awkward_Identities32_to_Identities64.cu | 17 -- .../awkward_Identities_getitem_carry.cu | 28 --- .../cuda_kernels/awkward_new_Identities.cu | 15 -- src/awkward/_connect/jax/trees.py | 4 +- src/awkward/_connect/numba/layout.py | 119 ++-------- src/awkward/_connect/pyarrow.py | 3 +- src/awkward/_lookup.py | 57 ++--- src/awkward/_slicing.py | 7 +- src/awkward/_util.py | 2 - src/awkward/_v2.py | 1 - src/awkward/contents/bitmaskedarray.py | 25 +-- src/awkward/contents/bytemaskedarray.py | 50 +---- src/awkward/contents/content.py | 76 +------ src/awkward/contents/emptyarray.py | 50 ++--- src/awkward/contents/indexedarray.py | 42 +--- src/awkward/contents/indexedoptionarray.py | 73 ++----- src/awkward/contents/listarray.py | 54 +---- src/awkward/contents/listoffsetarray.py | 85 ++------ src/awkward/contents/numpyarray.py | 55 ++--- src/awkward/contents/recordarray.py | 47 +--- src/awkward/contents/regulararray.py | 57 +---- src/awkward/contents/unionarray.py | 47 +--- src/awkward/contents/unmaskedarray.py | 45 +--- src/awkward/forms/bitmaskedform.py | 8 +- src/awkward/forms/bytemaskedform.py | 8 +- src/awkward/forms/emptyform.py | 10 +- src/awkward/forms/form.py | 38 +--- src/awkward/forms/indexedform.py | 7 +- src/awkward/forms/indexedoptionform.py | 8 +- src/awkward/forms/listform.py | 7 +- src/awkward/forms/listoffsetform.py | 10 +- src/awkward/forms/numpyform.py | 12 +- src/awkward/forms/recordform.py | 7 +- src/awkward/forms/regularform.py | 10 +- src/awkward/forms/unionform.py | 9 +- src/awkward/forms/unmaskedform.py | 7 +- src/awkward/identifier.py | 140 ------------ src/awkward/operations/ak_from_buffers.py | 22 +- src/awkward/operations/ak_full_like.py | 3 - src/awkward/operations/ak_singletons.py | 1 - src/awkward/operations/ak_to_layout.py | 7 +- src/awkward/operations/ak_with_name.py | 1 - tests/test_0025-record-array.py | 12 - tests/test_0057-introducing-forms.py | 30 --- tests/test_0127-tomask-operation.py | 2 +- ...t_0884-index-and-identifier-refactoring.py | 18 -- tests/test_0914-types-and-forms.py | 205 ++---------------- tests/test_0927-numpy-array-nbytes.py | 101 ++------- ...958-new-forms-must-accept-old-form-json.py | 156 +++---------- tests/test_1613-generator-tolayout-records.py | 26 --- tests/test_1766-record-form-fields.py | 15 -- 58 files changed, 292 insertions(+), 1637 deletions(-) delete mode 100644 src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu delete mode 100644 src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu delete mode 100644 src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu delete mode 100644 src/awkward/identifier.py diff --git a/docs-doxygen/index.md b/docs-doxygen/index.md index ad892acaaa..c6f9799d3f 100644 --- a/docs-doxygen/index.md +++ b/docs-doxygen/index.md @@ -57,8 +57,6 @@ Note that [ak::PartitionedArray](classawkward_1_1PartitionedArray.html) and its **Index for layout nodes:** integer and boolean arrays that define the shape of the data structure, such as boolean masks in [ak::ByteMaskedArray](classawkward_1_1ByteMaskedArray.html), are not [ak::NumpyArray](classawkward_1_1NumpyArray.html) but a more constrained type called [ak::IndexOf](classawkward_1_1IndexOf.html). -**Identities for layout nodes:** [ak::IdentitiesOf](classawkward_1_1IdentitiesOf.html) are an optional surrogate key for certain join operations. (Not yet used.) - ### High-level data types This is the type of data in a high-level [ak.Array](../_auto/ak.Array.html) or [ak.Record](../_auto/ak.Record.html) as reported by [ak.type](../_auto/ak.type.html). It represents as much information as a data analyst needs to know (e.g. the distinction between variable and fixed-length lists, but not the distinction between [ak::ListArrayOf](classawkward_1_1ListArrayOf.html) and [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html)). @@ -157,7 +155,7 @@ The [ak::Builder](classawkward_1_1Builder.html) instances contain arrays of accu After an [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) is turned into a [ak::Content](classawkward_1_1Content.html) with [snapshot](classawkward_1_1ArrayBuilder.html#ac064fd827abb99f81772e59706f1a6a8), the read-only data and its append-only source share buffers (with `std::shared_ptr`). This makes the [snapshot](classawkward_1_1ArrayBuilder.html#ac064fd827abb99f81772e59706f1a6a8) operation fast and capable of being called frequently, and the `std::shared_ptr` manages the lifetime of buffers that stay in scope because a [ak::Content](classawkward_1_1Content.html) is using it, even if a [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html) is not (because it reallocated its internal buffer). -Array building is not as efficient as computing with pre-built arrays because the type-discovery makes each access a tree-descent. Array building is also an exception to the rule that C++ implementations do not touch array data (do not dereference pointers in [ak::RawArrayOf](classawkward_1_1RawArrayOf.html), [ak::NumpyArray](classawkward_1_1NumpyArray.html), [ak::IndexOf](classawkward_1_1IndexOf.html), and [ak::IdentitiesOf](classawkward_1_1IdentitiesOf.html)). The [ak::Builder](classawkward_1_1Builder.html) instances append to their [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html), which are assumed to exist in main memory, not a GPU. +Array building is not as efficient as computing with pre-built arrays because the type-discovery makes each access a tree-descent. Array building is also an exception to the rule that C++ implementations do not touch array data (do not dereference pointers in [ak::RawArrayOf](classawkward_1_1RawArrayOf.html), [ak::NumpyArray](classawkward_1_1NumpyArray.html), and [ak::IndexOf](classawkward_1_1IndexOf.html). The [ak::Builder](classawkward_1_1Builder.html) instances append to their [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html), which are assumed to exist in main memory, not a GPU. ### Reducers @@ -203,13 +201,6 @@ The following classes hide Awkward Array's dependence on RapidJSON, so that it's The kernels library is separated from the C++ codebase by a pure C interface, and thus the kernels could be used by other languages. -The CPU kernels are implemented in these files: - - * [kernels/getitem](getitem_8h.html): kernels to implement [ak::Content::getitem](classawkward_1_1Content.html#afe0d7eaa5d9d72290e3211efa4003678). - * [kernels/identities](kernels_2identities_8h.html): kernels to implement [ak::IdentitiesOf](classawkward_1_1IdentitiesOf.html). - * [kernels/reducers](reducers_8h.html): kernels to implement [ak::Content::reduce_next](classawkward_1_1Content.html#a4f4a15fd7609dbbc75a44e47291c186d). - * [kernels/operations](operations_8h.html): kernels to implement all other operations. - The GPU kernels follow exactly the same interface, though a different implementation. **FIXME:** kernel function names and arguments should be systematized in some searchable way. diff --git a/docs-sphinx/prepare_docstrings.py b/docs-sphinx/prepare_docstrings.py index 060d126903..46fbf57d10 100644 --- a/docs-sphinx/prepare_docstrings.py +++ b/docs-sphinx/prepare_docstrings.py @@ -439,7 +439,6 @@ def dofunction(link, linelink, shortname, name, astfcn): ], ["ak.layout.ArrayBuilder"], ["ak.index.Index"], - ["ak.identifier.Identifier"], [ "ak.types.ArrayType", "ak.types.ArrayType", diff --git a/docs-sphinx/redirects.json b/docs-sphinx/redirects.json index 5237a9aad6..ac80776cd0 100644 --- a/docs-sphinx/redirects.json +++ b/docs-sphinx/redirects.json @@ -18,7 +18,6 @@ "ak.layout.ByteMaskedArray.any-ext": "reference/generated/ak.contents.ByteMaskedArray.html", "ak.layout.Content.any-ext": "reference/generated/ak.contents.Content.html", "ak.layout.EmptyArray.any-ext": "reference/generated/ak.contents.EmptyArray.html", - "ak.layout.Identities.any-ext": "reference/generated/ak.identifier.Identifier.html", "ak.layout.Index.any-ext": "reference/generated/ak.index.Index.html", "ak.layout.IndexedArray.any-ext": "reference/generated/ak.contents.IndexedArray.html", "ak.layout.IndexedOptionArray.any-ext": "reference/generated/ak.contents.IndexedOptionArray.html", diff --git a/docs-sphinx/reference/toctree.txt b/docs-sphinx/reference/toctree.txt index 509b5eba6c..dcfc9bd00a 100644 --- a/docs-sphinx/reference/toctree.txt +++ b/docs-sphinx/reference/toctree.txt @@ -243,11 +243,6 @@ generated/ak.index.IndexU32 generated/ak.index.IndexU8. -.. toctree:: - :caption: Identities for layout nodes - - generated/ak.identifier.Identifier - .. toctree:: :caption: String behaviors diff --git a/src/awkward/__init__.py b/src/awkward/__init__.py index 88cc51d495..b84f813cb8 100644 --- a/src/awkward/__init__.py +++ b/src/awkward/__init__.py @@ -12,7 +12,6 @@ # layout classes; functionality that used to be in C++ (in Awkward 1.x) import awkward.index -import awkward.identifier import awkward.contents import awkward.record import awkward.types diff --git a/src/awkward/_broadcasting.py b/src/awkward/_broadcasting.py index 6f4fbe81e0..0f20330d37 100644 --- a/src/awkward/_broadcasting.py +++ b/src/awkward/_broadcasting.py @@ -54,7 +54,7 @@ def broadcast_pack(inputs, isscalar): elif isinstance(x, Content): nextinputs.append( RegularArray( - x, x.length if x.nplike.known_shape else 1, 1, None, None, x.nplike + x, x.length if x.nplike.known_shape else 1, 1, None, x.nplike ) ) isscalar.append(False) diff --git a/src/awkward/_connect/cling.py b/src/awkward/_connect/cling.py index fea9dfc696..3cb707b37a 100644 --- a/src/awkward/_connect/cling.py +++ b/src/awkward/_connect/cling.py @@ -482,13 +482,6 @@ def togenerator(form, flatlist_as_rvec): class Generator: - @classmethod - def form_from_identifier(cls, form): - if not form.has_identifier: - return None - else: - raise ak._errors.wrap_error(NotImplementedError("TODO: identifiers in C++")) - def IndexOf(self, arraytype): if arraytype == "int8_t": return ak.index.Index8 @@ -565,14 +558,12 @@ class NumpyArrayGenerator(Generator, ak._lookup.NumpyLookup): def from_form(cls, form, flatlist_as_rvec): return NumpyArrayGenerator( form.primitive, - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, primitive, identifier, parameters, flatlist_as_rvec): + def __init__(self, primitive, parameters, flatlist_as_rvec): self.primitive = primitive - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec @@ -581,7 +572,6 @@ def __hash__(self): ( type(self), self.primitive, - self.identifier, json.dumps(self.parameters), ) ) @@ -590,7 +580,6 @@ def __eq__(self, other): return ( isinstance(other, type(self)) and self.primitive == other.primitive - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -649,15 +638,13 @@ def from_form(cls, form, flatlist_as_rvec): return RegularArrayGenerator( togenerator(form.content, flatlist_as_rvec), form.size, - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, content, size, identifier, parameters, flatlist_as_rvec): + def __init__(self, content, size, parameters, flatlist_as_rvec): self.contenttype = content self.size = size - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.contenttype.flatlist_as_rvec @@ -668,7 +655,6 @@ def __hash__(self): type(self), self.contenttype, self.size, - self.identifier, json.dumps(self.parameters), ) ) @@ -678,7 +664,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.contenttype == other.contenttype and self.size == other.size - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -792,12 +777,11 @@ def from_form(cls, form, flatlist_as_rvec): return ListArrayGenerator( index_string, togenerator(form.content, flatlist_as_rvec), - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec): + def __init__(self, index_type, content, parameters, flatlist_as_rvec): if index_type == "i32": self.index_type = "int32_t" elif index_type == "u32": @@ -812,7 +796,6 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec self.contenttype = content self.indextype = self.index_type - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.content.flatlist_as_rvec @@ -823,7 +806,6 @@ def __hash__(self): type(self), self.index_type, self.content, - self.identifier, json.dumps(self.parameters), ) ) @@ -833,7 +815,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.index_type == other.index_type and self.content == other.content - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -945,12 +926,11 @@ def from_form(cls, form, flatlist_as_rvec): return IndexedArrayGenerator( form.index, togenerator(form.content, flatlist_as_rvec), - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec): + def __init__(self, index_type, content, parameters, flatlist_as_rvec): if index_type == "i32": self.indextype = "int32_t" elif index_type == "u32": @@ -960,7 +940,6 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec else: raise ak._errors.wrap_error(AssertionError(index_type)) self.contenttype = content - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.contenttype.flatlist_as_rvec @@ -971,7 +950,6 @@ def __hash__(self): type(self), self.indextype, self.contenttype, - self.identifier, json.dumps(self.parameters), ) ) @@ -981,7 +959,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.indextype == other.indextype and self.contenttype == other.contenttype - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1026,12 +1003,11 @@ def from_form(cls, form, flatlist_as_rvec): return IndexedOptionArrayGenerator( form.index, togenerator(form.content, flatlist_as_rvec), - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec): + def __init__(self, index_type, content, parameters, flatlist_as_rvec): if index_type == "i32": self.index_type = "int32_t" elif index_type == "i64": @@ -1039,7 +1015,6 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec else: raise ak._errors.wrap_error(AssertionError(index_type)) self.contenttype = content - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec self.indextype = self.index_type @@ -1051,7 +1026,6 @@ def __hash__(self): type(self), self.index_type, self.contenttype, - self.identifier, json.dumps(self.parameters), ) ) @@ -1061,7 +1035,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.index_type == other.index_type and self.contenttype == other.contenttype - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1111,15 +1084,13 @@ def from_form(cls, form, flatlist_as_rvec): return ByteMaskedArrayGenerator( togenerator(form.content, flatlist_as_rvec), form.valid_when, - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, content, valid_when, identifier, parameters, flatlist_as_rvec): + def __init__(self, content, valid_when, parameters, flatlist_as_rvec): self.contenttype = content self.valid_when = valid_when - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.contenttype.flatlist_as_rvec @@ -1131,7 +1102,6 @@ def __hash__(self): type(self), self.contenttype, self.valid_when, - self.identifier, json.dumps(self.parameters), ) ) @@ -1141,7 +1111,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.contenttype == other.contenttype and self.valid_when == other.valid_when - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1194,7 +1163,6 @@ def from_form(cls, form, flatlist_as_rvec): togenerator(form.content, flatlist_as_rvec), form.valid_when, form.lsb_order, - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) @@ -1204,14 +1172,12 @@ def __init__( content, valid_when, lsb_order, - identifier, parameters, flatlist_as_rvec, ): self.contenttype = content self.valid_when = valid_when self.lsb_order = lsb_order - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.contenttype.flatlist_as_rvec @@ -1223,7 +1189,6 @@ def __hash__(self): self.contenttype, self.valid_when, self.lsb_order, - self.identifier, json.dumps(self.parameters), ) ) @@ -1234,7 +1199,6 @@ def __eq__(self, other): and self.contenttype == other.contenttype and self.valid_when == other.valid_when and self.lsb_order == other.lsb_order - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1288,28 +1252,23 @@ class UnmaskedArrayGenerator(Generator, ak._lookup.UnmaskedLookup): def from_form(cls, form, flatlist_as_rvec): return UnmaskedArrayGenerator( togenerator(form.content, flatlist_as_rvec), - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, content, identifier, parameters, flatlist_as_rvec): + def __init__(self, content, parameters, flatlist_as_rvec): self.contenttype = content - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec assert self.flatlist_as_rvec == self.contenttype.flatlist_as_rvec def __hash__(self): - return hash( - (type(self), self.contenttype, self.identifier, json.dumps(self.parameters)) - ) + return hash((type(self), self.contenttype, json.dumps(self.parameters))) def __eq__(self, other): return ( isinstance(other, type(self)) and self.contenttype == other.contenttype - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1438,15 +1397,13 @@ def from_form(cls, form, flatlist_as_rvec): return RecordArrayGenerator( [togenerator(x, flatlist_as_rvec) for x in form.contents], None if form.is_tuple else form.fields, - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, contents, fields, identifier, parameters, flatlist_as_rvec): + def __init__(self, contents, fields, parameters, flatlist_as_rvec): self.contenttypes = tuple(contents) self.fields = None if fields is None else tuple(fields) - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec for content in self.contenttypes: @@ -1460,7 +1417,6 @@ def __hash__(self): type(self), self.contenttypes, self.fields, - self.identifier, json.dumps(self.parameters), ) ) @@ -1470,7 +1426,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.contenttypes == other.contenttypes and self.fields == other.fields - and self.identifier == other.identifier and self.parameters == other.parameters ) @@ -1537,12 +1492,11 @@ def from_form(cls, form, flatlist_as_rvec): return UnionArrayGenerator( form.index, [togenerator(x, flatlist_as_rvec) for x in form.contents], - cls.form_from_identifier(form), form.parameters, flatlist_as_rvec, ) - def __init__(self, index_type, contents, identifier, parameters, flatlist_as_rvec): + def __init__(self, index_type, contents, parameters, flatlist_as_rvec): self.tagstype = "int8_t" if index_type == "i32": self.indextype = "int32_t" @@ -1553,7 +1507,6 @@ def __init__(self, index_type, contents, identifier, parameters, flatlist_as_rve else: raise ak._errors.wrap_error(AssertionError(index_type)) self.contenttypes = tuple(contents) - self.identifier = identifier self.parameters = parameters self.flatlist_as_rvec = flatlist_as_rvec for content in self.contenttypes: @@ -1565,7 +1518,6 @@ def __hash__(self): type(self), self.indextype, self.contenttypes, - self.identifier, json.dumps(self.parameters), ) ) @@ -1575,7 +1527,6 @@ def __eq__(self, other): isinstance(other, type(self)) and self.indextype == other.indextype and self.contenttypes == other.contenttypes - and self.identifier == other.identifier and self.parameters == other.parameters ) diff --git a/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu deleted file mode 100644 index 02c54c8cff..0000000000 --- a/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu +++ /dev/null @@ -1,17 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -template -__global__ void -awkward_Identities32_to_Identities64(T* toptr, - const C* fromptr, - int64_t length, - int64_t width, - uint64_t invocation_index, - uint64_t* err_code) { - if (err_code[0] == NO_ERROR) { - int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x; - if (thread_id < (length * width)) { - toptr[thread_id] = (int64_t)(fromptr[thread_id]); - } - } -} diff --git a/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu deleted file mode 100644 index 72cc6f0a9f..0000000000 --- a/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu +++ /dev/null @@ -1,28 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -enum class IDENTITIES_GETITEM_CARRY { - IND_OUT_OF_RANGE, // message: "index out of range" -}; - -template -__global__ void -awkward_Identities_getitem_carry(T* newidentitiesptr, - const C* identitiesptr, - const U* carryptr, - int64_t lencarry, - int64_t width, - int64_t length, - uint64_t invocation_index, - uint64_t* err_code) { - if (err_code[0] == NO_ERROR) { - int64_t thread_id = (blockIdx.x * blockDim.x + threadIdx.x) / width; - int64_t thready_id = (blockIdx.x * blockDim.x + threadIdx.x) % width; - if (thread_id < lencarry) { - if (carryptr[thread_id] >= length) { - RAISE_ERROR(IDENTITIES_GETITEM_CARRY::IND_OUT_OF_RANGE) - } - newidentitiesptr[width * thread_id + thready_id] = - identitiesptr[width * carryptr[thread_id] + thready_id]; - } - } -} diff --git a/src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu deleted file mode 100644 index 1418729e74..0000000000 --- a/src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu +++ /dev/null @@ -1,15 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -template -__global__ void -awkward_new_Identities(T* toptr, - int64_t length, - uint64_t invocation_index, - uint64_t* err_code) { - if (err_code[0] == NO_ERROR) { - int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x; - if (thread_id < length) { - toptr[thread_id] = thread_id; - } - } -} diff --git a/src/awkward/_connect/jax/trees.py b/src/awkward/_connect/jax/trees.py index b04f43b7d5..47abba9210 100644 --- a/src/awkward/_connect/jax/trees.py +++ b/src/awkward/_connect/jax/trees.py @@ -42,9 +42,7 @@ def action(node, **kwargs): if not (numpy.is_own_array(buffer) or jax.is_own_array(buffer)): return else: - return ak.contents.NumpyArray( - buffer, node.identifier, node.parameters, nplike=nplike - ) + return ak.contents.NumpyArray(buffer, node.parameters, nplike=nplike) return layout.recursively_apply(action=action, numpy_to_regular=False) diff --git a/src/awkward/_connect/numba/layout.py b/src/awkward/_connect/numba/layout.py index 511245b30d..bd563ce2d4 100644 --- a/src/awkward/_connect/numba/layout.py +++ b/src/awkward/_connect/numba/layout.py @@ -23,13 +23,6 @@ def fake_typeof(obj, c): class ContentType(numba.types.Type): - @classmethod - def from_form_identifier(cls, form): - if not form.has_identifier: - return numba.none - else: - raise NotImplementedError("TODO: identifiers in Numba") - @classmethod def from_form_index(cls, index_string): if index_string == "i8": @@ -273,18 +266,13 @@ class NumpyArrayType(ContentType, ak._lookup.NumpyLookup): def from_form(cls, form): t = numba.from_dtype(ak.types.numpytype.primitive_to_dtype(form.primitive)) arraytype = numba.types.Array(t, 1, "C") - return NumpyArrayType( - arraytype, cls.from_form_identifier(form), form.parameters - ) + return NumpyArrayType(arraytype, form.parameters) - def __init__(self, arraytype, identifiertype, parameters): + def __init__(self, arraytype, parameters): super().__init__( - name="ak.NumpyArrayType({}, {}, {})".format( - arraytype.name, identifiertype.name, json.dumps(parameters) - ) + name=f"ak.NumpyArrayType({arraytype.name}, {json.dumps(parameters)})" ) self.arraytype = arraytype - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -337,19 +325,15 @@ def from_form(cls, form): return RegularArrayType( ak._connect.numba.arrayview.tonumbatype(form.content), form.size, - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, contenttype, size, identifiertype, parameters): + def __init__(self, contenttype, size, parameters): super().__init__( - name="ak.RegularArrayType({}, {}, {}, {})".format( - contenttype.name, size, identifiertype.name, json.dumps(parameters) - ) + name=f"ak.RegularArrayType({contenttype.name}, {size}, {json.dumps(parameters)})" ) self.contenttype = contenttype self.size = size - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -420,22 +404,15 @@ def from_form(cls, form): return ListArrayType( cls.from_form_index(index_string), ak._connect.numba.arrayview.tonumbatype(form.content), - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, indextype, contenttype, identifiertype, parameters): + def __init__(self, indextype, contenttype, parameters): super().__init__( - name="ak.ListArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.ListArrayType({indextype.name}, {contenttype.name}, {json.dumps(parameters)})" ) self.indextype = indextype self.contenttype = contenttype - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -513,22 +490,15 @@ def from_form(cls, form): return IndexedArrayType( cls.from_form_index(form.index), ak._connect.numba.arrayview.tonumbatype(form.content), - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, indextype, contenttype, identifiertype, parameters): + def __init__(self, indextype, contenttype, parameters): super().__init__( - name="ak.IndexedArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.IndexedArrayType({indextype.name}, {contenttype.name}, {json.dumps(parameters)})" ) self.indextype = indextype self.contenttype = contenttype - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -614,22 +584,15 @@ def from_form(cls, form): return IndexedOptionArrayType( cls.from_form_index(form.index), ak._connect.numba.arrayview.tonumbatype(form.content), - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, indextype, contenttype, identifiertype, parameters): + def __init__(self, indextype, contenttype, parameters): super().__init__( - name="ak.IndexedOptionArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.IndexedOptionArrayType({indextype.name}, {contenttype.name}, {json.dumps(parameters)})" ) self.indextype = indextype self.contenttype = contenttype - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -733,24 +696,16 @@ def from_form(cls, form): cls.from_form_index(form.mask), ak._connect.numba.arrayview.tonumbatype(form.content), form.valid_when, - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, masktype, contenttype, valid_when, identifiertype, parameters): + def __init__(self, masktype, contenttype, valid_when, parameters): super().__init__( - name="ak.ByteMaskedArrayType({}, {}, {}, {}, {})".format( - masktype.name, - contenttype.name, - valid_when, - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.ByteMaskedArrayType({masktype.name}, {contenttype.name}, {valid_when}, {json.dumps(parameters)})" ) self.masktype = masktype self.contenttype = contenttype self.valid_when = valid_when - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -854,28 +809,17 @@ def from_form(cls, form): ak._connect.numba.arrayview.tonumbatype(form.content), form.valid_when, form.lsb_order, - cls.from_form_identifier(form), form.parameters, ) - def __init__( - self, masktype, contenttype, valid_when, lsb_order, identifiertype, parameters - ): + def __init__(self, masktype, contenttype, valid_when, lsb_order, parameters): super().__init__( - name="ak.BitMaskedArrayType({}, {}, {}, {}, {}, {})".format( - masktype.name, - contenttype.name, - valid_when, - lsb_order, - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.BitMaskedArrayType({masktype.name}, {contenttype.name}, {valid_when}, {lsb_order}, {json.dumps(parameters)})" ) self.masktype = masktype self.contenttype = contenttype self.valid_when = valid_when self.lsb_order = lsb_order - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -995,18 +939,14 @@ class UnmaskedArrayType(ContentType, ak._lookup.UnmaskedLookup): def from_form(cls, form): return UnmaskedArrayType( ak._connect.numba.arrayview.tonumbatype(form.content), - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, contenttype, identifiertype, parameters): + def __init__(self, contenttype, parameters): super().__init__( - name="ak.UnmaskedArrayType({}, {}, {})".format( - contenttype.name, identifiertype.name, json.dumps(parameters) - ) + name=f"ak.UnmaskedArrayType({contenttype.name}, {json.dumps(parameters)})" ) self.contenttype = contenttype - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): @@ -1089,23 +1029,15 @@ def from_form(cls, form): return RecordArrayType( [ak._connect.numba.arrayview.tonumbatype(x) for x in form.contents], None if form.is_tuple else form.fields, - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, contenttypes, fields, identifiertype, parameters): + def __init__(self, contenttypes, fields, parameters): super().__init__( - name="ak.RecordArrayType(({}{}), ({}), {}, {})".format( - ", ".join(x.name for x in contenttypes), - "," if len(contenttypes) == 1 else "", - "None" if fields is None else repr(tuple(fields)), - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.RecordArrayType(({', '.join(x.name for x in contenttypes)}{',' if len(contenttypes) == 1 else ''}), {'None' if fields is None else repr(tuple(fields))}, {json.dumps(parameters)})" ) self.contenttypes = contenttypes self.fields = fields - self.identifiertype = identifiertype self.parameters = parameters def fieldindex(self, key): @@ -1384,25 +1316,16 @@ def from_form(cls, form): cls.from_form_index(form.tags), cls.from_form_index(form.index), [ak._connect.numba.arrayview.tonumbatype(x) for x in form.contents], - cls.from_form_identifier(form), form.parameters, ) - def __init__(self, tagstype, indextype, contenttypes, identifiertype, parameters): + def __init__(self, tagstype, indextype, contenttypes, parameters): super().__init__( - name="ak.UnionArrayType({}, {}, ({}{}), {}, {})".format( - tagstype.name, - indextype.name, - ", ".join(x.name for x in contenttypes), - "," if len(contenttypes) == 1 else "", - identifiertype.name, - json.dumps(parameters), - ) + name=f"ak.UnionArrayType({tagstype.name}, {indextype.name}, ({', '.join(x.name for x in contenttypes)}{',' if len(contenttypes) == 1 else ''}), {json.dumps(parameters)})" ) self.tagstype = tagstype self.indextype = indextype self.contenttypes = contenttypes - self.identifiertype = identifiertype self.parameters = parameters def has_field(self, key): diff --git a/src/awkward/_connect/pyarrow.py b/src/awkward/_connect/pyarrow.py index b668bc72e5..cf1372e1a7 100644 --- a/src/awkward/_connect/pyarrow.py +++ b/src/awkward/_connect/pyarrow.py @@ -876,7 +876,7 @@ def remove_optiontype(akarray): assert type(akarray).is_OptionType if isinstance(akarray, ak.contents.IndexedOptionArray): return ak.contents.IndexedArray( - akarray.index, akarray.content, akarray.identifier, akarray.parameters + akarray.index, akarray.content, akarray.parameters ) else: return akarray.content @@ -888,7 +888,6 @@ def form_remove_optiontype(akform): return ak.forms.IndexedForm( akform.index, akform.content, - akform.has_identifier, akform.parameters, akform.form_key, ) diff --git a/src/awkward/_lookup.py b/src/awkward/_lookup.py index be1d585370..997c02e4ed 100644 --- a/src/awkward/_lookup.py +++ b/src/awkward/_lookup.py @@ -71,27 +71,21 @@ def tolookup(layout, positions): class ContentLookup: - @classmethod - def tolookup_identifier(cls, layout, positions): - if layout.identifier is None: - positions.append(-1) - else: - positions.append(layout.identifier.data) + pass class NumpyLookup(ContentLookup): - IDENTIFIER = 0 ARRAY = 1 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.contiguous().data) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 assert fields == () return ak.contents.NumpyArray( lookup.positions[pos + self.ARRAY], parameters=self.parameters @@ -99,21 +93,20 @@ def tolayout(self, lookup, pos, fields): class RegularLookup(ContentLookup): - IDENTIFIER = 0 ZEROS_LENGTH = 1 CONTENT = 2 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(len(layout)) positions.append(None) positions[pos + cls.CONTENT] = tolookup(layout.content, positions) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) @@ -126,7 +119,6 @@ def tolayout(self, lookup, pos, fields): class ListLookup(ContentLookup): - IDENTIFIER = 0 STARTS = 1 STOPS = 2 CONTENT = 3 @@ -134,7 +126,7 @@ class ListLookup(ContentLookup): @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.starts.data) positions.append(layout.stops.data) positions.append(None) @@ -142,7 +134,7 @@ def tolookup(cls, layout, positions): return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 starts = self.IndexOf(self.indextype)(lookup.positions[pos + self.STARTS]) stops = self.IndexOf(self.indextype)(lookup.positions[pos + self.STOPS]) content = self.contenttype.tolayout( @@ -152,21 +144,20 @@ def tolayout(self, lookup, pos, fields): class IndexedLookup(ContentLookup): - IDENTIFIER = 0 INDEX = 1 CONTENT = 2 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.index.data) positions.append(None) positions[pos + cls.CONTENT] = tolookup(layout.content, positions) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 index = self.IndexOf(self.indextype)(lookup.positions[pos + self.INDEX]) content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields @@ -175,21 +166,20 @@ def tolayout(self, lookup, pos, fields): class IndexedOptionLookup(ContentLookup): - IDENTIFIER = 0 INDEX = 1 CONTENT = 2 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.index.data) positions.append(None) positions[pos + cls.CONTENT] = tolookup(layout.content, positions) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 index = self.IndexOf(self.indextype)(lookup.positions[pos + self.INDEX]) content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields @@ -200,21 +190,20 @@ def tolayout(self, lookup, pos, fields): class ByteMaskedLookup(ContentLookup): - IDENTIFIER = 0 MASK = 1 CONTENT = 2 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.mask.data) positions.append(None) positions[pos + cls.CONTENT] = tolookup(layout.content, positions) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 mask = self.IndexOf(self.masktype)(lookup.positions[pos + self.MASK]) content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields @@ -225,7 +214,6 @@ def tolayout(self, lookup, pos, fields): class BitMaskedLookup(ContentLookup): - IDENTIFIER = 0 LENGTH = 1 MASK = 2 CONTENT = 3 @@ -233,7 +221,7 @@ class BitMaskedLookup(ContentLookup): @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(len(layout)) positions.append(layout.mask.data) positions.append(None) @@ -241,7 +229,7 @@ def tolookup(cls, layout, positions): return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 mask = self.IndexOf(self.masktype)(lookup.positions[pos + self.MASK]) content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields @@ -257,19 +245,18 @@ def tolayout(self, lookup, pos, fields): class UnmaskedLookup(ContentLookup): - IDENTIFIER = 0 CONTENT = 1 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(None) positions[pos + cls.CONTENT] = tolookup(layout.content, positions) return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) @@ -277,14 +264,13 @@ def tolayout(self, lookup, pos, fields): class RecordLookup(ContentLookup): - IDENTIFIER = 0 LENGTH = 1 CONTENTS = 2 @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(len(layout)) positions.extend([None] * len(layout.contents)) for i, content in enumerate(layout.contents): @@ -292,7 +278,7 @@ def tolookup(cls, layout, positions): return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 if len(fields) > 0: index = self.fieldindex(fields[0]) assert index is not None @@ -316,7 +302,6 @@ def tolayout(self, lookup, pos, fields): class UnionLookup(ContentLookup): - IDENTIFIER = 0 TAGS = 1 INDEX = 2 CONTENTS = 3 @@ -324,7 +309,7 @@ class UnionLookup(ContentLookup): @classmethod def tolookup(cls, layout, positions): pos = len(positions) - cls.tolookup_identifier(layout, positions) + positions.append(-1) # temporary: remove and decrement all CONSTANTS by 1 positions.append(layout.tags.data) positions.append(layout.index.data) positions.extend([None] * len(layout.contents)) @@ -333,7 +318,7 @@ def tolookup(cls, layout, positions): return pos def tolayout(self, lookup, pos, fields): - assert lookup.positions[pos + self.IDENTIFIER] == -1 + assert lookup.positions[pos] == -1 tags = self.IndexOf(self.tagstype)(lookup.positions[pos + self.TAGS]) index = self.IndexOf(self.indextype)(lookup.positions[pos + self.INDEX]) contents = [] diff --git a/src/awkward/_slicing.py b/src/awkward/_slicing.py index 0b9cf7b325..7d6e2c096f 100644 --- a/src/awkward/_slicing.py +++ b/src/awkward/_slicing.py @@ -195,7 +195,6 @@ def normalise_item_RegularArray_toListOffsetArray64(item): return ak.contents.ListOffsetArray( next.offsets, normalise_item_RegularArray_toListOffsetArray64(next.content), - identifier=item.identifier, parameters=item.parameters, ) @@ -219,7 +218,6 @@ def normalise_item_nested(item): else: next = ak.contents.NumpyArray( item.data.astype(np.int64), - identifier=item.identifier, parameters=item.parameters, nplike=item.nplike, ) @@ -234,7 +232,6 @@ def normalise_item_nested(item): return ak.contents.ListOffsetArray( item.offsets, normalise_item_nested(item.content), - identifier=item.identifier, parameters=item.parameters, ) @@ -293,7 +290,6 @@ def normalise_item_nested(item): return ak.contents.IndexedOptionArray( ak.index.Index64(nextindex, nplike=item.nplike), normalise_item_nested(projected), - identifier=item.identifier, parameters=item.parameters, ) @@ -320,7 +316,6 @@ def normalise_item_nested(item): return ak.contents.IndexedOptionArray( ak.index.Index64(nextindex, nplike=item.nplike), nextcontent, - identifier=item.identifier, parameters=item.parameters, ) @@ -519,5 +514,5 @@ def getitem_next_array_wrap(outcontent, shape, outer_length=0): size = shape[i] if isinstance(size, ak._typetracer.UnknownLengthType): size = 1 - outcontent = ak.contents.RegularArray(outcontent, size, length, None, None) + outcontent = ak.contents.RegularArray(outcontent, size, length, None) return outcontent diff --git a/src/awkward/_util.py b/src/awkward/_util.py index 4b4cfed5f5..3a5c170567 100644 --- a/src/awkward/_util.py +++ b/src/awkward/_util.py @@ -492,7 +492,6 @@ def union_to_record(unionarray, anonymous): unionarray.tags, unionarray.index, contents, - unionarray.identifier, unionarray.parameters, ) @@ -537,7 +536,6 @@ def union_to_record(unionarray, anonymous): unionarray.tags, unionarray.index, union_contents, - unionarray.identifier, unionarray.parameters, ).simplify_uniontype() ) diff --git a/src/awkward/_v2.py b/src/awkward/_v2.py index 02643bf2eb..d200ddcbc6 100644 --- a/src/awkward/_v2.py +++ b/src/awkward/_v2.py @@ -15,7 +15,6 @@ from awkward import behaviors # noqa: F401 from awkward import contents # noqa: F401 from awkward import forms # noqa: F401 -from awkward import identifier # noqa: F401 from awkward import index # noqa: F401 from awkward import numba # noqa: F401 from awkward import operations # noqa: F401 diff --git a/src/awkward/contents/bitmaskedarray.py b/src/awkward/contents/bitmaskedarray.py index 5ff468be07..62fb4e94ec 100644 --- a/src/awkward/contents/bitmaskedarray.py +++ b/src/awkward/contents/bitmaskedarray.py @@ -24,7 +24,6 @@ def copy( valid_when=unset, length=unset, lsb_order=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -34,7 +33,6 @@ def copy( self._valid_when if valid_when is unset else valid_when, self._length if length is unset else length, self._lsb_order if lsb_order is unset else lsb_order, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -46,7 +44,6 @@ def __deepcopy__(self, memo): return self.copy( mask=copy.deepcopy(self._mask, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) @@ -57,7 +54,6 @@ def __init__( valid_when, length, lsb_order, - identifier=None, parameters=None, nplike=None, ): @@ -128,7 +124,7 @@ def __init__( self._valid_when = valid_when self._length = length self._lsb_order = lsb_order - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def mask(self): @@ -155,7 +151,6 @@ def _form_with_key(self, getkey): self._content._form_with_key(getkey), self._valid_when, self._lsb_order, - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -175,7 +170,6 @@ def typetracer(self): self._valid_when, self._length, self._lsb_order, - self._typetracer_identifier(), self._parameters, tt, ) @@ -191,7 +185,6 @@ def _forget_length(self): self._valid_when, ak._typetracer.UnknownLength, self._lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -222,7 +215,6 @@ def merge_parameters(self, parameters): self._valid_when, self._length, self._lsb_order, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -246,7 +238,6 @@ def toIndexedOptionArray64(self): return ak.contents.IndexedOptionArray( index[0 : self._length], self._content, - self._identifier, self._parameters, self._nplike, ) @@ -271,7 +262,6 @@ def toByteMaskedArray(self): bytemask[: self._length], self._content, self._valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -287,7 +277,6 @@ def toBitMaskedArray(self, valid_when, lsb_order): valid_when, self._length, lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -309,7 +298,6 @@ def toBitMaskedArray(self, valid_when, lsb_order): valid_when, self._length, lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -367,7 +355,6 @@ def _getitem_field(self, where, only_fields=()): self._valid_when, self._length, self._lsb_order, - self._field_identifier(where), None, self._nplike, ).simplify_optiontype() @@ -379,7 +366,6 @@ def _getitem_fields(self, where, only_fields=()): self._valid_when, self._length, self._lsb_order, - self._fields_identifier(where), None, self._nplike, ).simplify_optiontype() @@ -591,10 +577,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.mask._nbytes_part() + self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.mask._nbytes_part() + self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): return self.toByteMaskedArray()._pad_none(target, axis, depth, clip) @@ -638,7 +621,6 @@ def continuation(): self._valid_when, self._length, self._lsb_order, - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -684,7 +666,6 @@ def packed(self): return ak.contents.IndexedOptionArray( next._index, content, - next._identifier, next._parameters, self._nplike, ) @@ -706,7 +687,6 @@ def packed(self): self._valid_when, self._length, self._lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -736,7 +716,6 @@ def _to_nplike(self, nplike): valid_when=self._valid_when, length=len(self), lsb_order=self._lsb_order, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/bytemaskedarray.py b/src/awkward/contents/bytemaskedarray.py index 6ffbe18671..75ed2fa882 100644 --- a/src/awkward/contents/bytemaskedarray.py +++ b/src/awkward/contents/bytemaskedarray.py @@ -21,7 +21,6 @@ def copy( mask=unset, content=unset, valid_when=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -29,7 +28,6 @@ def copy( self._mask if mask is unset else mask, self._content if content is unset else content, self._valid_when if valid_when is unset else valid_when, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -41,13 +39,10 @@ def __deepcopy__(self, memo): return self.copy( mask=copy.deepcopy(self._mask, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__( - self, mask, content, valid_when, identifier=None, parameters=None, nplike=None - ): + def __init__(self, mask, content, valid_when, parameters=None, nplike=None): if not (isinstance(mask, Index) and mask.dtype == np.dtype(np.int8)): raise ak._errors.wrap_error( TypeError( @@ -92,7 +87,7 @@ def __init__( self._mask = mask self._content = content self._valid_when = valid_when - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def mask(self): @@ -114,7 +109,6 @@ def _form_with_key(self, getkey): self._mask.form, self._content._form_with_key(getkey), self._valid_when, - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -132,7 +126,6 @@ def typetracer(self): ak.index.Index(self._mask.raw(tt)), self._content.typetracer, self._valid_when, - self._typetracer_identifier(), self._parameters, tt, ) @@ -146,7 +139,6 @@ def _forget_length(self): self._mask.forget_length(), self._content, self._valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -173,7 +165,6 @@ def merge_parameters(self, parameters): self._mask, self._content, self._valid_when, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -195,7 +186,7 @@ def toIndexedOptionArray64(self): ) return ak.contents.IndexedOptionArray( - index, self._content, self._identifier, self._parameters, self._nplike + index, self._content, self._parameters, self._nplike ) def toByteMaskedArray(self, valid_when): @@ -206,7 +197,6 @@ def toByteMaskedArray(self, valid_when): ak.Index8(~self._mask.data), self._content, valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -223,7 +213,6 @@ def toBitMaskedArray(self, valid_when, lsb_order): valid_when, self.length, lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -240,7 +229,6 @@ def toBitMaskedArray(self, valid_when, lsb_order): valid_when, self.length, lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -282,7 +270,6 @@ def _getitem_range(self, where): self._mask[start:stop], self._content._getitem_range(slice(start, stop)), self._valid_when, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -292,7 +279,6 @@ def _getitem_field(self, where, only_fields=()): self._mask, self._content._getitem_field(where, only_fields), self._valid_when, - self._field_identifier(where), None, self._nplike, ).simplify_optiontype() @@ -302,7 +288,6 @@ def _getitem_fields(self, where, only_fields=()): self._mask, self._content._getitem_fields(where, only_fields), self._valid_when, - self._fields_identifier(where), None, self._nplike, ).simplify_optiontype() @@ -319,7 +304,6 @@ def _carry(self, carry, allow_lazy): nextmask, self._content._carry(carry, allow_lazy), self._valid_when, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -370,7 +354,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "cannot fit jagged slice with length {} into {} of size {}".format( slicestarts.length, type(self).__name__, self.length @@ -413,7 +397,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta out = next._getitem_next_jagged(reducedstarts, reducedstops, slicecontent, tail) out2 = ak.contents.IndexedOptionArray( - outindex, out, self._identifier, self._parameters, self._nplike + outindex, out, self._parameters, self._nplike ) return out2.simplify_optiontype() @@ -438,7 +422,6 @@ def _getitem_next(self, head, tail, advanced): out2 = ak.contents.IndexedOptionArray( outindex, out, - self._identifier, self._parameters, self._nplike, ) @@ -501,7 +484,6 @@ def project(self, mask=None): nextmask, self._content, valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -571,7 +553,7 @@ def num(self, axis, depth=0): out = next.num(posaxis, depth) out2 = ak.contents.IndexedOptionArray( - outindex, out, None, self.parameters, self._nplike + outindex, out, self.parameters, self._nplike ) return out2.simplify_optiontype() @@ -591,7 +573,7 @@ def _offsets_and_flattened(self, axis, depth): return ( offsets, ak.contents.IndexedOptionArray( - outindex, flattened, None, self._parameters, self._nplike + outindex, flattened, self._parameters, self._nplike ), ) @@ -662,7 +644,6 @@ def mergemany(self, others): ak.index.Index8(self._nplike.concatenate(masks)), self._content[: self.length].mergemany(tail_contents), self._valid_when, - None, parameters, self._nplike, ) @@ -686,7 +667,6 @@ def _local_index(self, axis, depth): out2 = ak.contents.IndexedOptionArray( outindex, out, - self._identifier, self._parameters, self._nplike, ) @@ -697,7 +677,6 @@ def numbers_to_type(self, name): self._mask, self._content.numbers_to_type(name), self._valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -771,7 +750,7 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): n, replacement, recordlookup, parameters, posaxis, depth ) out2 = ak.contents.IndexedOptionArray( - outindex, out, None, parameters, self._nplike + outindex, out, parameters, self._nplike ) return out2.simplify_optiontype() @@ -926,7 +905,6 @@ def _reduce_next( outindex, out_content, None, - None, self._nplike, ).simplify_optiontype() @@ -934,7 +912,6 @@ def _reduce_next( outoffsets, tmp, None, - None, self._nplike, ) @@ -956,10 +933,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.mask._nbytes_part() + self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.mask._nbytes_part() + self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -984,7 +958,6 @@ def _pad_none(self, target, axis, depth, clip): return ak.contents.IndexedOptionArray( index, next, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -993,7 +966,6 @@ def _pad_none(self, target, axis, depth, clip): self._mask, self._content._pad_none(target, posaxis, depth, clip), self._valid_when, - None, self._parameters, self._nplike, ) @@ -1041,7 +1013,6 @@ def continuation(): options, ), self._valid_when, - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1086,7 +1057,6 @@ def packed(self): return ak.contents.IndexedOptionArray( next._index, content, - next._identifier, next._parameters, self._nplike, ) @@ -1100,7 +1070,6 @@ def packed(self): self._mask, content, self._valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -1128,7 +1097,6 @@ def _to_nplike(self, nplike): mask, content, valid_when=self._valid_when, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/content.py b/src/awkward/contents/content.py index 803c4e7ab7..d8dea8c0c6 100644 --- a/src/awkward/contents/content.py +++ b/src/awkward/contents/content.py @@ -25,17 +25,7 @@ class Content: is_RecordType = False is_UnionType = False - def _init(self, identifier, parameters, nplike): - if identifier is not None and not isinstance( - identifier, ak.identifier.Identifier - ): - raise ak._errors.wrap_error( - TypeError( - "{} 'identifier' must be an Identifier or None, not {}".format( - type(self).__name__, repr(identifier) - ) - ) - ) + def _init(self, parameters, nplike): if parameters is not None and not isinstance(parameters, dict): raise ak._errors.wrap_error( TypeError( @@ -54,14 +44,9 @@ def _init(self, identifier, parameters, nplike): ) ) - self._identifier = identifier self._parameters = parameters self._nplike = nplike - @property - def identifier(self): - return self._identifier - @property def parameters(self): if self._parameters is None: @@ -187,8 +172,6 @@ def _repr_extra(self, indent): indent, repr(k), repr(v) ) ) - if self._identifier is not None: - out.append(self._identifier._repr("\n" + indent, "", "")) return out def maybe_to_array(self, nplike): @@ -209,10 +192,6 @@ def _handle_error(self, error, slicer=None): raise ak._errors.wrap_error(ValueError(message + filename)) else: - if error.id != ak._util.kSliceNone and self._identifier is not None: - # FIXME https://github.com/scikit-hep/awkward-1.0/blob/45d59ef4ae45eebb02995b8e1acaac0d46fb9573/src/libawkward/util.cpp#L443-L450 - pass - if error.attempt != ak._util.kSliceNone: message += f" while attempting to get index {error.attempt}" @@ -299,7 +278,6 @@ def _getitem_next_newaxis(self, tail, advanced): 1, # size 0, # zeros_length is irrelevant when the size is 1 (!= 0) None, - None, self._nplike, ) @@ -347,14 +325,13 @@ def _getitem_next_regular_missing(self, head, tail, advanced, raw, length): ) out = ak.contents.IndexedOptionArray( - outindex, raw.content, None, self._parameters, self._nplike + outindex, raw.content, self._parameters, self._nplike ) return ak.contents.RegularArray( out.simplify_optiontype(), indexlength, 1, - None, self._parameters, self._nplike, ) @@ -406,13 +383,12 @@ def _getitem_next_missing_jagged(self, head, tail, advanced, that): tmp = content._getitem_next_jagged(starts, stops, jagged.content, tail) out = ak.contents.IndexedOptionArray( - outputmask, tmp, None, self._parameters, self._nplike + outputmask, tmp, self._parameters, self._nplike ) return ak.contents.RegularArray( out.simplify_optiontype(), index.length, 1, - None, self._parameters, self._nplike, ) @@ -471,7 +447,6 @@ def _getitem_next_missing(self, head, tail, advanced): contents, nextcontent._fields, None, - None, self._parameters, self._nplike, ) @@ -519,7 +494,6 @@ def _getitem(self, where): self.length if self._nplike.known_shape else 1, 1, None, - None, self._nplike, ) @@ -598,7 +572,7 @@ def _getitem(self, where): return self._getitem(layout) else: return self._getitem( - ak.contents.NumpyArray(as_array, None, None, layout.nplike) + ak.contents.NumpyArray(as_array, None, layout.nplike) ) else: @@ -639,36 +613,6 @@ def _carry_asrange(self, carry): else: return None - def _typetracer_identifier(self): - if self._identifier is None: - return None - else: - raise ak._errors.wrap_error(NotImplementedError) - - def _range_identifier(self, start, stop): - if self._identifier is None: - return None - else: - raise ak._errors.wrap_error(NotImplementedError) - - def _field_identifier(self, field): - if self._identifier is None: - return None - else: - raise ak._errors.wrap_error(NotImplementedError) - - def _fields_identifier(self, fields): - if self._identifier is None: - return None - else: - raise ak._errors.wrap_error(NotImplementedError) - - def _carry_identifier(self, carry): - if self._identifier is None: - return None - else: - raise ak._errors.wrap_error(NotImplementedError) - def axis_wrap_if_negative(self, axis): if axis is None or axis >= 0: return axis @@ -704,7 +648,7 @@ def _local_index_axis0(self): localindex.length, ) ) - return ak.contents.NumpyArray(localindex, None, None, self._nplike) + return ak.contents.NumpyArray(localindex, None, self._nplike) def merge(self, other): others = [other] @@ -760,7 +704,7 @@ def merge_as_union(self, other): ) ) - return ak.contents.UnionArray(tags, index, contents, None, None, self._nplike) + return ak.contents.UnionArray(tags, index, contents, None, self._nplike) def _merging_strategy(self, others): if len(others) == 0: @@ -1046,13 +990,11 @@ def _combinations_axis0(self, n, replacement, recordlookup, parameters): contents = [] length = None for ptr in tocarry: - contents.append( - ak.contents.IndexedArray(ptr, self, None, None, self._nplike) - ) + contents.append(ak.contents.IndexedArray(ptr, self, None, self._nplike)) length = contents[-1].length assert length is not None return ak.contents.RecordArray( - contents, recordlookup, length, None, parameters, self._nplike + contents, recordlookup, length, parameters, self._nplike ) def combinations(self, n, replacement=False, axis=1, fields=None, parameters=None): @@ -1290,7 +1232,6 @@ def pad_none_axis0(self, target, clip): next = ak.contents.IndexedOptionArray( index, self, - None, self._parameters, self._nplike, ) @@ -1548,7 +1489,6 @@ def layout_equal(self, other, index_dtype=True, numpyarray=True): return ( self.__class__ is other.__class__ and len(self) == len(other) - and ak.identifier._identifiers_equal(self.identifier, other.identifier) and ak.forms.form._parameters_equal( self.parameters, other.parameters, only_array_record=False ) diff --git a/src/awkward/contents/emptyarray.py b/src/awkward/contents/emptyarray.py index 1c7fda1efd..244c5cb365 100644 --- a/src/awkward/contents/emptyarray.py +++ b/src/awkward/contents/emptyarray.py @@ -16,12 +16,10 @@ class EmptyArray(Content): def copy( self, - identifier=unset, parameters=unset, nplike=unset, ): return EmptyArray( - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -30,24 +28,17 @@ def __copy__(self): return self.copy() def __deepcopy__(self, memo): - return self.copy( - identifier=copy.deepcopy(self._identifier, memo), - parameters=copy.deepcopy(self._parameters, memo), - ) + return self.copy(parameters=copy.deepcopy(self._parameters, memo)) - def __init__(self, identifier=None, parameters=None, nplike=None): + def __init__(self, parameters=None, nplike=None): if nplike is None: nplike = numpy - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) Form = EmptyForm def _form_with_key(self, getkey): - return self.Form( - has_identifier=self._identifier is not None, - parameters=self._parameters, - form_key=getkey(self), - ) + return self.Form(parameters=self._parameters, form_key=getkey(self)) def _to_buffers(self, form, getkey, container, nplike): assert isinstance(form, self.Form) @@ -55,14 +46,14 @@ def _to_buffers(self, form, getkey, container, nplike): @property def typetracer(self): tt = ak._typetracer.TypeTracer.instance() - return EmptyArray(self._typetracer_identifier(), self._parameters, tt) + return EmptyArray(self._parameters, tt) @property def length(self): return 0 def _forget_length(self): - return EmptyArray(self._identifier, self._parameters, self._nplike) + return EmptyArray(self._parameters, self._nplike) def __repr__(self): return self._repr("", "", "") @@ -80,9 +71,7 @@ def _repr(self, indent, pre, post): def merge_parameters(self, parameters): return EmptyArray( - self._identifier, - ak._util.merge_parameters(self._parameters, parameters), - self._nplike, + ak._util.merge_parameters(self._parameters, parameters), self._nplike ) def toNumpyArray(self, dtype, nplike=None): @@ -90,9 +79,7 @@ def toNumpyArray(self, dtype, nplike=None): nplike = self._nplike if nplike is None: nplike = numpy - return ak.contents.NumpyArray( - nplike.empty(0, dtype), self._identifier, self._parameters, nplike - ) + return ak.contents.NumpyArray(nplike.empty(0, dtype), self._parameters, nplike) def __array__(self, **kwargs): return numpy.empty((0,)) @@ -129,7 +116,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "too many jagged slice dimensions for array", ) @@ -182,7 +169,7 @@ def num(self, axis, depth=0): return out else: out = ak.index.Index64.empty(0, self._nplike) - return ak.contents.NumpyArray(out, None, None, self._nplike) + return ak.contents.NumpyArray(out, None, self._nplike) def _offsets_and_flattened(self, axis, depth): posaxis = self.axis_wrap_if_negative(axis) @@ -192,7 +179,7 @@ def _offsets_and_flattened(self, axis, depth): ) else: offsets = ak.index.Index64.zeros(1, self._nplike) - return (offsets, EmptyArray(None, self._parameters, self._nplike)) + return (offsets, EmptyArray(self._parameters, self._nplike)) def _mergeable(self, other, mergebool): return True @@ -209,15 +196,15 @@ def mergemany(self, others): return others[0].mergemany(tail_others) def fill_none(self, value): - return EmptyArray(None, self._parameters, self._nplike) + return EmptyArray(self._parameters, self._nplike) def _local_index(self, axis, depth): return ak.contents.NumpyArray( - self._nplike.empty(0, np.int64), None, None, self._nplike + self._nplike.empty(0, np.int64), None, self._nplike ) def numbers_to_type(self, name): - return ak.contents.EmptyArray(self._identifier, self._parameters, self._nplike) + return ak.contents.EmptyArray(self._parameters, self._nplike) def _is_unique(self, negaxis, starts, parents, outlength): return True @@ -256,7 +243,7 @@ def _sort_next( return self def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): - return ak.contents.EmptyArray(self._identifier, self._parameters, self._nplike) + return ak.contents.EmptyArray(self._parameters, self._nplike) def _reduce_next( self, @@ -287,8 +274,6 @@ def _validity_error(self, path): return "" def _nbytes_part(self): - if self.identifier is not None: - return self.identifier._nbytes_part() return 0 def _pad_none(self, target, axis, depth, clip): @@ -321,7 +306,6 @@ def _to_arrow(self, pyarrow, mask_node, validbytes, length, options): dtype = np.dtype(options["emptyarray_to"]) next = ak.contents.NumpyArray( numpy.empty(length, dtype), - self._identifier, self._parameters, nplike=self.nplike, ) @@ -342,7 +326,7 @@ def continuation(): if options["keep_parameters"]: return self else: - return EmptyArray(self._identifier, None, self._nplike) + return EmptyArray(None, self._nplike) else: @@ -374,7 +358,7 @@ def _to_list(self, behavior, json_conversions): return [] def _to_nplike(self, nplike): - return EmptyArray(self._identifier, self._parameters, nplike=nplike) + return EmptyArray(self._parameters, nplike=nplike) def _layout_equal(self, other, index_dtype=True, numpyarray=True): return True diff --git a/src/awkward/contents/indexedarray.py b/src/awkward/contents/indexedarray.py index b302ba8e59..2f72be0299 100644 --- a/src/awkward/contents/indexedarray.py +++ b/src/awkward/contents/indexedarray.py @@ -18,14 +18,12 @@ def copy( self, index=unset, content=unset, - identifier=unset, parameters=unset, nplike=unset, ): return IndexedArray( self._index if index is unset else index, self._content if content is unset else content, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -37,11 +35,10 @@ def __deepcopy__(self, memo): return self.copy( index=copy.deepcopy(self._index, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__(self, index, content, identifier=None, parameters=None, nplike=None): + def __init__(self, index, content, parameters=None, nplike=None): if not ( isinstance(index, Index) and index.dtype @@ -72,7 +69,7 @@ def __init__(self, index, content, identifier=None, parameters=None, nplike=None self._index = index self._content = content - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def index(self): @@ -89,7 +86,6 @@ def _form_with_key(self, getkey): return self.Form( self._index.form, self._content._form_with_key(getkey), - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -106,7 +102,6 @@ def typetracer(self): return IndexedArray( ak.index.Index(self._index.raw(tt)), self._content.typetracer, - self._typetracer_identifier(), self._parameters, tt, ) @@ -119,7 +114,6 @@ def _forget_length(self): return IndexedArray( self._index.forget_length(), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -143,14 +137,13 @@ def merge_parameters(self, parameters): return IndexedArray( self._index, self._content, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) def toIndexedOptionArray64(self): return ak.contents.IndexedOptionArray( - self._index, self._content, self._identifier, self._parameters, self._nplike + self._index, self._content, self._parameters, self._nplike ) def mask_as_bool(self, valid_when=True): @@ -181,7 +174,6 @@ def _getitem_range(self, where): return IndexedArray( self._index[start:stop], self._content, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -190,7 +182,6 @@ def _getitem_field(self, where, only_fields=()): return IndexedArray( self._index, self._content._getitem_field(where, only_fields), - self._field_identifier(where), None, self._nplike, ) @@ -199,7 +190,6 @@ def _getitem_fields(self, where, only_fields=()): return IndexedArray( self._index, self._content._getitem_fields(where, only_fields), - self._fields_identifier(where), None, self._nplike, ) @@ -215,7 +205,6 @@ def _carry(self, carry, allow_lazy): return IndexedArray( nextindex, self._content, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -225,7 +214,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "cannot fit jagged slice with length {} into {} of size {}".format( slicestarts.length, type(self).__name__, self.length @@ -336,7 +325,6 @@ def project(self, mask=None): next = ak.contents.IndexedOptionArray( nextindex, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -417,7 +405,6 @@ def simplify_optiontype(self): return IndexedArray( result, self._content.content, - self._identifier, self._parameters, self._nplike, ) @@ -434,7 +421,6 @@ def simplify_optiontype(self): return ak.contents.IndexedOptionArray( result, self._content.content, - self._identifier, self._parameters, self._nplike, ) @@ -548,7 +534,7 @@ def _reverse_merge(self, other): ) parameters = ak._util.merge_parameters(self._parameters, other._parameters) - return ak.contents.IndexedArray(index, content, None, parameters, self._nplike) + return ak.contents.IndexedArray(index, content, parameters, self._nplike) def mergemany(self, others): if len(others) == 0: @@ -624,7 +610,7 @@ def mergemany(self, others): tail_contents = contents[1:] nextcontent = contents[0].mergemany(tail_contents) next = ak.contents.IndexedArray( - nextindex, nextcontent, None, parameters, self._nplike + nextindex, nextcontent, parameters, self._nplike ) if len(tail) == 0: @@ -650,7 +636,6 @@ def fill_none(self, value): return IndexedArray( self._index, self._content.fill_none(value), - None, self._parameters, self._nplike, ) @@ -725,7 +710,6 @@ def numbers_to_type(self, name): return ak.contents.IndexedArray( self._index, self._content.numbers_to_type(name), - self._identifier, self._parameters, self._nplike, ) @@ -815,7 +799,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.IndexedOptionArray( nextoutindex, unique, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -858,7 +841,6 @@ def _unique(self, negaxis, starts, parents, outlength): outindex, unique._content, None, - None, self._nplike, ) @@ -866,7 +848,6 @@ def _unique(self, negaxis, starts, parents, outlength): outoffsets, tmp, None, - None, self._nplike, ) @@ -878,7 +859,6 @@ def _unique(self, negaxis, starts, parents, outlength): out = ak.contents.IndexedOptionArray( nextoutindex, unique, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1000,10 +980,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.index._nbytes_part() + self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.index._nbytes_part() + self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -1015,7 +992,6 @@ def _pad_none(self, target, axis, depth, clip): return ak.contents.IndexedArray( self._index, self._content._pad_none(target, posaxis, depth, clip), - None, self._parameters, self._nplike, ) @@ -1030,7 +1006,6 @@ def _to_arrow(self, pyarrow, mask_node, validbytes, length, options): next = IndexedArray( self._index, self._content, - self._identifier, next_parameters, self._nplike, ) @@ -1108,7 +1083,6 @@ def continuation(): lateral_context, options, ), - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1148,7 +1122,6 @@ def packed(self): return IndexedArray( self._index, self._content.packed(), - identifier=self._identifier, parameters=self._parameters, nplike=self._nplike, ) @@ -1170,7 +1143,6 @@ def _to_nplike(self, nplike): return IndexedArray( index, content, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/indexedoptionarray.py b/src/awkward/contents/indexedoptionarray.py index 7217519b16..b4198e0330 100644 --- a/src/awkward/contents/indexedoptionarray.py +++ b/src/awkward/contents/indexedoptionarray.py @@ -19,14 +19,12 @@ def copy( self, index=unset, content=unset, - identifier=unset, parameters=unset, nplike=unset, ): return IndexedOptionArray( self._index if index is unset else index, self._content if content is unset else content, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -38,11 +36,10 @@ def __deepcopy__(self, memo): return self.copy( index=copy.deepcopy(self._index, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__(self, index, content, identifier=None, parameters=None, nplike=None): + def __init__(self, index, content, parameters=None, nplike=None): if not ( isinstance(index, Index) and index.dtype @@ -72,7 +69,7 @@ def __init__(self, index, content, identifier=None, parameters=None, nplike=None self._index = index self._content = content - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def index(self): @@ -89,7 +86,6 @@ def _form_with_key(self, getkey): return self.Form( self._index.form, self._content._form_with_key(getkey), - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -106,7 +102,6 @@ def typetracer(self): return IndexedOptionArray( ak.index.Index(self._index.raw(tt)), self._content.typetracer, - self._typetracer_identifier(), self._parameters, tt, ) @@ -119,7 +114,6 @@ def _forget_length(self): return IndexedOptionArray( self._index.forget_length(), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -143,7 +137,6 @@ def merge_parameters(self, parameters): return IndexedOptionArray( self._index, self._content, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -155,7 +148,6 @@ def toIndexedOptionArray64(self): return IndexedOptionArray( self._index.astype(np.int64), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -179,7 +171,6 @@ def toByteMaskedArray(self, valid_when): mask, content, valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -223,7 +214,6 @@ def _getitem_range(self, where): return IndexedOptionArray( self._index[start:stop], self._content, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -232,7 +222,6 @@ def _getitem_field(self, where, only_fields=()): return IndexedOptionArray( self._index, self._content._getitem_field(where, only_fields), - self._field_identifier(where), None, self._nplike, ) @@ -241,7 +230,6 @@ def _getitem_fields(self, where, only_fields=()): return IndexedOptionArray( self._index, self._content._getitem_fields(where, only_fields), - self._fields_identifier(where), None, self._nplike, ) @@ -257,7 +245,6 @@ def _carry(self, carry, allow_lazy): return IndexedOptionArray( nextindex, self._content, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -310,7 +297,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "cannot fit jagged slice with length {} into {} of size {}".format( slicestarts.length, type(self).__name__, self.length @@ -350,7 +337,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta out = next._getitem_next_jagged(reducedstarts, reducedstops, slicecontent, tail) out2 = ak.contents.IndexedOptionArray( - outindex, out, self._identifier, self._parameters, self._nplike + outindex, out, self._parameters, self._nplike ) return out2.simplify_optiontype() @@ -372,9 +359,7 @@ def _getitem_next(self, head, tail, advanced): next = self._content._carry(nextcarry, True) out = next._getitem_next(head, tail, advanced) - out2 = IndexedOptionArray( - outindex, out, self._identifier, self._parameters, self._nplike - ) + out2 = IndexedOptionArray(outindex, out, self._parameters, self._nplike) return out2.simplify_optiontype() elif ak._util.isstr(head): @@ -427,7 +412,6 @@ def project(self, mask=None): next = ak.contents.IndexedOptionArray( nextindex, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -522,7 +506,6 @@ def simplify_optiontype(self): return ak.contents.IndexedOptionArray( result, self._content.content, - self._identifier, self._parameters, self._nplike, ) @@ -542,7 +525,7 @@ def num(self, axis, depth=0): next = self._content._carry(nextcarry, False) out = next.num(posaxis, depth) out2 = ak.contents.IndexedOptionArray( - outindex, out, None, self.parameters, self._nplike + outindex, out, self.parameters, self._nplike ) return out2.simplify_optiontype() @@ -560,7 +543,7 @@ def _offsets_and_flattened(self, axis, depth): return ( offsets, ak.contents.IndexedOptionArray( - outindex, flattened, None, self._parameters, self._nplike + outindex, flattened, self._parameters, self._nplike ), ) @@ -680,9 +663,7 @@ def _reverse_merge(self, other): ) parameters = ak._util.merge_parameters(self._parameters, other._parameters) - return ak.contents.IndexedOptionArray( - index, content, None, parameters, self._nplike - ) + return ak.contents.IndexedOptionArray(index, content, parameters, self._nplike) def mergemany(self, others): if len(others) == 0: @@ -759,7 +740,7 @@ def mergemany(self, others): tail_contents = contents[1:] nextcontent = contents[0].mergemany(tail_contents) next = ak.contents.IndexedOptionArray( - nextindex, nextcontent, None, parameters, self._nplike + nextindex, nextcontent, parameters, self._nplike ) if len(tail) == 0: @@ -794,7 +775,7 @@ def fill_none(self, value): ](index.data, self._index.data, tags.length) ) out = ak.contents.UnionArray( - tags, index, contents, None, self._parameters, self._nplike + tags, index, contents, self._parameters, self._nplike ) return out.simplify_uniontype(True, True) @@ -810,7 +791,6 @@ def _local_index(self, axis, depth): out2 = ak.contents.IndexedOptionArray( outindex, out, - self._identifier, self._parameters, self._nplike, ) @@ -884,7 +864,6 @@ def numbers_to_type(self, name): return ak.contents.IndexedOptionArray( self._index, self._content.numbers_to_type(name), - self._identifier, self._parameters, self._nplike, ) @@ -942,7 +921,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.IndexedOptionArray( nextoutindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -998,7 +976,6 @@ def _unique(self, negaxis, starts, parents, outlength): out = ak.contents.IndexedOptionArray( newindex[: newoffsets[-1]], out._content, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1006,7 +983,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.ListOffsetArray( newoffsets, out, - None, self._parameters, self._nplike, ) @@ -1031,7 +1007,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.IndexedOptionArray( nextoutindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1041,7 +1016,6 @@ def _unique(self, negaxis, starts, parents, outlength): out, out.length, 0, - None, self._parameters, self._nplike, ) @@ -1203,9 +1177,7 @@ def _argsort_next( # We can test for this condition by seeing whether the NumpyArray of indices # is mergeable with our content (`out = next._argsort_next result`). # If so, try to concatenate them at the end of `out`.` - nulls_index_content = ak.contents.NumpyArray( - nulls_index, None, None, self._nplike - ) + nulls_index_content = ak.contents.NumpyArray(nulls_index, None, self._nplike) if out.mergeable(nulls_index_content, True): out = out.merge(nulls_index_content) nulls_merged = True @@ -1251,7 +1223,6 @@ def _argsort_next( out = ak.contents.IndexedOptionArray( nextoutindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1268,7 +1239,6 @@ def _argsort_next( return ak.contents.IndexedOptionArray( outindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1319,7 +1289,6 @@ def _sort_next( out = ak.contents.IndexedOptionArray( nextoutindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1334,7 +1303,6 @@ def _sort_next( return ak.contents.IndexedOptionArray( outindex, out, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1432,7 +1400,6 @@ def _reduce_next( inner = ak.contents.IndexedOptionArray( outindex, out_content, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1441,7 +1408,6 @@ def _reduce_next( return ak.contents.ListOffsetArray( outoffsets, inner, - None, self._parameters, self._nplike, ) @@ -1457,7 +1423,7 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): n, replacement, recordlookup, parameters, posaxis, depth ) out2 = ak.contents.IndexedOptionArray( - outindex, out, None, parameters, self._nplike + outindex, out, parameters, self._nplike ) return out2.simplify_optiontype() @@ -1493,10 +1459,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.index._nbytes_part() + self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.index._nbytes_part() + self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -1517,7 +1480,6 @@ def _pad_none(self, target, axis, depth, clip): return ak.contents.IndexedOptionArray( index, next, - None, self._parameters, self._nplike, ).simplify_optiontype() @@ -1525,7 +1487,6 @@ def _pad_none(self, target, axis, depth, clip): return ak.contents.IndexedOptionArray( self._index, self._content._pad_none(target, posaxis, depth, clip), - None, self._parameters, self._nplike, ) @@ -1545,7 +1506,6 @@ def _to_arrow(self, pyarrow, mask_node, validbytes, length, options): next = ak.contents.IndexedArray( ak.index.Index(index), self._content, - None, next_parameters, self._nplike, ) @@ -1647,7 +1607,6 @@ def continuation(): lateral_context, options, ), - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1692,7 +1651,6 @@ def packed(self): return ak.contents.IndexedOptionArray( self._index, self._content.packed(), - self._identifier, self._parameters, self._nplike, ) @@ -1709,7 +1667,6 @@ def packed(self): return ak.contents.IndexedOptionArray( ak.index.Index(new_index, nplike=self.nplike), self.project().packed(), - self._identifier, self._parameters, self._nplike, ) @@ -1734,9 +1691,7 @@ def _to_list(self, behavior, json_conversions): def _to_nplike(self, nplike): index = self._index._to_nplike(nplike) content = self._content._to_nplike(nplike) - return IndexedOptionArray( - index, content, self.identifier, self.parameters, nplike=nplike - ) + return IndexedOptionArray(index, content, self.parameters, nplike=nplike) def _layout_equal(self, other, index_dtype=True, numpyarray=True): return self.index.layout_equal( diff --git a/src/awkward/contents/listarray.py b/src/awkward/contents/listarray.py index 19748aa506..963fbf2e04 100644 --- a/src/awkward/contents/listarray.py +++ b/src/awkward/contents/listarray.py @@ -19,7 +19,6 @@ def copy( starts=unset, stops=unset, content=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -27,7 +26,6 @@ def copy( self._starts if starts is unset else starts, self._stops if stops is unset else stops, self._content if content is unset else content, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -40,13 +38,10 @@ def __deepcopy__(self, memo): starts=copy.deepcopy(self._starts, memo), stops=copy.deepcopy(self._stops, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__( - self, starts, stops, content, identifier=None, parameters=None, nplike=None - ): + def __init__(self, starts, stops, content, parameters=None, nplike=None): if not isinstance(starts, Index) and starts.dtype in ( np.dtype(np.int32), np.dtype(np.uint32), @@ -95,7 +90,7 @@ def __init__( self._starts = starts self._stops = stops self._content = content - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def starts(self): @@ -117,7 +112,6 @@ def _form_with_key(self, getkey): self._starts.form, self._stops.form, self._content._form_with_key(getkey), - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -137,7 +131,6 @@ def typetracer(self): ak.index.Index(self._starts.raw(tt)), ak.index.Index(self._stops.raw(tt)), self._content.typetracer, - self._typetracer_identifier(), self._parameters, tt, ) @@ -151,7 +144,6 @@ def _forget_length(self): self._starts.forget_length(), self._stops, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -177,7 +169,6 @@ def merge_parameters(self, parameters): self._starts, self._stops, self._content, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -193,7 +184,6 @@ def toListOffsetArray64(self, start_at_zero=False): return ListOffsetArray( ak.index.Index(offsets, nplike=self._nplike), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -210,7 +200,6 @@ def toListOffsetArray64(self, start_at_zero=False): return ListOffsetArray( ak.index.Index(offsets, nplike=self._nplike), self._content, - self._identifier, self._parameters, self._nplike, ).toListOffsetArray64(start_at_zero=start_at_zero) @@ -247,7 +236,6 @@ def _getitem_range(self, where): self._starts[start:stop], self._stops[start:stop], self._content, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -257,7 +245,6 @@ def _getitem_field(self, where, only_fields=()): self._starts, self._stops, self._content._getitem_field(where, only_fields), - self._field_identifier(where), None, self._nplike, ) @@ -267,7 +254,6 @@ def _getitem_fields(self, where, only_fields=()): self._starts, self._stops, self._content._getitem_fields(where, only_fields), - self._fields_identifier(where), None, self._nplike, ) @@ -285,7 +271,6 @@ def _carry(self, carry, allow_lazy): nextstarts, nextstops, self._content, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -323,7 +308,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "cannot fit jagged slice with length {} into {} of size {}".format( slicestarts.length, type(self).__name__, self.length @@ -370,7 +355,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): ) return ak.contents.ListOffsetArray( - outoffsets, outcontent, None, self._parameters, self._nplike + outoffsets, outcontent, self._parameters, self._nplike ) elif isinstance(slicecontent, ak.contents.NumpyArray): @@ -436,7 +421,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): outcontent = nextcontent._getitem_next(nexthead, nexttail, None) return ak.contents.ListOffsetArray( - outoffsets, outcontent, None, None, self._nplike + outoffsets, outcontent, None, self._nplike ) elif isinstance(slicecontent, ak.contents.IndexedOptionArray): @@ -444,7 +429,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "jagged slice length differs from array length", ) @@ -518,7 +503,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): as_list_offset_array = self.toListOffsetArray64(True) nextcontent = as_list_offset_array._content._carry(nextcarry, True) next = ak.contents.ListOffsetArray( - smalloffsets, nextcontent, None, self._parameters, self._nplike + smalloffsets, nextcontent, self._parameters, self._nplike ) out = next._getitem_next_jagged( smalloffsets[:-1], smalloffsets[1:], slicecontent._content, tail @@ -536,14 +521,13 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): else: missing_trim = missing indexedoptionarray = ak.contents.IndexedOptionArray( - missing_trim, content, None, self._parameters, self._nplike + missing_trim, content, self._parameters, self._nplike ) if isinstance(self._nplike, ak._typetracer.TypeTracer): indexedoptionarray = indexedoptionarray.typetracer return ak.contents.ListOffsetArray( largeoffsets, indexedoptionarray.simplify_optiontype(), - None, self._parameters, self._nplike, ) @@ -680,7 +664,6 @@ def _getitem_next(self, head, tail, advanced): return ak.contents.ListOffsetArray( nextoffsets, nextcontent._getitem_next(nexthead, nexttail, advanced), - self._identifier, self._parameters, self._nplike, ) @@ -731,7 +714,6 @@ def _getitem_next(self, head, tail, advanced): return ak.contents.ListOffsetArray( nextoffsets, nextcontent._getitem_next(nexthead, nexttail, nextadvanced), - self._identifier, self._parameters, self._nplike, ) @@ -886,7 +868,7 @@ def _getitem_next(self, head, tail, advanced): ) return ak.contents.RegularArray( - down, headlength, 1, None, self._parameters, self._nplike + down, headlength, 1, self._parameters, self._nplike ) elif isinstance(head, ak.contents.IndexedOptionArray): @@ -923,7 +905,7 @@ def num(self, axis, depth=0): self.length, ) ) - return ak.contents.NumpyArray(tonum, None, None, self._nplike) + return ak.contents.NumpyArray(tonum, None, self._nplike) else: return self.toListOffsetArray64(True).num(posaxis, depth) @@ -1079,7 +1061,7 @@ def mergemany(self, others): pass next = ak.contents.ListArray( - nextstarts, nextstops, nextcontent, None, parameters, self._nplike + nextstarts, nextstops, nextcontent, parameters, self._nplike ) if len(tail) == 0: @@ -1096,7 +1078,6 @@ def fill_none(self, value): self._starts, self._stops, self._content.fill_none(value), - self._identifier, self._parameters, self._nplike, ) @@ -1127,7 +1108,6 @@ def _local_index(self, axis, depth): return ak.contents.ListOffsetArray( offsets, ak.contents.NumpyArray(localindex), - self._identifier, self._parameters, self._nplike, ) @@ -1136,7 +1116,6 @@ def _local_index(self, axis, depth): self._starts, self._stops, self._content._local_index(posaxis, depth + 1), - self._identifier, self._parameters, self._nplike, ) @@ -1146,7 +1125,6 @@ def numbers_to_type(self, name): self._starts, self._stops, self._content.numbers_to_type(name), - self._identifier, self._parameters, self._nplike, ) @@ -1268,14 +1246,11 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = ( + return ( self.starts._nbytes_part() + self.stops._nbytes_part() + self.content._nbytes_part() ) - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result def _pad_none(self, target, axis, depth, clip): if not clip: @@ -1360,7 +1335,6 @@ def _pad_none(self, target, axis, depth, clip): index, self._content, None, - None, self._nplike, ) @@ -1368,7 +1342,6 @@ def _pad_none(self, target, axis, depth, clip): starts_, stops_, next.simplify_optiontype(), - None, self._parameters, self._nplike, ) @@ -1377,7 +1350,6 @@ def _pad_none(self, target, axis, depth, clip): self._starts, self._stops, self._content._pad_none(target, posaxis, depth + 1, clip), - None, self._parameters, self._nplike, ) @@ -1434,7 +1406,6 @@ def continuation(): lateral_context, options, ), - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1483,7 +1454,6 @@ def _to_nplike(self, nplike): starts, stops, content, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/listoffsetarray.py b/src/awkward/contents/listoffsetarray.py index ea3ee0625d..6fdcd2ffcf 100644 --- a/src/awkward/contents/listoffsetarray.py +++ b/src/awkward/contents/listoffsetarray.py @@ -18,14 +18,12 @@ def copy( self, offsets=unset, content=unset, - identifier=unset, parameters=unset, nplike=unset, ): return ListOffsetArray( self._offsets if offsets is unset else offsets, self._content if content is unset else content, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -37,11 +35,10 @@ def __deepcopy__(self, memo): return self.copy( offsets=copy.deepcopy(self._offsets, memo), content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__(self, offsets, content, identifier=None, parameters=None, nplike=None): + def __init__(self, offsets, content, parameters=None, nplike=None): if not isinstance(offsets, Index) and offsets.dtype in ( np.dtype(np.int32), np.dtype(np.uint32), @@ -76,7 +73,7 @@ def __init__(self, offsets, content, identifier=None, parameters=None, nplike=No self._offsets = offsets self._content = content - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def starts(self): @@ -101,7 +98,6 @@ def _form_with_key(self, getkey): return self.Form( self._offsets.form, self._content._form_with_key(getkey), - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -118,7 +114,6 @@ def typetracer(self): return ListOffsetArray( ak.index.Index(self._offsets.raw(tt)), self._content.typetracer, - self._typetracer_identifier(), self._parameters, tt, ) @@ -131,7 +126,6 @@ def _forget_length(self): return ListOffsetArray( self._offsets.forget_length(), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -155,7 +149,6 @@ def merge_parameters(self, parameters): return ListOffsetArray( self._offsets, self._content, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -178,9 +171,7 @@ def toListOffsetArray64(self, start_at_zero=False): else: offsets, content = self._offsets, self._content - return ListOffsetArray( - offsets, content, self._identifier, self._parameters, self._nplike - ) + return ListOffsetArray(offsets, content, self._parameters, self._nplike) else: offsets = self._compact_offsets64(start_at_zero) @@ -207,7 +198,6 @@ def toRegularArray(self): content, size[0], self._offsets.length - 1, - self._identifier, self._parameters, self._nplike, ) @@ -240,7 +230,6 @@ def _getitem_range(self, where): return ListOffsetArray( offsets, self._content, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -249,7 +238,6 @@ def _getitem_field(self, where, only_fields=()): return ListOffsetArray( self._offsets, self._content._getitem_field(where, only_fields), - self._field_identifier(where), None, self._nplike, ) @@ -258,7 +246,6 @@ def _getitem_fields(self, where, only_fields=()): return ListOffsetArray( self._offsets, self._content._getitem_fields(where, only_fields), - self._fields_identifier(where), None, self._nplike, ) @@ -276,7 +263,6 @@ def _carry(self, carry, allow_lazy): nextstarts, nextstops, self._content, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -313,11 +299,6 @@ def _broadcast_tooffsets64(self, offsets): ) ) - if self._identifier is not None: - identifier = self._identifier[slice(0, offsets.length - 1)] - else: - identifier = self._identifier - starts, stops = self.starts, self.stops nextcarry = ak.index.Index64.empty(offsets[-1], self._nplike) @@ -346,16 +327,13 @@ def _broadcast_tooffsets64(self, offsets): nextcontent = self._content._carry(nextcarry, True) - return ListOffsetArray( - offsets, nextcontent, identifier, self._parameters, self._nplike - ) + return ListOffsetArray(offsets, nextcontent, self._parameters, self._nplike) def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): out = ak.contents.ListArray( self.starts, self.stops, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -469,7 +447,6 @@ def _getitem_next(self, head, tail, advanced): return ak.contents.ListOffsetArray( nextoffsets, nextcontent._getitem_next(nexthead, nexttail, advanced), - self._identifier, self._parameters, self._nplike, ) @@ -516,7 +493,6 @@ def _getitem_next(self, head, tail, advanced): return ak.contents.ListOffsetArray( nextoffsets, nextcontent._getitem_next(nexthead, nexttail, nextadvanced), - self._identifier, self._parameters, self._nplike, ) @@ -619,7 +595,6 @@ def _getitem_next(self, head, tail, advanced): self.starts, self.stops, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -659,12 +634,12 @@ def num(self, axis, depth=0): self.length, ) ) - return ak.contents.NumpyArray(tonum, None, None, self._nplike) + return ak.contents.NumpyArray(tonum, None, self._nplike) else: next = self._content.num(posaxis, depth + 1) offsets = self._compact_offsets64(True) return ak.contents.ListOffsetArray( - offsets, next, None, self.parameters, self._nplike + offsets, next, self.parameters, self._nplike ) def _offsets_and_flattened(self, axis, depth): @@ -688,7 +663,7 @@ def _offsets_and_flattened(self, axis, depth): return ( offsets, ListOffsetArray( - self._offsets, flattened, None, self._parameters, self._nplike + self._offsets, flattened, self._parameters, self._nplike ), ) @@ -697,7 +672,7 @@ def _offsets_and_flattened(self, axis, depth): return ( offsets, ListOffsetArray( - tooffsets, flattened, None, self._parameters, self._nplike + tooffsets, flattened, self._parameters, self._nplike ), ) @@ -727,7 +702,7 @@ def _offsets_and_flattened(self, axis, depth): return ( offsets, ListOffsetArray( - tooffsets, flattened, None, self._parameters, self._nplike + tooffsets, flattened, self._parameters, self._nplike ), ) @@ -761,7 +736,7 @@ def mergemany(self, others): if len(others) == 0: return self listarray = ak.contents.ListArray( - self.starts, self.stops, self._content, None, self._parameters, self._nplike + self.starts, self.stops, self._content, self._parameters, self._nplike ) out = listarray.mergemany(others) @@ -777,7 +752,6 @@ def fill_none(self, value): return ListOffsetArray( self._offsets, self._content.fill_none(value), - self._identifier, self._parameters, self._nplike, ) @@ -808,7 +782,6 @@ def _local_index(self, axis, depth): return ak.contents.ListOffsetArray( offsets, ak.contents.NumpyArray(localindex), - self._identifier, self._parameters, self._nplike, ) @@ -816,7 +789,6 @@ def _local_index(self, axis, depth): return ak.contents.ListOffsetArray( self._offsets, self._content._local_index(posaxis, depth + 1), - self._identifier, self._parameters, self._nplike, ) @@ -825,7 +797,6 @@ def numbers_to_type(self, name): return ak.contents.ListOffsetArray( self._offsets, self._content.numbers_to_type(name), - self._identifier, self._parameters, self._nplike, ) @@ -854,7 +825,6 @@ def _is_unique(self, negaxis, starts, parents, outlength): out2 = ak.contents.ListOffsetArray( outoffsets, out, - None, self._parameters, self._nplike, ) @@ -911,7 +881,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.ListOffsetArray( nextoffsets, out, - None, self._parameters, self._nplike, ) @@ -962,7 +931,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.ListOffsetArray( outcontent._compact_offsets64(True), outcontent._content._carry(outcarry, False), - None, self._parameters, self._nplike, ) @@ -1003,7 +971,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.ListOffsetArray( outoffsets, outcontent, - None, self._parameters, self._nplike, ) @@ -1066,7 +1033,7 @@ def _argsort_next( True, ) ) - return ak.contents.NumpyArray(nextcarry, None, None, self._nplike) + return ak.contents.NumpyArray(nextcarry, None, self._nplike) if not branch and (negaxis == depth): if ( @@ -1158,7 +1125,6 @@ def _argsort_next( return ak.contents.ListOffsetArray( out_offsets, out, - None, self._parameters, self._nplike, ) @@ -1199,7 +1165,6 @@ def _argsort_next( return ak.contents.ListOffsetArray( outoffsets, outcontent, - None, self._parameters, self._nplike, ) @@ -1305,7 +1270,6 @@ def _sort_next( return ak.contents.ListOffsetArray( self._compact_offsets64(True), outcontent._carry(outcarry, False), - None, self._parameters, self._nplike, ) @@ -1345,7 +1309,6 @@ def _sort_next( return ak.contents.ListOffsetArray( outoffsets, outcontent, - None, self._parameters, self._nplike, ) @@ -1437,10 +1400,10 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): contents.append(self._content._carry(ptr, True)) recordarray = ak.contents.RecordArray( - contents, recordlookup, None, None, parameters, self._nplike + contents, recordlookup, None, parameters, self._nplike ) return ak.contents.ListOffsetArray( - offsets, recordarray, self._identifier, self._parameters, self._nplike + offsets, recordarray, self._parameters, self._nplike ) else: compact = self.toListOffsetArray64(True) @@ -1448,7 +1411,7 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): n, replacement, recordlookup, parameters, posaxis, depth + 1 ) return ak.contents.ListOffsetArray( - compact.offsets, next, self._identifier, self._parameters, self._nplike + compact.offsets, next, self._parameters, self._nplike ) def _reduce_next( @@ -1572,7 +1535,6 @@ def _reduce_next( outstops, outcontent, None, - None, self._nplike, ) @@ -1582,7 +1544,6 @@ def _reduce_next( 1, self.length, None, - None, self._nplike, ) @@ -1653,7 +1614,6 @@ def _reduce_next( outoffsets, outcontent, None, - None, self._nplike, ) @@ -1771,10 +1731,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.offsets._nbytes_part() + self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.offsets._nbytes_part() + self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -1824,14 +1781,12 @@ def _pad_none(self, target, axis, depth, clip): next = ak.contents.IndexedOptionArray( outindex, self._content, - self._identifier, self._parameters, self._nplike, ) return ak.contents.ListOffsetArray( offsets_, next.simplify_optiontype(), - self._identifier, self._parameters, self._nplike, ) @@ -1874,7 +1829,6 @@ def _pad_none(self, target, axis, depth, clip): next = ak.contents.IndexedOptionArray( outindex, self._content, - self._identifier, self._parameters, self._nplike, ) @@ -1882,7 +1836,6 @@ def _pad_none(self, target, axis, depth, clip): next.simplify_optiontype(), target, self.length, - None, self._parameters, self._nplike, ) @@ -1890,7 +1843,6 @@ def _pad_none(self, target, axis, depth, clip): return ak.contents.ListOffsetArray( self._offsets, self._content._pad_none(target, posaxis, depth + 1, clip), - None, self._parameters, self._nplike, ) @@ -1926,7 +1878,6 @@ def _to_arrow(self, pyarrow, mask_node, validbytes, length, options): ak.index.Index(new_starts), ak.index.Index(new_stops), self._content, - None, self._parameters, self._nplike, ) @@ -2049,7 +2000,6 @@ def continuation(): lateral_context, options, ), - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -2089,9 +2039,7 @@ def packed(self): content = next._content.packed() if content.length != next._offsets[-1]: content = content[: next._offsets[-1]] - return ListOffsetArray( - next._offsets, content, next._identifier, next._parameters, self._nplike - ) + return ListOffsetArray(next._offsets, content, next._parameters, self._nplike) def _to_list(self, behavior, json_conversions): starts, stops = self.starts, self.stops @@ -2159,7 +2107,6 @@ def _to_nplike(self, nplike): return ListOffsetArray( offsets, content, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/numpyarray.py b/src/awkward/contents/numpyarray.py index 2ac2b96dfe..9ab956dd43 100644 --- a/src/awkward/contents/numpyarray.py +++ b/src/awkward/contents/numpyarray.py @@ -17,13 +17,11 @@ class NumpyArray(Content): def copy( self, data=unset, - identifier=unset, parameters=unset, nplike=unset, ): return NumpyArray( self._data if data is unset else data, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -34,11 +32,10 @@ def __copy__(self): def __deepcopy__(self, memo): return self.copy( data=copy.deepcopy(self._data, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__(self, data, identifier=None, parameters=None, nplike=None): + def __init__(self, data, parameters=None, nplike=None): if nplike is None: nplike = ak.nplikes.nplike_of(data) if isinstance(data, ak.index.Index): @@ -56,7 +53,7 @@ def __init__(self, data, identifier=None, parameters=None, nplike=None): ) ) - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def data(self): @@ -102,7 +99,6 @@ def _form_with_key(self, getkey): return self.Form( ak.types.numpytype.dtype_to_primitive(self._data.dtype), self._data.shape[1:], - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=getkey(self), ) @@ -117,7 +113,6 @@ def typetracer(self): tt = ak._typetracer.TypeTracer.instance() return NumpyArray( self.raw(tt), - self._typetracer_identifier(), self._parameters, tt, ) @@ -129,7 +124,6 @@ def length(self): def _forget_length(self): return NumpyArray( self._data.forget_length(), - self._identifier, self._parameters, self._nplike, ) @@ -174,7 +168,6 @@ def _repr(self, indent, pre, post): def merge_parameters(self, parameters): return NumpyArray( self._data, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -185,12 +178,11 @@ def toRegularArray(self): for x in shape: zeroslen.append(zeroslen[-1] * x) - out = NumpyArray(self._data.reshape(-1), None, None, self._nplike) + out = NumpyArray(self._data.reshape(-1), None, self._nplike) for i in range(len(shape) - 1, 0, -1): out = ak.contents.RegularArray( - out, shape[i], zeroslen[i], None, None, self._nplike + out, shape[i], zeroslen[i], None, self._nplike ) - out._identifier = self._identifier out._parameters = self._parameters return out @@ -207,7 +199,6 @@ def _getitem_nothing(self): tmp = self._data[0:0] return NumpyArray( tmp.reshape((0,) + tmp.shape[2:]), - self._range_identifier(0, 0), None, self._nplike, ) @@ -222,7 +213,7 @@ def _getitem_at(self, where): raise ak._errors.index_error(self, where, str(err)) from err if hasattr(out, "shape") and len(out.shape) != 0: - return NumpyArray(out, None, None, self._nplike) + return NumpyArray(out, None, self._nplike) else: return out @@ -240,7 +231,6 @@ def _getitem_range(self, where): return NumpyArray( out, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -261,7 +251,6 @@ def _carry(self, carry, allow_lazy): raise ak._errors.index_error(self, carry.data, str(err)) from err return NumpyArray( nextdata, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -271,7 +260,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "too many jagged slice dimensions for array", ) @@ -294,7 +283,7 @@ def _getitem_next(self, head, tail, advanced): raise ak._errors.index_error(self, (head,) + tail, str(err)) from err if hasattr(out, "shape") and len(out.shape) != 0: - return NumpyArray(out, None, None, self._nplike) + return NumpyArray(out, None, self._nplike) else: return out @@ -304,7 +293,7 @@ def _getitem_next(self, head, tail, advanced): out = self._data[where] except IndexError as err: raise ak._errors.index_error(self, (head,) + tail, str(err)) from err - out2 = NumpyArray(out, None, self._parameters, self._nplike) + out2 = NumpyArray(out, self._parameters, self._nplike) return out2 elif ak._util.isstr(head): @@ -327,7 +316,7 @@ def _getitem_next(self, head, tail, advanced): except IndexError as err: raise ak._errors.index_error(self, (head,) + tail, str(err)) from err - return NumpyArray(out, None, self._parameters, self._nplike) + return NumpyArray(out, self._parameters, self._nplike) elif isinstance(head, ak.contents.ListOffsetArray): where = (slice(None), head) + tail @@ -335,7 +324,7 @@ def _getitem_next(self, head, tail, advanced): out = self._data[where] except IndexError as err: raise ak._errors.index_error(self, (head,) + tail, str(err)) from err - out2 = NumpyArray(out, None, self._parameters, self._nplike) + out2 = NumpyArray(out, self._parameters, self._nplike) return out2 elif isinstance(head, ak.contents.IndexedOptionArray): @@ -376,7 +365,7 @@ def num(self, axis, depth=0): ) ) return ak.contents.NumpyArray( - tonum.data.reshape(shape), None, self.parameters, self._nplike + tonum.data.reshape(shape), self.parameters, self._nplike ) def _offsets_and_flattened(self, axis, depth): @@ -479,7 +468,7 @@ def mergemany(self, others): contiguous_arrays = self._nplike.concatenate(contiguous_arrays) - next = NumpyArray(contiguous_arrays, self._identifier, parameters, self._nplike) + next = NumpyArray(contiguous_arrays, parameters, self._nplike) if len(tail) == 0: return next @@ -510,7 +499,6 @@ def contiguous(self): else: return ak.contents.NumpyArray( self._nplike.ascontiguousarray(self._data), - self._identifier, self._parameters, self._nplike, ) @@ -647,7 +635,7 @@ def _as_unique_strings(self, offsets): outlength.data, ) ) - out2 = NumpyArray(out, None, self._parameters, self._nplike) + out2 = NumpyArray(out, self._parameters, self._nplike) return out2, nextoffsets[: outlength[0]] @@ -663,7 +651,6 @@ def numbers_to_type(self, name): dtype = primitive_to_dtype(name) return NumpyArray( self._nplike.asarray(self._data, dtype=dtype), - self._identifier, self._parameters, self._nplike, ) @@ -745,7 +732,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.NumpyArray( self._nplike.asarray(out[: nextlength[0]], self.dtype), None, - None, self._nplike, ) @@ -854,7 +840,6 @@ def _unique(self, negaxis, starts, parents, outlength): return ak.contents.ListOffsetArray( outoffsets, ak.contents.NumpyArray(out), - None, self._parameters, self._nplike, ) @@ -975,7 +960,7 @@ def _argsort_next( starts.length, ) ) - out = NumpyArray(nextcarry, None, None, self._nplike) + out = NumpyArray(nextcarry, None, self._nplike) return out def _sort_next( @@ -1058,7 +1043,7 @@ def _sort_next( ) ) return ak.contents.NumpyArray( - self._nplike.asarray(out, self.dtype), None, None, self._nplike + self._nplike.asarray(out, self.dtype), None, self._nplike ) def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): @@ -1169,7 +1154,6 @@ def _reduce_next( out, False, None, - None, self._nplike, ) @@ -1179,7 +1163,6 @@ def _reduce_next( 1, self.length, None, - None, self._nplike, ) @@ -1217,10 +1200,7 @@ def _pad_none(self, target, axis, depth, clip): return self.pad_none_axis0(target, clip=True) def _nbytes_part(self): - result = self.data.nbytes - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.data.nbytes def _to_arrow(self, pyarrow, mask_node, validbytes, length, options): if self._data.ndim != 1: @@ -1276,7 +1256,7 @@ def continuation(): if options["keep_parameters"]: return self else: - return NumpyArray(self._data, self._identifier, None, self._nplike) + return NumpyArray(self._data, None, self._nplike) else: @@ -1365,7 +1345,6 @@ def _to_list(self, behavior, json_conversions): def _to_nplike(self, nplike): return NumpyArray( self.raw(nplike), - identifier=self.identifier, parameters=self.parameters, nplike=nplike, ) diff --git a/src/awkward/contents/recordarray.py b/src/awkward/contents/recordarray.py index c8351fd977..fc70696cd6 100644 --- a/src/awkward/contents/recordarray.py +++ b/src/awkward/contents/recordarray.py @@ -21,7 +21,6 @@ def copy( contents=unset, fields=unset, length=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -29,7 +28,6 @@ def copy( self._contents if contents is unset else contents, self._fields if fields is unset else fields, self._length if length is unset else length, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -41,7 +39,6 @@ def __deepcopy__(self, memo): return self.copy( contents=[copy.deepcopy(x, memo) for x in self._contents], fields=copy.deepcopy(self._fields, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) @@ -50,7 +47,6 @@ def __init__( contents, fields, length=None, - identifier=None, parameters=None, nplike=None, ): @@ -155,7 +151,7 @@ def __init__( self._contents = contents self._fields = fields self._length = length - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def contents(self): @@ -179,7 +175,6 @@ def as_tuple(self): None, self._length, None, - None, self._nplike, ) @@ -190,7 +185,6 @@ def _form_with_key(self, getkey): return self.Form( [x._form_with_key(getkey) for x in self._contents], self._fields, - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -211,7 +205,6 @@ def typetracer(self): [x.typetracer for x in self._contents], self._fields, self._length, - self._typetracer_identifier(), self._parameters, tt, ) @@ -225,7 +218,6 @@ def _forget_length(self): [x._forget_length() for x in self._contents], self._fields, ak._typetracer.UnknownLength, - self._identifier, self._parameters, self._nplike, ) @@ -266,7 +258,6 @@ def merge_parameters(self, parameters): self._contents, self._fields, self._length, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -313,7 +304,6 @@ def _getitem_range(self, where): [], self._fields, stop - start, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -323,7 +313,6 @@ def _getitem_range(self, where): [x._getitem_range(nextslice) for x in self._contents], self._fields, stop - start, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -363,7 +352,6 @@ def _getitem_fields(self, where, only_fields=()): contents, fields, self._length, - self._fields_identifier(where), None, self._nplike, ) @@ -388,7 +376,6 @@ def _carry(self, carry, allow_lazy): return ak.contents.IndexedArray( nextindex, self, - self._carry_identifier(carry), None, self._nplike, ) @@ -410,7 +397,6 @@ def _carry(self, carry, allow_lazy): contents, self._fields, length, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -423,9 +409,7 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): slicestarts, slicestops, slicecontent, tail ) ) - return RecordArray( - contents, self._fields, self._length, None, None, self._nplike - ) + return RecordArray(contents, self._fields, self._length, None, self._nplike) def _getitem_next(self, head, tail, advanced): if head == (): @@ -461,9 +445,7 @@ def _getitem_next(self, head, tail, advanced): or advanced is None ): parameters = self._parameters - next = RecordArray( - contents, self._fields, None, self._identifier, parameters, self._nplike - ) + next = RecordArray(contents, self._fields, None, parameters, self._nplike) return next._getitem_next(nexthead, nexttail, advanced) def num(self, axis, depth=0): @@ -471,10 +453,10 @@ def num(self, axis, depth=0): if posaxis == depth: npsingle = self._nplike.index_nplike.full((1,), self.length, np.int64) single = ak.index.Index64(npsingle, nplike=self._nplike) - singleton = ak.contents.NumpyArray(single, None, None, self._nplike) + singleton = ak.contents.NumpyArray(single, None, self._nplike) contents = [singleton] * len(self._contents) record = ak.contents.RecordArray( - contents, self._fields, 1, None, self._parameters, self._nplike + contents, self._fields, 1, self._parameters, self._nplike ) return record[0] else: @@ -485,7 +467,6 @@ def num(self, axis, depth=0): contents, self._fields, self._length, - None, self._parameters, self._nplike, ) @@ -522,7 +503,6 @@ def _offsets_and_flattened(self, axis, depth): self._fields, self._length, None, - {}, self._nplike, ), ) @@ -673,7 +653,7 @@ def mergemany(self, others): minlength += x.length next = RecordArray( - nextcontents, self._fields, minlength, None, parameters, self._nplike + nextcontents, self._fields, minlength, parameters, self._nplike ) if len(tail) == 0: @@ -699,7 +679,6 @@ def fill_none(self, value): contents, self._fields, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -716,7 +695,6 @@ def _local_index(self, axis, depth): contents, self._fields, self.length, - self._identifier, self._parameters, self._nplike, ) @@ -729,7 +707,6 @@ def numbers_to_type(self, name): contents, self._fields, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -762,7 +739,7 @@ def _sort_next( ): if self._fields is None or len(self._fields) == 0: return ak.contents.NumpyArray( - self._nplike.instance().empty(0, np.int64), None, None, self._nplike + self._nplike.instance().empty(0, np.int64), None, self._nplike ) contents = [] @@ -780,7 +757,7 @@ def _sort_next( ) ) return RecordArray( - contents, self._fields, self._length, None, self._parameters, self._nplike + contents, self._fields, self._length, self._parameters, self._nplike ) def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): @@ -799,7 +776,6 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): contents, recordlookup, self.length, - self._identifier, self._parameters, self._nplike, ) @@ -846,8 +822,6 @@ def _nbytes_part(self): result = 0 for content in self.contents: result = result + content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() return result def _pad_none(self, target, axis, depth, clip): @@ -863,7 +837,6 @@ def _pad_none(self, target, axis, depth, clip): contents, self._fields, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -872,7 +845,6 @@ def _pad_none(self, target, axis, depth, clip): contents, self._fields, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -984,7 +956,6 @@ def continuation(): ], self._fields, self._length, - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1028,7 +999,6 @@ def packed(self): ], self._fields, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -1063,7 +1033,6 @@ def _to_nplike(self, nplike): contents, self._fields, length=self._length, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/regulararray.py b/src/awkward/contents/regulararray.py index 2c42c6bc05..e6921fb38a 100644 --- a/src/awkward/contents/regulararray.py +++ b/src/awkward/contents/regulararray.py @@ -19,7 +19,6 @@ def copy( content=unset, size=unset, zeros_length=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -27,7 +26,6 @@ def copy( self._content if content is unset else content, self._size if size is unset else size, self._length if zeros_length is unset else zeros_length, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -38,7 +36,6 @@ def __copy__(self): def __deepcopy__(self, memo): return self.copy( content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) @@ -47,7 +44,6 @@ def __init__( content, size, zeros_length=0, - identifier=None, parameters=None, nplike=None, ): @@ -88,7 +84,7 @@ def __init__( self._length = content.length // size # floor division else: self._length = zeros_length - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def size(self): @@ -105,7 +101,6 @@ def _form_with_key(self, getkey): return self.Form( self._content._form_with_key(getkey), self._size, - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -121,7 +116,6 @@ def typetracer(self): self._content.typetracer, self._size, self._length, - self._typetracer_identifier(), self._parameters, tt, ) @@ -135,7 +129,6 @@ def _forget_length(self): self._content._forget_length(), self._size, ak._typetracer.UnknownLength, - self._identifier, self._parameters, self._nplike, ) @@ -161,7 +154,6 @@ def merge_parameters(self, parameters): self._content, self._size, self._length, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -184,7 +176,6 @@ def maybe_toNumpyArray(self): shape = (self._length, self._size) + content.data.shape[1:] return ak.contents.NumpyArray( content.data.reshape(shape), - None, ak._util.merge_parameters(self._parameters, content.parameters, True), self._nplike, ) @@ -213,7 +204,6 @@ def _getitem_range(self, where): self._content._getitem_range(slice(substart, substop)), self._size, zeros_length, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -223,7 +213,6 @@ def _getitem_field(self, where, only_fields=()): self._content._getitem_field(where, only_fields), self._size, self._length, - self._field_identifier(where), None, self._nplike, ) @@ -233,7 +222,6 @@ def _getitem_fields(self, where, only_fields=()): self._content._getitem_fields(where, only_fields), self._size, self._length, - self._fields_identifier(where), None, self._nplike, ) @@ -279,7 +267,6 @@ def _carry(self, carry, allow_lazy): self._content._carry(nextcarry, allow_lazy), self._size, where.shape[0], - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -315,11 +302,6 @@ def _broadcast_tooffsets64(self, offsets): ) ) - if self._identifier is not None: - identifier = self._identifier[slice(0, offsets.length - 1)] - else: - identifier = self._identifier - if self._size == 1: carrylen = offsets[-1] nextcarry = ak.index.Index64.empty(carrylen, self._nplike) @@ -337,7 +319,7 @@ def _broadcast_tooffsets64(self, offsets): ) nextcontent = self._content._carry(nextcarry, True) return ak.contents.ListOffsetArray( - offsets, nextcontent, identifier, self._parameters, self._nplike + offsets, nextcontent, self._parameters, self._nplike ) else: @@ -352,7 +334,7 @@ def _broadcast_tooffsets64(self, offsets): ) ) return ak.contents.ListOffsetArray( - offsets, self._content, self._identifier, self._parameters, self._nplike + offsets, self._content, self._parameters, self._nplike ) def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): @@ -428,7 +410,6 @@ def _getitem_next(self, head, tail, advanced): nextcontent._getitem_next(nexthead, nexttail, advanced), nextsize, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -458,7 +439,6 @@ def _getitem_next(self, head, tail, advanced): nextcontent._getitem_next(nexthead, nexttail, nextadvanced), nextsize, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -621,7 +601,7 @@ def _getitem_next(self, head, tail, advanced): ) return RegularArray( - down, headlength, self._length, None, self._parameters, self._nplike + down, headlength, self._length, self._parameters, self._nplike ) elif isinstance(head, ak.contents.IndexedOptionArray): @@ -646,11 +626,11 @@ def num(self, axis, depth=0): tonum.data, self._size, self._length ) ) - return ak.contents.NumpyArray(tonum, None, None, self._nplike) + return ak.contents.NumpyArray(tonum, None, self._nplike) else: next = self._content.num(posaxis, depth + 1) return ak.contents.RegularArray( - next, self._size, self._length, None, self._parameters, self._nplike + next, self._size, self._length, self._parameters, self._nplike ) def _offsets_and_flattened(self, axis, depth): @@ -713,7 +693,6 @@ def mergemany(self, others): self._content[: self._length * self._size].mergemany(tail_contents), self._size, zeros_length, - None, parameters, ) @@ -725,7 +704,6 @@ def fill_none(self, value): self._content.fill_none(value), self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -747,7 +725,6 @@ def _local_index(self, axis, depth): ak.contents.NumpyArray(localindex), self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -756,7 +733,6 @@ def _local_index(self, axis, depth): self._content._local_index(posaxis, depth + 1), self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -766,7 +742,6 @@ def numbers_to_type(self, name): self._content.numbers_to_type(name), self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -798,7 +773,6 @@ def _unique(self, negaxis, starts, parents, outlength): out._content.toRegularArray(), out._size, out._length, - None, out._parameters, self._nplike, ) @@ -836,7 +810,6 @@ def _argsort_next( out._content.toRegularArray(), out._size, out._length, - None, out._parameters, self._nplike, ) @@ -942,13 +915,12 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): length = contents[-1].length assert length is not None recordarray = ak.contents.RecordArray( - contents, recordlookup, length, None, parameters, self._nplike + contents, recordlookup, length, parameters, self._nplike ) return ak.contents.RegularArray( recordarray, combinationslen, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -962,7 +934,6 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): next, self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -1043,7 +1014,6 @@ def _reduce_next( self._size, outlength, None, - None, self._nplike, ) @@ -1053,7 +1023,6 @@ def _reduce_next( 1, self.length, None, - None, self._nplike, ) return out @@ -1167,7 +1136,6 @@ def _reduce_next( outoffsets, outcontent, None, - None, self._nplike, ) @@ -1183,10 +1151,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -1211,7 +1176,6 @@ def _pad_none(self, target, axis, depth, clip): next = ak.contents.IndexedOptionArray( index, self._content, - None, self._parameters, self._nplike, ) @@ -1219,7 +1183,6 @@ def _pad_none(self, target, axis, depth, clip): next.simplify_optiontype(), target, self._length, - None, self._parameters, self._nplike, ) @@ -1229,7 +1192,6 @@ def _pad_none(self, target, axis, depth, clip): self._content._pad_none(target, posaxis, depth + 1, clip), self._size, self._length, - None, self._parameters, self._nplike, ) @@ -1330,7 +1292,6 @@ def continuation(): ), self._size, self._length, - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1376,7 +1337,6 @@ def packed(self): content, self._size, self._length, - self._identifier, self._parameters, self._nplike, ) @@ -1433,7 +1393,6 @@ def _to_nplike(self, nplike): content, self._size, zeros_length=self._length, - identifier=self._identifier, parameters=self._parameters, nplike=nplike, ) diff --git a/src/awkward/contents/unionarray.py b/src/awkward/contents/unionarray.py index d3c379ca7b..58a1b112ec 100644 --- a/src/awkward/contents/unionarray.py +++ b/src/awkward/contents/unionarray.py @@ -23,7 +23,6 @@ def copy( tags=unset, index=unset, contents=unset, - identifier=unset, parameters=unset, nplike=unset, ): @@ -31,7 +30,6 @@ def copy( self._tags if tags is unset else tags, self._index if index is unset else index, self._contents if contents is unset else contents, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -44,13 +42,10 @@ def __deepcopy__(self, memo): tags=copy.deepcopy(self._tags, memo), index=copy.deepcopy(self._index, memo), contents=[copy.deepcopy(x, memo) for x in self._contents], - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__( - self, tags, index, contents, identifier=None, parameters=None, nplike=None - ): + def __init__(self, tags, index, contents, parameters=None, nplike=None): if not (isinstance(tags, Index) and tags.dtype == np.dtype(np.int8)): raise ak._errors.wrap_error( TypeError( @@ -125,7 +120,7 @@ def __init__( self._tags = tags self._index = index self._contents = contents - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def tags(self): @@ -150,7 +145,6 @@ def _form_with_key(self, getkey): self._tags.form, self._index.form, [x._form_with_key(getkey) for x in self._contents], - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -171,7 +165,6 @@ def typetracer(self): ak.index.Index(self._tags.raw(tt)), ak.index.Index(self._index.raw(tt)), [x.typetracer for x in self._contents], - self._typetracer_identifier(), self._parameters, tt, ) @@ -185,7 +178,6 @@ def _forget_length(self): self._tags.forget_length(), self._index, self._contents, - self._identifier, self._parameters, self._nplike, ) @@ -216,7 +208,6 @@ def merge_parameters(self, parameters): self._tags, self._index, self._contents, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -245,7 +236,6 @@ def _getitem_range(self, where): self._tags[start:stop], self._index[start:stop], self._contents, - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -255,7 +245,6 @@ def _getitem_field(self, where, only_fields=()): self._tags, self._index, [x._getitem_field(where, only_fields) for x in self._contents], - self._field_identifier(where), None, self._nplike, ).simplify_uniontype() @@ -265,7 +254,6 @@ def _getitem_fields(self, where, only_fields=()): self._tags, self._index, [x._getitem_fields(where, only_fields) for x in self._contents], - self._fields_identifier(where), None, self._nplike, ).simplify_uniontype() @@ -283,7 +271,6 @@ def _carry(self, carry, allow_lazy): nexttags, nextindex, self._contents, - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -418,7 +405,7 @@ def _getitem_next_jagged_generic(self, slicestarts, slicestops, slicecontent, ta raise ak._errors.index_error( self, ak.contents.ListArray( - slicestarts, slicestops, slicecontent, None, None, self._nplike + slicestarts, slicestops, slicecontent, None, self._nplike ), "cannot apply jagged slices to irreducible union arrays", ) @@ -448,7 +435,6 @@ def _getitem_next(self, head, tail, advanced): self._tags, outindex, outcontents, - self._identifier, self._parameters, self._nplike, ) @@ -660,9 +646,7 @@ def simplify_uniontype(self, merge=True, mergebool=False): return contents[0]._carry(index, True) else: - return UnionArray( - tags, index, contents, self._identifier, self._parameters, self._nplike - ) + return UnionArray(tags, index, contents, self._parameters, self._nplike) def num(self, axis, depth=0): posaxis = self.axis_wrap_if_negative(axis) @@ -677,7 +661,7 @@ def num(self, axis, depth=0): for content in self._contents: contents.append(content.num(posaxis, depth)) out = UnionArray( - self._tags, self._index, contents, None, self._parameters, self._nplike + self._tags, self._index, contents, self._parameters, self._nplike ) return out.simplify_uniontype(True, False) @@ -763,7 +747,7 @@ def _offsets_and_flattened(self, axis, depth): return ( tooffsets, UnionArray( - totags, toindex, contents, None, self._parameters, self._nplike + totags, toindex, contents, self._parameters, self._nplike ), ) @@ -775,7 +759,6 @@ def _offsets_and_flattened(self, axis, depth): self._tags, self._index, contents, - None, self._parameters, self._nplike, ), @@ -874,9 +857,7 @@ def _reverse_merge(self, other): ) parameters = ak._util.merge_parameters(self._parameters, other._parameters) - return ak.contents.UnionArray( - tags, index, contents, None, parameters, self._nplike - ) + return ak.contents.UnionArray(tags, index, contents, parameters, self._nplike) def mergemany(self, others): if len(others) == 0: @@ -971,7 +952,7 @@ def mergemany(self, others): ) next = ak.contents.UnionArray( - nexttags, nextindex, nextcontents, None, parameters, self._nplike + nexttags, nextindex, nextcontents, parameters, self._nplike ) # Given UnionArray's merging_strategy, tail is always empty, but just to be formal... @@ -993,7 +974,6 @@ def fill_none(self, value): self._tags, self._index, contents, - self._identifier, self._parameters, self._nplike, ) @@ -1011,7 +991,6 @@ def _local_index(self, axis, depth): self._tags, self._index, contents, - self._identifier, self._parameters, self._nplike, ) @@ -1032,7 +1011,6 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): self._tags, self._index, contents, - self._identifier, self._parameters, self._nplike, ) @@ -1045,7 +1023,6 @@ def numbers_to_type(self, name): self._tags, self._index, contents, - self._identifier, self._parameters, self._nplike, ) @@ -1083,7 +1060,7 @@ def _argsort_next( simplified = self.simplify_uniontype(mergebool=True) if simplified.length == 0: return ak.contents.NumpyArray( - self._nplike.empty(0, np.int64), None, None, self._nplike + self._nplike.empty(0, np.int64), None, self._nplike ) if isinstance(simplified, ak.contents.UnionArray): @@ -1198,8 +1175,6 @@ def _nbytes_part(self): result = self.tags._nbytes_part() + self.index._nbytes_part() for content in self.contents: result = result + content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() return result def _pad_none(self, target, axis, depth, clip): @@ -1214,7 +1189,6 @@ def _pad_none(self, target, axis, depth, clip): self.tags, self.index, contents, - self._identifier, self._parameters, self._nplike, ) @@ -1352,7 +1326,6 @@ def continuation(): ) for content in self._contents ], - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -1412,7 +1385,6 @@ def packed(self): ak.index.Index8(tags, nplike=self.nplike), ak.index.Index(index, nplike=self.nplike), contents, - self._identifier, self._parameters, self._nplike, ) @@ -1438,7 +1410,6 @@ def _to_nplike(self, nplike): self._tags, index, contents, - identifier=self.identifier, parameters=self.parameters, nplike=nplike, ) diff --git a/src/awkward/contents/unmaskedarray.py b/src/awkward/contents/unmaskedarray.py index e0aeb63988..b8372d84ee 100644 --- a/src/awkward/contents/unmaskedarray.py +++ b/src/awkward/contents/unmaskedarray.py @@ -16,13 +16,11 @@ class UnmaskedArray(Content): def copy( self, content=unset, - identifier=unset, parameters=unset, nplike=unset, ): return UnmaskedArray( self._content if content is unset else content, - self._identifier if identifier is unset else identifier, self._parameters if parameters is unset else parameters, self._nplike if nplike is unset else nplike, ) @@ -33,11 +31,10 @@ def __copy__(self): def __deepcopy__(self, memo): return self.copy( content=copy.deepcopy(self._content, memo), - identifier=copy.deepcopy(self._identifier, memo), parameters=copy.deepcopy(self._parameters, memo), ) - def __init__(self, content, identifier=None, parameters=None, nplike=None): + def __init__(self, content, parameters=None, nplike=None): if not isinstance(content, Content): raise ak._errors.wrap_error( TypeError( @@ -50,7 +47,7 @@ def __init__(self, content, identifier=None, parameters=None, nplike=None): nplike = content.nplike self._content = content - self._init(identifier, parameters, nplike) + self._init(parameters, nplike) @property def content(self): @@ -62,7 +59,6 @@ def _form_with_key(self, getkey): form_key = getkey(self) return self.Form( self._content._form_with_key(getkey), - has_identifier=self._identifier is not None, parameters=self._parameters, form_key=form_key, ) @@ -76,7 +72,6 @@ def typetracer(self): tt = ak._typetracer.TypeTracer.instance() return UnmaskedArray( self._content.typetracer, - self._typetracer_identifier(), self._parameters, tt, ) @@ -88,7 +83,6 @@ def length(self): def _forget_length(self): return UnmaskedArray( self._content._forget_length(), - self._identifier, self._parameters, self._nplike, ) @@ -110,7 +104,6 @@ def _repr(self, indent, pre, post): def merge_parameters(self, parameters): return UnmaskedArray( self._content, - self._identifier, ak._util.merge_parameters(self._parameters, parameters), self._nplike, ) @@ -120,7 +113,6 @@ def toIndexedOptionArray64(self): return ak.contents.IndexedOptionArray( ak.index.Index64(arange, nplike=self.nplike), self._content, - self._identifier, self._parameters, self._nplike, ) @@ -132,7 +124,6 @@ def toByteMaskedArray(self, valid_when): ), self._content, valid_when, - self._identifier, self._parameters, self._nplike, ) @@ -150,7 +141,6 @@ def toBitMaskedArray(self, valid_when, lsb_order): valid_when, self.length, lsb_order, - self._identifier, self._parameters, self._nplike, ) @@ -181,7 +171,6 @@ def _getitem_range(self, where): assert step == 1 return UnmaskedArray( self._content._getitem_range(slice(start, stop)), - self._range_identifier(start, stop), self._parameters, self._nplike, ) @@ -189,7 +178,6 @@ def _getitem_range(self, where): def _getitem_field(self, where, only_fields=()): return UnmaskedArray( self._content._getitem_field(where, only_fields), - self._field_identifier(where), None, self._nplike, ) @@ -197,7 +185,6 @@ def _getitem_field(self, where, only_fields=()): def _getitem_fields(self, where, only_fields=()): return UnmaskedArray( self._content._getitem_fields(where, only_fields), - self._fields_identifier(where), None, self._nplike, ) @@ -205,7 +192,6 @@ def _getitem_fields(self, where, only_fields=()): def _carry(self, carry, allow_lazy): return UnmaskedArray( self._content._carry(carry, allow_lazy), - self._carry_identifier(carry), self._parameters, self._nplike, ) @@ -215,7 +201,6 @@ def _getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail): self._content._getitem_next_jagged( slicestarts, slicestops, slicecontent, tail ), - self._identifier, self._parameters, self._nplike, ) @@ -229,7 +214,6 @@ def _getitem_next(self, head, tail, advanced): ): return UnmaskedArray( self._content._getitem_next(head, tail, advanced), - self._identifier, self._parameters, self._nplike, ).simplify_optiontype() @@ -258,7 +242,6 @@ def project(self, mask=None): mask, self._content, False, - None, self._parameters, self._nplike, ).project() @@ -290,7 +273,7 @@ def num(self, axis, depth=0): return out else: return ak.contents.UnmaskedArray( - self._content.num(posaxis, depth), None, self._parameters, self._nplike + self._content.num(posaxis, depth), self._parameters, self._nplike ) def _offsets_and_flattened(self, axis, depth): @@ -302,7 +285,7 @@ def _offsets_and_flattened(self, axis, depth): if offsets.length == 0: return ( offsets, - UnmaskedArray(flattened, None, self._parameters, self._nplike), + UnmaskedArray(flattened, self._parameters, self._nplike), ) else: @@ -340,7 +323,6 @@ def mergemany(self, others): return UnmaskedArray( self._content.mergemany(tail_contents), - None, parameters, self._nplike, ) @@ -358,7 +340,6 @@ def _local_index(self, axis, depth): else: return UnmaskedArray( self._content._local_index(posaxis, depth), - self._identifier, self._parameters, self._nplike, ) @@ -366,7 +347,6 @@ def _local_index(self, axis, depth): def numbers_to_type(self, name): return ak.contents.UnmaskedArray( self._content.numbers_to_type(name), - self._identifier, self._parameters, self._nplike, ) @@ -409,7 +389,6 @@ def _argsort_next( tmp = ak.contents.UnmaskedArray( out._content, None, - None, self._nplike, ).simplify_optiontype() @@ -418,7 +397,6 @@ def _argsort_next( out._size, out._length, None, - None, self._nplike, ) @@ -442,7 +420,6 @@ def _sort_next( if isinstance(out, ak.contents.RegularArray): tmp = ak.contents.UnmaskedArray( out._content, - self._identifier, self._parameters, self._nplike, ).simplify_optiontype() @@ -451,7 +428,6 @@ def _sort_next( tmp, out._size, out._length, - self._identifier, self._parameters, self._nplike, ) @@ -468,7 +444,6 @@ def _combinations(self, n, replacement, recordlookup, parameters, axis, depth): self._content._combinations( n, replacement, recordlookup, parameters, posaxis, depth ), - self._identifier, self._parameters, self._nplike, ) @@ -513,10 +488,7 @@ def _validity_error(self, path): return self._content.validity_error(path + ".content") def _nbytes_part(self): - result = self.content._nbytes_part() - if self.identifier is not None: - result = result + self.identifier._nbytes_part() - return result + return self.content._nbytes_part() def _pad_none(self, target, axis, depth, clip): posaxis = self.axis_wrap_if_negative(axis) @@ -527,7 +499,6 @@ def _pad_none(self, target, axis, depth, clip): else: return ak.contents.UnmaskedArray( self._content._pad_none(target, posaxis, depth, clip), - None, self._parameters, self._nplike, ) @@ -564,7 +535,6 @@ def continuation(): lateral_context, options, ), - self._identifier, self._parameters if options["keep_parameters"] else None, self._nplike, ) @@ -600,9 +570,7 @@ def continuation(): raise ak._errors.wrap_error(AssertionError(result)) def packed(self): - return UnmaskedArray( - self._content.packed(), self._identifier, self._parameters, self._nplike - ) + return UnmaskedArray(self._content.packed(), self._parameters, self._nplike) def _to_list(self, behavior, json_conversions): out = self._to_list_custom(behavior, json_conversions) @@ -615,7 +583,6 @@ def _to_nplike(self, nplike): content = self._content._to_nplike(nplike) return UnmaskedArray( content, - identifier=self.identifier, parameters=self.parameters, nplike=nplike, ) diff --git a/src/awkward/forms/bitmaskedform.py b/src/awkward/forms/bitmaskedform.py index 71d543227e..01e3860280 100644 --- a/src/awkward/forms/bitmaskedform.py +++ b/src/awkward/forms/bitmaskedform.py @@ -13,7 +13,6 @@ def __init__( content, valid_when, lsb_order, - has_identifier=False, parameters=None, form_key=None, ): @@ -54,7 +53,7 @@ def __init__( self._content = content self._valid_when = valid_when self._lsb_order = lsb_order - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def mask(self): @@ -107,8 +106,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, BitMaskedForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._mask == other._mask and self._valid_when == other._valid_when and self._lsb_order == other._lsb_order @@ -134,7 +132,6 @@ def simplify_optiontype(self): return ak.forms.IndexedOptionForm( "i64", self._content, - has_identifier=self._has_identifier, parameters=self._parameters, ).simplify_optiontype() else: @@ -183,7 +180,6 @@ def _select_columns(self, index, specifier, matches, output): self._content._select_columns(index, specifier, matches, output), self._valid_when, self._lsb_order, - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/bytemaskedform.py b/src/awkward/forms/bytemaskedform.py index 14404d2d79..62e326527b 100644 --- a/src/awkward/forms/bytemaskedform.py +++ b/src/awkward/forms/bytemaskedform.py @@ -12,7 +12,6 @@ def __init__( mask, content, valid_when, - has_identifier=False, parameters=None, form_key=None, ): @@ -44,7 +43,7 @@ def __init__( self._mask = mask self._content = content self._valid_when = valid_when - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def mask(self): @@ -91,8 +90,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, ByteMaskedForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._mask == other._mask and self._valid_when == other._valid_when and _parameters_equal( @@ -117,7 +115,6 @@ def simplify_optiontype(self): return ak.forms.IndexedOptionForm( "i64", self._content, - has_identifier=self._has_identifier, parameters=self._parameters, ).simplify_optiontype() else: @@ -165,7 +162,6 @@ def _select_columns(self, index, specifier, matches, output): self._mask, self._content._select_columns(index, specifier, matches, output), self._valid_when, - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/emptyform.py b/src/awkward/forms/emptyform.py index 576055f556..94f9849a11 100644 --- a/src/awkward/forms/emptyform.py +++ b/src/awkward/forms/emptyform.py @@ -8,8 +8,8 @@ class EmptyForm(Form): is_NumpyType = True is_UnknownType = True - def __init__(self, has_identifier=False, parameters=None, form_key=None): - self._init(has_identifier, parameters, form_key) + def __init__(self, parameters=None, form_key=None): + self._init(parameters, form_key) def __repr__(self): args = self._repr_args() @@ -25,11 +25,7 @@ def _type(self, typestrs): ) def __eq__(self, other): - return ( - isinstance(other, EmptyForm) - and self._has_identifier == other._has_identifier - and self._form_key == other._form_key - ) + return isinstance(other, EmptyForm) and self._form_key == other._form_key def toNumpyForm(self, dtype): return ak.forms.numpyform.from_dtype(dtype, self._parameters) diff --git a/src/awkward/forms/form.py b/src/awkward/forms/form.py index 1abb676a6a..bd3b90dacf 100644 --- a/src/awkward/forms/form.py +++ b/src/awkward/forms/form.py @@ -19,25 +19,21 @@ def from_dict(input: dict) -> Form: return ak.forms.NumpyForm(primitive=input) assert isinstance(input, dict) - has_identifier = input.get("has_identifier", input.get("has_identities", False)) parameters = input.get("parameters", None) form_key = input.get("form_key", None) if input["class"] == "NumpyArray": primitive = input["primitive"] inner_shape = input.get("inner_shape", []) - return ak.forms.NumpyForm( - primitive, inner_shape, has_identifier, parameters, form_key - ) + return ak.forms.NumpyForm(primitive, inner_shape, parameters, form_key) elif input["class"] == "EmptyArray": - return ak.forms.EmptyForm(has_identifier, parameters, form_key) + return ak.forms.EmptyForm(parameters, form_key) elif input["class"] == "RegularArray": return ak.forms.RegularForm( content=from_dict(input["content"]), size=input["size"], - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -47,7 +43,6 @@ def from_dict(input: dict) -> Form: starts=input["starts"], stops=input["stops"], content=from_dict(input["content"]), - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -61,7 +56,6 @@ def from_dict(input: dict) -> Form: return ak.forms.ListOffsetForm( offsets=input["offsets"], content=from_dict(input["content"]), - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -89,7 +83,6 @@ def from_dict(input: dict) -> Form: return ak.forms.RecordForm( contents=contents, fields=fields, - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -103,7 +96,6 @@ def from_dict(input: dict) -> Form: return ak.forms.IndexedForm( index=input["index"], content=from_dict(input["content"]), - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -116,7 +108,6 @@ def from_dict(input: dict) -> Form: return ak.forms.IndexedOptionForm( index=input["index"], content=from_dict(input["content"]), - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -126,7 +117,6 @@ def from_dict(input: dict) -> Form: mask=input["mask"], content=from_dict(input["content"]), valid_when=input["valid_when"], - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -137,7 +127,6 @@ def from_dict(input: dict) -> Form: content=from_dict(input["content"]), valid_when=input["valid_when"], lsb_order=input["lsb_order"], - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -145,7 +134,6 @@ def from_dict(input: dict) -> Form: elif input["class"] == "UnmaskedArray": return ak.forms.UnmaskedForm( content=from_dict(input["content"]), - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -160,7 +148,6 @@ def from_dict(input: dict) -> Form: tags=input["tags"], index=input["index"], contents=[from_dict(content) for content in input["contents"]], - has_identifier=has_identifier, parameters=parameters, form_key=form_key, ) @@ -275,15 +262,7 @@ class Form: is_RecordType = False is_UnionType = False - def _init(self, has_identifier, parameters, form_key): - if not isinstance(has_identifier, bool): - raise _errors.wrap_error( - TypeError( - "{} 'has_identifier' must be of type bool, not {}".format( - type(self).__name__, repr(has_identifier) - ) - ) - ) + def _init(self, parameters, form_key): if parameters is not None and not isinstance(parameters, dict): raise _errors.wrap_error( TypeError( @@ -301,14 +280,9 @@ def _init(self, has_identifier, parameters, form_key): ) ) - self._has_identifier = has_identifier self._parameters = parameters self._form_key = form_key - @property - def has_identifier(self): - return self._has_identifier - @property def parameters(self): if self._parameters is None: @@ -364,8 +338,6 @@ def to_dict(self, verbose=True): return self._to_dict_part(verbose, toplevel=True) def _to_dict_extra(self, out, verbose): - if verbose or self._has_identifier: - out["has_identifier"] = self._has_identifier if verbose or (self._parameters is not None and len(self._parameters) > 0): out["parameters"] = self.parameters if verbose or self._form_key is not None: @@ -377,12 +349,8 @@ def to_json(self): def _repr_args(self): out = [] - if self._has_identifier is not False: - out.append("has_identifier=" + repr(self._has_identifier)) - if self._parameters is not None and len(self._parameters) > 0: out.append("parameters=" + repr(self._parameters)) - if self._form_key is not None: out.append("form_key=" + repr(self._form_key)) return out diff --git a/src/awkward/forms/indexedform.py b/src/awkward/forms/indexedform.py index 2f2062eb75..3ca023ba73 100644 --- a/src/awkward/forms/indexedform.py +++ b/src/awkward/forms/indexedform.py @@ -11,7 +11,6 @@ def __init__( self, index, content=None, - has_identifier=False, parameters=None, form_key=None, ): @@ -34,7 +33,7 @@ def __init__( self._index = index self._content = content - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def index(self): @@ -85,8 +84,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, IndexedForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._index == other._index and _parameters_equal( self._parameters, other._parameters, only_array_record=True @@ -141,7 +139,6 @@ def _select_columns(self, index, specifier, matches, output): return IndexedForm( self._index, self._content._select_columns(index, specifier, matches, output), - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/indexedoptionform.py b/src/awkward/forms/indexedoptionform.py index 55db36345c..ca60fff396 100644 --- a/src/awkward/forms/indexedoptionform.py +++ b/src/awkward/forms/indexedoptionform.py @@ -12,7 +12,6 @@ def __init__( self, index, content, - has_identifier=False, parameters=None, form_key=None, ): @@ -35,7 +34,7 @@ def __init__( self._index = index self._content = content - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def index(self): @@ -76,8 +75,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, IndexedOptionForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._index == other._index and _parameters_equal( self._parameters, other._parameters, only_array_record=True @@ -101,7 +99,6 @@ def simplify_optiontype(self): return ak.forms.IndexedOptionForm( "i64", self._content.content, - has_identifier=self._has_identifier, parameters=self._parameters, ).simplify_optiontype() else: @@ -152,7 +149,6 @@ def _select_columns(self, index, specifier, matches, output): return IndexedOptionForm( self._index, self._content._select_columns(index, specifier, matches, output), - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/listform.py b/src/awkward/forms/listform.py index 0e10102c94..20b81500e1 100644 --- a/src/awkward/forms/listform.py +++ b/src/awkward/forms/listform.py @@ -12,7 +12,6 @@ def __init__( starts, stops, content, - has_identifier=False, parameters=None, form_key=None, ): @@ -44,7 +43,7 @@ def __init__( self._starts = starts self._stops = stops self._content = content - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def starts(self): @@ -87,8 +86,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, ListForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._starts == other._starts and self._stops == other._stops and _parameters_equal( @@ -161,7 +159,6 @@ def _select_columns(self, index, specifier, matches, output): self._starts, self._stops, self._content._select_columns(index, specifier, matches, output), - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/listoffsetform.py b/src/awkward/forms/listoffsetform.py index 397e01a1b1..a13457cd4d 100644 --- a/src/awkward/forms/listoffsetform.py +++ b/src/awkward/forms/listoffsetform.py @@ -7,9 +7,7 @@ class ListOffsetForm(Form): is_ListType = True - def __init__( - self, offsets, content, has_identifier=False, parameters=None, form_key=None - ): + def __init__(self, offsets, content, parameters=None, form_key=None): if not ak._util.isstr(offsets): raise ak._errors.wrap_error( TypeError( @@ -21,7 +19,7 @@ def __init__( self._offsets = offsets self._content = content - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def offsets(self): @@ -58,8 +56,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, ListOffsetForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._offsets == other._offsets and _parameters_equal( self._parameters, other._parameters, only_array_record=True @@ -130,7 +127,6 @@ def _select_columns(self, index, specifier, matches, output): return ListOffsetForm( self._offsets, self._content._select_columns(index, specifier, matches, output), - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/numpyform.py b/src/awkward/forms/numpyform.py index 6b04156101..52fda0077b 100644 --- a/src/awkward/forms/numpyform.py +++ b/src/awkward/forms/numpyform.py @@ -40,7 +40,6 @@ def __init__( self, primitive, inner_shape=(), - has_identifier=False, parameters=None, form_key=None, ): @@ -58,7 +57,7 @@ def __init__( self._primitive = primitive self._inner_shape = tuple(inner_shape) - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def primitive(self): @@ -84,7 +83,6 @@ def _to_dict_part(self, verbose, toplevel): not verbose and not toplevel and len(self._inner_shape) == 0 - and not self._has_identifier and (self._parameters is None or len(self._parameters) == 0) and self._form_key is None ): @@ -115,8 +113,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, NumpyForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._primitive == other._primitive and self._inner_shape == other._inner_shape and _parameters_equal( @@ -127,10 +124,9 @@ def __eq__(self, other): return False def toRegularForm(self): - out = NumpyForm(self._primitive, (), False, None, None) + out = NumpyForm(self._primitive, (), None, None) for x in self._inner_shape[::-1]: - out = ak.forms.RegularForm(out, x, False, None, None) - out._has_identifier = self._has_identifier + out = ak.forms.RegularForm(out, x, None, None) out._parameters = self._parameters return out diff --git a/src/awkward/forms/recordform.py b/src/awkward/forms/recordform.py index 253221687c..f95255a19e 100644 --- a/src/awkward/forms/recordform.py +++ b/src/awkward/forms/recordform.py @@ -14,7 +14,6 @@ def __init__( self, contents, fields, - has_identifier=False, parameters=None, form_key=None, ): @@ -46,7 +45,7 @@ def __init__( self._fields = fields self._contents = list(contents) - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def fields(self): @@ -157,8 +156,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, RecordForm): if ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self.is_tuple == other.is_tuple and len(self._contents) == len(other._contents) and _parameters_equal( @@ -247,7 +245,6 @@ def _select_columns(self, index, specifier, matches, output): return RecordForm( contents, fields, - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/regularform.py b/src/awkward/forms/regularform.py index 1c0ce10290..87090c8628 100644 --- a/src/awkward/forms/regularform.py +++ b/src/awkward/forms/regularform.py @@ -8,9 +8,7 @@ class RegularForm(Form): is_ListType = True is_RegularType = True - def __init__( - self, content, size, has_identifier=False, parameters=None, form_key=None - ): + def __init__(self, content, size, parameters=None, form_key=None): if not isinstance(content, Form): raise ak._errors.wrap_error( TypeError( @@ -30,7 +28,7 @@ def __init__( self._content = content self._size = int(size) - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def content(self): @@ -65,8 +63,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, RegularForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and self._size == other._size and _parameters_equal( self._parameters, other._parameters, only_array_record=True @@ -137,7 +134,6 @@ def _select_columns(self, index, specifier, matches, output): return RegularForm( self._content._select_columns(index, specifier, matches, output), self._size, - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/unionform.py b/src/awkward/forms/unionform.py index ade32006c7..b976ecc704 100644 --- a/src/awkward/forms/unionform.py +++ b/src/awkward/forms/unionform.py @@ -14,7 +14,6 @@ def __init__( tags, index, contents, - has_identifier=False, parameters=None, form_key=None, ): @@ -55,7 +54,7 @@ def __init__( self._tags = tags self._index = index self._contents = list(contents) - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def tags(self): @@ -104,7 +103,6 @@ def _type(self, typestrs): def __eq__(self, other): if ( isinstance(other, UnionForm) - and self._has_identifier == other._has_identifier and self._form_key == other._form_key and self._tags == other._tags and self._index == other._index @@ -205,9 +203,7 @@ def _select_columns(self, index, specifier, matches, output): contents.append(next_content) if len(contents) == 0: - return ak.forms.EmptyForm( - self._has_identifier, self._parameters, self._form_key - ) + return ak.forms.EmptyForm(self._parameters, self._form_key) elif len(contents) == 1: return contents[0] else: @@ -215,7 +211,6 @@ def _select_columns(self, index, specifier, matches, output): self._tags, self._index, contents, - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/forms/unmaskedform.py b/src/awkward/forms/unmaskedform.py index f7089fc892..f0e2a9353e 100644 --- a/src/awkward/forms/unmaskedform.py +++ b/src/awkward/forms/unmaskedform.py @@ -10,7 +10,6 @@ class UnmaskedForm(Form): def __init__( self, content, - has_identifier=False, parameters=None, form_key=None, ): @@ -24,7 +23,7 @@ def __init__( ) self._content = content - self._init(has_identifier, parameters, form_key) + self._init(parameters, form_key) @property def content(self): @@ -53,8 +52,7 @@ def _type(self, typestrs): def __eq__(self, other): if isinstance(other, UnmaskedForm): return ( - self._has_identifier == other._has_identifier - and self._form_key == other._form_key + self._form_key == other._form_key and _parameters_equal( self._parameters, other._parameters, only_array_record=True ) @@ -122,7 +120,6 @@ def _columns(self, path, output, list_indicator): def _select_columns(self, index, specifier, matches, output): return UnmaskedForm( self._content._select_columns(index, specifier, matches, output), - self._has_identifier, self._parameters, self._form_key, ) diff --git a/src/awkward/identifier.py b/src/awkward/identifier.py deleted file mode 100644 index 75b11799d0..0000000000 --- a/src/awkward/identifier.py +++ /dev/null @@ -1,140 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -import awkward as ak - -np = ak.nplikes.NumpyMetadata.instance() - - -def _identifiers_equal(one, two): - if one is None and two is None: - return True - elif isinstance(one, Identifier) and isinstance(two, Identifier): - return one.layout_equal(two, index_dtype=True) - else: - return False - - -class Identifier: - _numrefs = 0 - - @staticmethod - def newref(): - out = Identifier._numrefs - Identifier._numrefs += 1 - return out - - def __init__(self, ref, fieldloc, data): - self._ref = ref - self._fieldloc = fieldloc - if not isinstance(fieldloc, dict) or not all( - ak._util.isint(k) and ak._util.isstr(v) for k, v in fieldloc.items() - ): - raise ak._errors.wrap_error( - TypeError("Identifier fieldloc must be a dict of int -> str") - ) - self._nplike = ak.nplikes.nplike_of(data) - - self._data = self._nplike.asarray(data, order="C") - if len(self._data.shape) != 2: - raise ak._errors.wrap_error( - TypeError("Identifier data must be 2-dimensional") - ) - if self._data.dtype not in (np.dtype(np.int32), np.dtype(np.int64)): - raise ak._errors.wrap_error( - TypeError("Identifier data must be int32, int64") - ) - - @classmethod - def zeros(cls, ref, fieldloc, length, width, nplike, dtype): - return Identifier(ref, fieldloc, nplike.zeros((length, width), dtype=dtype)) - - @classmethod - def empty(cls, ref, fieldloc, length, width, nplike, dtype): - return Identifier(ref, fieldloc, nplike.empty((length, width), dtype=dtype)) - - @property - def ref(self): - return self._ref - - @property - def fieldloc(self): - return self._fieldloc - - @property - def data(self): - return self._data - - @property - def nplike(self): - return self._nplike - - @property - def dtype(self): - return self._data.dtype - - @property - def shape(self): - return self._data.shape - - def __len__(self): - return len(self._data) - - def width(self): - return self._data.shape[1] - - def to64(self): - return Identifier(self._ref, self._fieldloc, self._data.astype(np.int64)) - - def __getitem__(self, where): - return self._data[where] - - def __copy__(self): - return Identifier(self._ref, self._fieldloc, self._data.copy()) - - def __repr__(self): - return self._repr("", "", "") - - def _repr(self, indent, pre, post): - out = [indent, pre, " 9: - arraystr_lines = arraystr_lines[:4] + [" ..."] + arraystr_lines[-4:] - out.append(">\n" + indent + " ") - out.append(("\n" + indent + " ").join(arraystr_lines)) - out.append("\n" + indent + "") - - out.append(post) - return "".join(out) - - def convert_to(self, nplike): - return Identifier(self._ref, self._fieldloc, nplike.asarray(self._data)) - - def referentially_equal(self, other): - return ( - self._ref == other._ref - and self._fieldloc == other._fieldloc - and self._data.ctypes.data == other._data.ctypes.data - and self._data.shape == other._data.shape - and self._data.strides == other._data.strides - and self._data.dtype == other._data.dtype - ) - - def _nbytes_part(self): - return self.data.nbytes - - def layout_equal(self, other, index_dtype=True): - if self._ref != other._ref or self._fieldloc != other._fieldloc: - return False - if index_dtype and self._data.dtype != other._data.dtype: - return False - return self._nplike.array_equal(self._data, other._data) diff --git a/src/awkward/operations/ak_from_buffers.py b/src/awkward/operations/ak_from_buffers.py index 6a74bf25d2..9c65d5ab58 100644 --- a/src/awkward/operations/ak_from_buffers.py +++ b/src/awkward/operations/ak_from_buffers.py @@ -125,19 +125,12 @@ def getkey(form, attribute): def reconstitute(form, length, container, getkey, nplike): - if form.has_identifier: - raise ak._errors.wrap_error( - NotImplementedError("ak.from_buffers for an array with an Identifier") - ) - else: - identifier = None - if isinstance(form, ak.forms.EmptyForm): if length != 0: raise ak._errors.wrap_error( ValueError(f"EmptyForm node, but the expected length is {length}") ) - return ak.contents.EmptyArray(identifier, form.parameters) + return ak.contents.EmptyArray(form.parameters) elif isinstance(form, ak.forms.NumpyForm): dtype = ak.types.numpytype.primitive_to_dtype(form.primitive) @@ -151,11 +144,11 @@ def reconstitute(form, length, container, getkey, nplike): data = data.reshape((length,) + form.inner_shape) else: data = data.reshape((-1,) + form.inner_shape) - return ak.contents.NumpyArray(data, identifier, form.parameters, nplike) + return ak.contents.NumpyArray(data, form.parameters, nplike) elif isinstance(form, ak.forms.UnmaskedForm): content = reconstitute(form.content, length, container, getkey, nplike) - return ak.contents.UnmaskedArray(content, identifier, form.parameters) + return ak.contents.UnmaskedArray(content, form.parameters) elif isinstance(form, ak.forms.BitMaskedForm): raw_array = container[getkey(form, "mask")] @@ -169,7 +162,6 @@ def reconstitute(form, length, container, getkey, nplike): form.valid_when, length, form.lsb_order, - identifier, form.parameters, ) @@ -182,7 +174,6 @@ def reconstitute(form, length, container, getkey, nplike): ak.index.Index(mask), reconstitute(form.content, length, container, getkey, nplike), form.valid_when, - identifier, form.parameters, ) @@ -197,7 +188,6 @@ def reconstitute(form, length, container, getkey, nplike): return ak.contents.IndexedOptionArray( ak.index.Index(index), reconstitute(form.content, next_length, container, getkey, nplike), - identifier, form.parameters, ) @@ -210,7 +200,6 @@ def reconstitute(form, length, container, getkey, nplike): return ak.contents.IndexedArray( ak.index.Index(index), reconstitute(form.content, next_length, container, getkey, nplike), - identifier, form.parameters, ) @@ -229,7 +218,6 @@ def reconstitute(form, length, container, getkey, nplike): ak.index.Index(starts), ak.index.Index(stops), reconstitute(form.content, next_length, container, getkey, nplike), - identifier, form.parameters, ) @@ -242,7 +230,6 @@ def reconstitute(form, length, container, getkey, nplike): return ak.contents.ListOffsetArray( ak.index.Index(offsets), reconstitute(form.content, next_length, container, getkey, nplike), - identifier, form.parameters, ) @@ -252,7 +239,6 @@ def reconstitute(form, length, container, getkey, nplike): reconstitute(form.content, next_length, container, getkey, nplike), form.size, length, - identifier, form.parameters, ) @@ -264,7 +250,6 @@ def reconstitute(form, length, container, getkey, nplike): ], None if form.is_tuple else form.fields, length, - identifier, form.parameters, ) @@ -291,7 +276,6 @@ def reconstitute(form, length, container, getkey, nplike): reconstitute(content, lengths[i], container, getkey, nplike) for i, content in enumerate(form.contents) ], - identifier, form.parameters, ) diff --git a/src/awkward/operations/ak_full_like.py b/src/awkward/operations/ak_full_like.py index c78f7b03ed..6f7a184f61 100644 --- a/src/awkward/operations/ak_full_like.py +++ b/src/awkward/operations/ak_full_like.py @@ -174,19 +174,16 @@ def action(layout, **kwargs): if fill_value == 0 or fill_value is _ZEROS: return ak.contents.NumpyArray( nplike.zeros_like(original), - layout.identifier, layout.parameters, ) elif fill_value == 1: return ak.contents.NumpyArray( nplike.ones_like(original), - layout.identifier, layout.parameters, ) else: return ak.contents.NumpyArray( nplike.full_like(original, fill_value), - layout.identifier, layout.parameters, ) else: diff --git a/src/awkward/operations/ak_singletons.py b/src/awkward/operations/ak_singletons.py index 4de05f4934..b4c873ea78 100644 --- a/src/awkward/operations/ak_singletons.py +++ b/src/awkward/operations/ak_singletons.py @@ -56,7 +56,6 @@ def action(layout, **kwargs): ak.contents.IndexedOptionArray( layout.index, layout.content, - layout.identifier, layout.parameters, ) ) diff --git a/src/awkward/operations/ak_to_layout.py b/src/awkward/operations/ak_to_layout.py index 36eb404c6a..b474df32f7 100644 --- a/src/awkward/operations/ak_to_layout.py +++ b/src/awkward/operations/ak_to_layout.py @@ -119,12 +119,7 @@ def _impl(array, allow_record, allow_other, numpytype): ) ) - return ak.contents.NumpyArray( - array, - parameters=None, - identifier=None, - nplike=typetracer, - ) + return ak.contents.NumpyArray(array, parameters=None, nplike=typetracer) elif isinstance(array, (str, bytes)): return _impl( diff --git a/src/awkward/operations/ak_with_name.py b/src/awkward/operations/ak_with_name.py index 752ad65269..e0848c4801 100644 --- a/src/awkward/operations/ak_with_name.py +++ b/src/awkward/operations/ak_with_name.py @@ -47,7 +47,6 @@ def action(layout, **ignore): layout.contents, layout.fields, len(layout), - layout.identifier, parameters, ) else: diff --git a/tests/test_0025-record-array.py b/tests/test_0025-record-array.py index 962284b566..03a93ca456 100644 --- a/tests/test_0025-record-array.py +++ b/tests/test_0025-record-array.py @@ -49,7 +49,6 @@ def test_basic(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -60,11 +59,9 @@ def test_basic(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -72,7 +69,6 @@ def test_basic(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -80,12 +76,10 @@ def test_basic(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -142,7 +136,6 @@ def test_basic(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -153,11 +146,9 @@ def test_basic(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -165,7 +156,6 @@ def test_basic(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -173,12 +163,10 @@ def test_basic(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } diff --git a/tests/test_0057-introducing-forms.py b/tests/test_0057-introducing-forms.py index e0e92bf929..0b0c4c1ea1 100644 --- a/tests/test_0057-introducing-forms.py +++ b/tests/test_0057-introducing-forms.py @@ -17,14 +17,12 @@ def test_forms(): assert form.inner_shape == () assert form.itemsize == 8 assert form.primitive == "float64" - assert form.has_identifier is False assert form.parameters == {} assert form.form_key is None assert json.loads(form.to_json()) == { "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -36,7 +34,6 @@ def test_forms(): form = ak.forms.NumpyForm( "float64", [1, 2, 3], - has_identifier=True, parameters={"hey": ["you", {"there": 3}]}, form_key="yowzers", ) @@ -46,14 +43,12 @@ def test_forms(): assert form.inner_shape == (1, 2, 3) assert form.itemsize == 8 assert form.primitive == "float64" - assert form.has_identifier is True assert form.parameters == {"hey": ["you", {"there": 3}]} assert form.form_key == "yowzers" assert json.loads(form.to_json()) == { "class": "NumpyArray", "inner_shape": [1, 2, 3], "primitive": "float64", - "has_identifier": True, "parameters": {"hey": ["you", {"there": 3}]}, "form_key": "yowzers", } @@ -61,7 +56,6 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [1, 2, 3], "primitive": "float64", - "has_identifier": True, "parameters": {"hey": ["you", {"there": 3}]}, "form_key": "yowzers", } @@ -84,13 +78,11 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, "valid_when": True, "lsb_order": False, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -113,7 +105,6 @@ def test_forms(): assert ak.forms.from_json(form.to_json()) == form assert json.loads(form.to_json()) == { "class": "EmptyArray", - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -139,11 +130,9 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -171,11 +160,9 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -205,11 +192,9 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -238,11 +223,9 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -271,7 +254,6 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -279,12 +261,10 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "bool", - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -316,7 +296,6 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -324,12 +303,10 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "bool", - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -356,12 +333,10 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, "size": 10, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -392,7 +367,6 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -400,12 +374,10 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "bool", - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } @@ -432,11 +404,9 @@ def test_forms(): "class": "NumpyArray", "inner_shape": [], "primitive": "float64", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {"hey": ["you"]}, "form_key": "yowzers", } diff --git a/tests/test_0127-tomask-operation.py b/tests/test_0127-tomask-operation.py index ab079a79ed..2d7b7e677a 100644 --- a/tests/test_0127-tomask-operation.py +++ b/tests/test_0127-tomask-operation.py @@ -201,7 +201,7 @@ def test_ByteMaskedArray_as_slice(): assert to_list(array[slicearray]) == [3.3, 6.6, None, None, 8.8, 6.6] -def test_ByteMaskedArray_setidentities(): +def test_ByteMaskedArray_whatever(): content = ak.operations.from_iter( [[0.0, 1.1, 2.2], [], [3.3, 4.4], [5.5], [6.6, 7.7, 8.8, 9.9], [321]], highlevel=False, diff --git a/tests/test_0884-index-and-identifier-refactoring.py b/tests/test_0884-index-and-identifier-refactoring.py index 0972c7f752..6b04bf0183 100644 --- a/tests/test_0884-index-and-identifier-refactoring.py +++ b/tests/test_0884-index-and-identifier-refactoring.py @@ -18,21 +18,3 @@ def test_index64(): assert len(py_array) == 10 assert "i64" == py_array.form - - -def test_identifier32(): - py_array = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int32 - ) - - assert len(py_array) == 5 - assert py_array._data.dtype == np.dtype(np.int32) - - -def test_identifier64(): - py_array = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) - - assert len(py_array) == 5 - assert py_array._data.dtype == np.dtype(np.int64) diff --git a/tests/test_0914-types-and-forms.py b/tests/test_0914-types-and-forms.py index c52f8b297c..396c41ea9f 100644 --- a/tests/test_0914-types-and-forms.py +++ b/tests/test_0914-types-and-forms.py @@ -1419,14 +1419,9 @@ def test_EmptyForm(): }""" ) assert ( - str( - ak.forms.emptyform.EmptyForm( - has_identifier=True, parameters={"x": 123}, form_key="hello" - ) - ) + str(ak.forms.emptyform.EmptyForm(parameters={"x": 123}, form_key="hello")) == """{ "class": "EmptyArray", - "has_identifier": true, "parameters": { "x": 123 }, @@ -1435,12 +1430,8 @@ def test_EmptyForm(): ) assert repr(ak.forms.emptyform.EmptyForm()) == "EmptyForm()" assert ( - repr( - ak.forms.emptyform.EmptyForm( - has_identifier=True, parameters={"x": 123}, form_key="hello" - ) - ) - == "EmptyForm(has_identifier=True, parameters={'x': 123}, form_key='hello')" + repr(ak.forms.emptyform.EmptyForm(parameters={"x": 123}, form_key="hello")) + == "EmptyForm(parameters={'x': 123}, form_key='hello')" ) assert ak.forms.emptyform.EmptyForm().to_dict(verbose=False) == { @@ -1448,34 +1439,29 @@ def test_EmptyForm(): } assert ak.forms.emptyform.EmptyForm().to_dict() == { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.emptyform.EmptyForm( - has_identifier=True, parameters={"x": 123}, form_key="hello" + parameters={"x": 123}, form_key="hello" ).to_dict(verbose=False) == { "class": "EmptyArray", - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } assert ak.forms.from_dict({"class": "EmptyArray"}).to_dict() == { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.from_dict( { "class": "EmptyArray", - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } ).to_dict() == { "class": "EmptyArray", - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -1499,12 +1485,11 @@ def test_NumpyForm(): ak.forms.numpyform.NumpyForm( primitive="bool", inner_shape=[1, 2, 3], - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "NumpyForm('bool', inner_shape=(1, 2, 3), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "NumpyForm('bool', inner_shape=(1, 2, 3), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.numpyform.NumpyForm("bool").to_dict(verbose=False) == { @@ -1515,21 +1500,18 @@ def test_NumpyForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.numpyform.NumpyForm( "bool", inner_shape=[1, 2, 3], - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "NumpyArray", "primitive": "bool", "inner_shape": [1, 2, 3], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2001,7 +1983,6 @@ def test_NumpyForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [1, 2, 3], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2009,7 +1990,6 @@ def test_NumpyForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [1, 2, 3], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2031,7 +2011,6 @@ def test_RegularForm(): ak.forms.regularform.RegularForm( ak.forms.emptyform.EmptyForm(), 10, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -2042,7 +2021,6 @@ def test_RegularForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -2062,12 +2040,11 @@ def test_RegularForm(): ak.forms.regularform.RegularForm( content=ak.forms.emptyform.EmptyForm(), size=10, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "RegularForm(EmptyForm(), 10, has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "RegularForm(EmptyForm(), 10, parameters={'x': 123}, form_key='hello')" ) assert ak.forms.regularform.RegularForm(ak.forms.emptyform.EmptyForm(), 10).to_dict( @@ -2084,25 +2061,21 @@ def test_RegularForm(): "size": 10, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.regularform.RegularForm( content=ak.forms.emptyform.EmptyForm(), size=10, - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "RegularArray", "size": 10, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2113,11 +2086,9 @@ def test_RegularForm(): "size": 10, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2126,7 +2097,6 @@ def test_RegularForm(): "class": "RegularArray", "size": 10, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2134,7 +2104,6 @@ def test_RegularForm(): "class": "RegularArray", "size": 10, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2146,12 +2115,10 @@ def test_RegularForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, "size": 10, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2204,7 +2171,6 @@ def test_ListForm(): "i32", "i32", ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -2216,7 +2182,6 @@ def test_ListForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -2237,12 +2202,11 @@ def test_ListForm(): starts="i32", stops="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "ListForm('i32', 'i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "ListForm('i32', 'i32', EmptyForm(), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.listform.ListForm( @@ -2261,11 +2225,9 @@ def test_ListForm(): "stops": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2273,7 +2235,6 @@ def test_ListForm(): starts="i32", stops="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -2281,7 +2242,6 @@ def test_ListForm(): "starts": "i32", "stops": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2298,11 +2258,9 @@ def test_ListForm(): "stops": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2319,11 +2277,9 @@ def test_ListForm(): "stops": "u32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2340,11 +2296,9 @@ def test_ListForm(): "stops": "i64", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2354,7 +2308,6 @@ def test_ListForm(): "starts": "i32", "stops": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2363,7 +2316,6 @@ def test_ListForm(): "starts": "i32", "stops": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2417,7 +2369,6 @@ def test_ListOffsetForm(): ak.forms.listoffsetform.ListOffsetForm( "i32", ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -2428,7 +2379,6 @@ def test_ListOffsetForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -2448,12 +2398,11 @@ def test_ListOffsetForm(): ak.forms.listoffsetform.ListOffsetForm( offsets="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "ListOffsetForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "ListOffsetForm('i32', EmptyForm(), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.listoffsetform.ListOffsetForm( @@ -2470,25 +2419,21 @@ def test_ListOffsetForm(): "offsets": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.listoffsetform.ListOffsetForm( offsets="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "ListOffsetArray", "offsets": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2503,11 +2448,9 @@ def test_ListOffsetForm(): "offsets": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2522,11 +2465,9 @@ def test_ListOffsetForm(): "offsets": "u32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2541,11 +2482,9 @@ def test_ListOffsetForm(): "offsets": "i64", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2554,7 +2493,6 @@ def test_ListOffsetForm(): "class": "ListOffsetArray", "offsets": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2562,7 +2500,6 @@ def test_ListOffsetForm(): "class": "ListOffsetArray", "offsets": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2622,7 +2559,6 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], None, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -2636,7 +2572,6 @@ def test_RecordForm(): }, "bool" ], - "has_identifier": true, "parameters": { "x": 123 }, @@ -2651,7 +2586,6 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], ["x", "y"], - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -2668,7 +2602,6 @@ def test_RecordForm(): }, "bool" ], - "has_identifier": true, "parameters": { "x": 123 }, @@ -2708,12 +2641,11 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], fields=None, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "RecordForm([EmptyForm(), NumpyForm('bool')], None, has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "RecordForm([EmptyForm(), NumpyForm('bool')], None, parameters={'x': 123}, form_key='hello')" ) assert ( repr( @@ -2723,12 +2655,11 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], fields=["x", "y"], - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "RecordForm([EmptyForm(), NumpyForm('bool')], ['x', 'y'], has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "RecordForm([EmptyForm(), NumpyForm('bool')], ['x', 'y'], parameters={'x': 123}, form_key='hello')" ) assert ak.forms.recordform.RecordForm( @@ -2762,7 +2693,6 @@ def test_RecordForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -2770,12 +2700,10 @@ def test_RecordForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2788,7 +2716,6 @@ def test_RecordForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -2796,12 +2723,10 @@ def test_RecordForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2811,7 +2736,6 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], fields=None, - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -2821,7 +2745,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2831,7 +2754,6 @@ def test_RecordForm(): ak.forms.numpyform.NumpyForm("bool"), ], fields=["x", "y"], - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -2841,7 +2763,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2860,7 +2781,6 @@ def test_RecordForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -2868,12 +2788,10 @@ def test_RecordForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2892,7 +2810,6 @@ def test_RecordForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -2900,12 +2817,10 @@ def test_RecordForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -2917,7 +2832,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2928,7 +2842,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2940,7 +2853,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2951,7 +2863,6 @@ def test_RecordForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -2993,7 +2904,6 @@ def test_IndexedForm(): ak.forms.indexedform.IndexedForm( "i32", ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3004,7 +2914,6 @@ def test_IndexedForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -3024,12 +2933,11 @@ def test_IndexedForm(): ak.forms.indexedform.IndexedForm( index="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "IndexedForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "IndexedForm('i32', EmptyForm(), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.indexedform.IndexedForm( @@ -3046,25 +2954,21 @@ def test_IndexedForm(): "index": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.indexedform.IndexedForm( index="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "IndexedArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3079,11 +2983,9 @@ def test_IndexedForm(): "index": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3098,11 +3000,9 @@ def test_IndexedForm(): "index": "u32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3117,11 +3017,9 @@ def test_IndexedForm(): "index": "i64", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3130,7 +3028,6 @@ def test_IndexedForm(): "class": "IndexedArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3138,7 +3035,6 @@ def test_IndexedForm(): "class": "IndexedArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3178,7 +3074,6 @@ def test_IndexedOptionForm(): ak.forms.indexedoptionform.IndexedOptionForm( "i32", ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3189,7 +3084,6 @@ def test_IndexedOptionForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -3209,12 +3103,11 @@ def test_IndexedOptionForm(): ak.forms.indexedoptionform.IndexedOptionForm( index="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "IndexedOptionForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "IndexedOptionForm('i32', EmptyForm(), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.indexedoptionform.IndexedOptionForm( @@ -3231,25 +3124,21 @@ def test_IndexedOptionForm(): "index": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.indexedoptionform.IndexedOptionForm( index="i32", content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "IndexedOptionArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3264,11 +3153,9 @@ def test_IndexedOptionForm(): "index": "i32", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3283,11 +3170,9 @@ def test_IndexedOptionForm(): "index": "i64", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3296,7 +3181,6 @@ def test_IndexedOptionForm(): "class": "IndexedOptionArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3304,7 +3188,6 @@ def test_IndexedOptionForm(): "class": "IndexedOptionArray", "index": "i32", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3347,7 +3230,6 @@ def test_ByteMaskedForm(): "i8", ak.forms.emptyform.EmptyForm(), True, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3359,7 +3241,6 @@ def test_ByteMaskedForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -3380,12 +3261,11 @@ def test_ByteMaskedForm(): mask="i8", content=ak.forms.emptyform.EmptyForm(), valid_when=True, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "ByteMaskedForm('i8', EmptyForm(), True, has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "ByteMaskedForm('i8', EmptyForm(), True, parameters={'x': 123}, form_key='hello')" ) assert ak.forms.bytemaskedform.ByteMaskedForm( @@ -3404,11 +3284,9 @@ def test_ByteMaskedForm(): "valid_when": True, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3416,7 +3294,6 @@ def test_ByteMaskedForm(): mask="i8", content=ak.forms.emptyform.EmptyForm(), valid_when=True, - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -3424,7 +3301,6 @@ def test_ByteMaskedForm(): "mask": "i8", "valid_when": True, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3441,11 +3317,9 @@ def test_ByteMaskedForm(): "valid_when": True, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3462,11 +3336,9 @@ def test_ByteMaskedForm(): "valid_when": True, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3476,7 +3348,6 @@ def test_ByteMaskedForm(): "mask": "i8", "valid_when": True, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3485,7 +3356,6 @@ def test_ByteMaskedForm(): "mask": "i8", "valid_when": True, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3563,7 +3433,6 @@ def test_BitMaskedForm(): ak.forms.emptyform.EmptyForm(), True, False, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3576,7 +3445,6 @@ def test_BitMaskedForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -3601,12 +3469,11 @@ def test_BitMaskedForm(): content=ak.forms.emptyform.EmptyForm(), valid_when=True, lsb_order=False, - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "BitMaskedForm('u8', EmptyForm(), True, False, has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "BitMaskedForm('u8', EmptyForm(), True, False, parameters={'x': 123}, form_key='hello')" ) assert ak.forms.bitmaskedform.BitMaskedForm( @@ -3627,11 +3494,9 @@ def test_BitMaskedForm(): "lsb_order": False, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3640,7 +3505,6 @@ def test_BitMaskedForm(): content=ak.forms.emptyform.EmptyForm(), valid_when=True, lsb_order=False, - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -3649,7 +3513,6 @@ def test_BitMaskedForm(): "valid_when": True, "lsb_order": False, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3668,11 +3531,9 @@ def test_BitMaskedForm(): "lsb_order": False, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3691,11 +3552,9 @@ def test_BitMaskedForm(): "lsb_order": False, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3706,7 +3565,6 @@ def test_BitMaskedForm(): "valid_when": True, "lsb_order": False, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3716,7 +3574,6 @@ def test_BitMaskedForm(): "valid_when": True, "lsb_order": False, "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3736,7 +3593,6 @@ def test_UnmaskedForm(): str( ak.forms.unmaskedform.UnmaskedForm( ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3746,7 +3602,6 @@ def test_UnmaskedForm(): "content": { "class": "EmptyArray" }, - "has_identifier": true, "parameters": { "x": 123 }, @@ -3761,12 +3616,11 @@ def test_UnmaskedForm(): repr( ak.forms.unmaskedform.UnmaskedForm( content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "UnmaskedForm(EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "UnmaskedForm(EmptyForm(), parameters={'x': 123}, form_key='hello')" ) assert ak.forms.unmaskedform.UnmaskedForm(ak.forms.emptyform.EmptyForm()).to_dict( @@ -3781,23 +3635,19 @@ def test_UnmaskedForm(): "class": "UnmaskedArray", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } assert ak.forms.unmaskedform.UnmaskedForm( content=ak.forms.emptyform.EmptyForm(), - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { "class": "UnmaskedArray", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3807,11 +3657,9 @@ def test_UnmaskedForm(): "class": "UnmaskedArray", "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -3819,14 +3667,12 @@ def test_UnmaskedForm(): { "class": "UnmaskedArray", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } ).to_dict(verbose=False) == { "class": "UnmaskedArray", "content": {"class": "EmptyArray"}, - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -3911,7 +3757,6 @@ def test_UnionForm(): ak.forms.emptyform.EmptyForm(), ak.forms.numpyform.NumpyForm("bool"), ], - has_identifier=True, parameters={"x": 123}, form_key="hello", ) @@ -3926,7 +3771,6 @@ def test_UnionForm(): }, "bool" ], - "has_identifier": true, "parameters": { "x": 123 }, @@ -3956,12 +3800,11 @@ def test_UnionForm(): ak.forms.emptyform.EmptyForm(), ak.forms.numpyform.NumpyForm("bool"), ], - has_identifier=True, parameters={"x": 123}, form_key="hello", ) ) - == "UnionForm('i8', 'i32', [EmptyForm(), NumpyForm('bool')], has_identifier=True, parameters={'x': 123}, form_key='hello')" + == "UnionForm('i8', 'i32', [EmptyForm(), NumpyForm('bool')], parameters={'x': 123}, form_key='hello')" ) assert ak.forms.unionform.UnionForm( @@ -3988,7 +3831,6 @@ def test_UnionForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -3996,12 +3838,10 @@ def test_UnionForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -4012,7 +3852,6 @@ def test_UnionForm(): ak.forms.emptyform.EmptyForm(), ak.forms.numpyform.NumpyForm("bool"), ], - has_identifier=True, parameters={"x": 123}, form_key="hello", ).to_dict(verbose=False) == { @@ -4023,7 +3862,6 @@ def test_UnionForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -4044,7 +3882,6 @@ def test_UnionForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -4052,12 +3889,10 @@ def test_UnionForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -4078,7 +3913,6 @@ def test_UnionForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -4086,12 +3920,10 @@ def test_UnionForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -4112,7 +3944,6 @@ def test_UnionForm(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -4120,12 +3951,10 @@ def test_UnionForm(): "class": "NumpyArray", "primitive": "bool", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -4138,7 +3967,6 @@ def test_UnionForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } @@ -4150,7 +3978,6 @@ def test_UnionForm(): {"class": "EmptyArray"}, "bool", ], - "has_identifier": True, "parameters": {"x": 123}, "form_key": "hello", } diff --git a/tests/test_0927-numpy-array-nbytes.py b/tests/test_0927-numpy-array-nbytes.py index c88f93ee7a..d99ab12e70 100644 --- a/tests/test_0927-numpy-array-nbytes.py +++ b/tests/test_0927-numpy-array-nbytes.py @@ -15,15 +15,8 @@ def test(): def test_NumpyArray_nbytes(): np_data = np.random.random(size=(4, 100 * 1024 * 1024 // 8 // 4)) - - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) - - assert identifier._nbytes_part() == np.dtype(np.int64).itemsize * 5 * 10 - - array = ak.contents.numpyarray.NumpyArray(np_data, identifier) - assert array.nbytes == np_data.nbytes + np.dtype(np.int64).itemsize * 5 * 10 + array = ak.contents.numpyarray.NumpyArray(np_data) + assert array.nbytes == np_data.nbytes def test_ByteMaskedArray_nbytes(): @@ -78,76 +71,44 @@ def test_BitMaskedArray_nbytes(): assert np.packbits(np_index).nbytes == 2 assert array.nbytes == np_array.nbytes + np.packbits(np_index).nbytes - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) array = ak.contents.bitmaskedarray.BitMaskedArray( ak.index.Index(np.packbits(np_index)), ak.contents.numpyarray.NumpyArray( np_array, - identifier, ), valid_when=True, length=13, lsb_order=False, - identifier=identifier, - ) - assert ( - array.nbytes - == np_array.nbytes - + np.packbits(np_index).nbytes - + 2 * np.dtype(np.int64).itemsize * 5 * 10 ) + assert array.nbytes == np_array.nbytes + np.packbits(np_index).nbytes def test_EmptyArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) - array = ak.contents.emptyarray.EmptyArray( - identifier=identifier, - ) - assert array.nbytes == np.dtype(np.int64).itemsize * 5 * 10 + array = ak.contents.emptyarray.EmptyArray() + assert array.nbytes == 0 def test_IndexedArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_index = np.array([2, 2, 0, 1, 4, 5, 4]) np_content = np.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6]) array = ak.contents.indexedarray.IndexedArray( # noqa: F841 ak.index.Index(np_index), ak.contents.numpyarray.NumpyArray(np_content), - identifier=identifier, - ) - assert ( - array.nbytes - == np_index.nbytes + np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 ) + assert array.nbytes == np_index.nbytes + np_content.nbytes def test_IndexedOptionArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_index = np.array([2, 2, -1, 1, -1, 5, 4]) np_content = np.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6]) array = ak.contents.indexedoptionarray.IndexedOptionArray( # noqa: F841 ak.index.Index(np_index), ak.contents.numpyarray.NumpyArray(np_content), - identifier=identifier, - ) - assert ( - array.nbytes - == np_index.nbytes + np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 ) + assert array.nbytes == np_index.nbytes + np_content.nbytes def test_ListArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_starts = np.array([4, 100, 1]) np_stops = np.array([7, 100, 3, 200]) np_content = np.array([6.6, 4.4, 5.5, 7.7, 3.3, 2.2, 1.1, 8.8]) @@ -155,51 +116,30 @@ def test_ListArray_nbytes(): ak.index.Index(np_starts), ak.index.Index(np_stops), ak.contents.numpyarray.NumpyArray(np_content), - identifier=identifier, - ) - assert ( - array.nbytes - == np_starts.nbytes - + np_stops.nbytes - + np_content.nbytes - + np.dtype(np.int64).itemsize * 5 * 10 ) + assert array.nbytes == np_starts.nbytes + np_stops.nbytes + np_content.nbytes def test_ListOffsetArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_offsets = np.array([7, 10, 10, 200]) np_content = np.array([6.6, 4.4, 5.5, 7.7, 3.3, 2.2, 1.1, 8.8]) array = ak.contents.ListOffsetArray( ak.index.Index(np_offsets), ak.contents.numpyarray.NumpyArray(np_content), - identifier=identifier, - ) - assert ( - array.nbytes - == np_offsets.nbytes + np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 ) + assert array.nbytes == np_offsets.nbytes + np_content.nbytes def test_RecordArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_content = np.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6]) array = ak.contents.recordarray.RecordArray( [ak.contents.numpyarray.NumpyArray(np_content)], ["nest"], - identifier=identifier, ) - assert array.nbytes == np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 + assert array.nbytes == np_content.nbytes def test_RegularArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_content = np.array([0.0, 1.1, 2.2, 33.33, 4.4, 5.5, -6.6]) array = ak.contents.regulararray.RegularArray( # noqa: F841 ak.contents.recordarray.RecordArray( @@ -207,15 +147,11 @@ def test_RegularArray_nbytes(): ["nest"], ), 3, - identifier=identifier, ) - assert array.nbytes == np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 + assert array.nbytes == np_content.nbytes def test_UnionArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_tags = np.array([1, 1, 0, 0, 1, 0, 1], dtype=np.int8) np_index = np.array([4, 3, 0, 1, 2, 2, 4, 100]) np_content1 = np.array([1, 2, 3]) @@ -227,28 +163,19 @@ def test_UnionArray_nbytes(): ak.contents.numpyarray.NumpyArray(np_content1), ak.contents.numpyarray.NumpyArray(np_content2), ], - identifier=identifier, ) assert ( array.nbytes - == np_tags.nbytes - + np_index.nbytes - + np_content1.nbytes - + np_content2.nbytes - + np.dtype(np.int64).itemsize * 5 * 10 + == np_tags.nbytes + np_index.nbytes + np_content1.nbytes + np_content2.nbytes ) def test_UnmaskedArray_nbytes(): - identifier = ak.identifier.Identifier.zeros( - 123, {1: "one", 2: "two"}, 5, 10, np, np.int64 - ) np_content = np.array([0.0, 2.2, 1.1, 3.3], dtype=np.float64) array = ak.contents.unmaskedarray.UnmaskedArray( - ak.contents.numpyarray.NumpyArray(np_content), - identifier=identifier, + ak.contents.numpyarray.NumpyArray(np_content) ) - assert array.nbytes == np_content.nbytes + np.dtype(np.int64).itemsize * 5 * 10 + assert array.nbytes == np_content.nbytes def test_highlevel(): diff --git a/tests/test_0958-new-forms-must-accept-old-form-json.py b/tests/test_0958-new-forms-must-accept-old-form-json.py index a9121a453a..efa780a3b8 100644 --- a/tests/test_0958-new-forms-must-accept-old-form-json.py +++ b/tests/test_0958-new-forms-must-accept-old-form-json.py @@ -9,13 +9,10 @@ def test_EmptyArray(): - v1 = json.loads( - '{"class":"EmptyArray","has_identities":false,"parameters":{},"form_key":null}' - ) + v1 = json.loads('{"class":"EmptyArray","parameters":{},"form_key":null}') v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -23,27 +20,25 @@ def test_EmptyArray(): def test_NumpyArray(): v1 = json.loads( - '{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}' + '{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"NumpyArray","inner_shape":[3,5],"itemsize":8,"format":"l","primitive":"int64","has_identities":false,"parameters":{},"form_key":null}' + '{"class":"NumpyArray","inner_shape":[3,5],"itemsize":8,"format":"l","primitive":"int64","parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { "class": "NumpyArray", "primitive": "int64", "inner_shape": [3, 5], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -51,7 +46,7 @@ def test_NumpyArray(): def test_RegularArray_NumpyArray(): v1 = json.loads( - '{"class":"RegularArray","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"size":3,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RegularArray","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"size":3,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -61,17 +56,15 @@ def test_RegularArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"RegularArray","content":{"class":"EmptyArray","has_identities":false,"parameters":{},"form_key":null},"size":0,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RegularArray","content":{"class":"EmptyArray","parameters":{},"form_key":null},"size":0,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -79,11 +72,9 @@ def test_RegularArray_NumpyArray(): "size": 0, "content": { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -91,7 +82,7 @@ def test_RegularArray_NumpyArray(): def test_ListArray_NumpyArray(): v1 = json.loads( - '{"class":"ListArray64","starts":"i64","stops":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ListArray64","starts":"i64","stops":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -102,11 +93,9 @@ def test_ListArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -114,7 +103,7 @@ def test_ListArray_NumpyArray(): def test_ListOffsetArray_NumpyArray(): v1 = json.loads( - '{"class":"ListOffsetArray64","offsets":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ListOffsetArray64","offsets":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -124,11 +113,9 @@ def test_ListOffsetArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -136,7 +123,7 @@ def test_ListOffsetArray_NumpyArray(): def test_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","has_identities":false,"parameters":{},"form_key":null},"y":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RecordArray","contents":{"x":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","parameters":{},"form_key":null},"y":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -147,7 +134,6 @@ def test_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -155,18 +141,16 @@ def test_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"RecordArray","contents":[{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","has_identities":false,"parameters":{},"form_key":null},{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}],"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RecordArray","contents":[{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","parameters":{},"form_key":null},{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}],"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -177,7 +161,6 @@ def test_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -185,38 +168,34 @@ def test_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"RecordArray","contents":{},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RecordArray","contents":{},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { "class": "RecordArray", "fields": [], "contents": [], - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"RecordArray","contents":[],"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RecordArray","contents":[],"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { "class": "RecordArray", "fields": None, "contents": [], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -224,7 +203,7 @@ def test_RecordArray_NumpyArray(): def test_IndexedArray_NumpyArray(): v1 = json.loads( - '{"class":"IndexedArray64","index":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"IndexedArray64","index":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -234,11 +213,9 @@ def test_IndexedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -246,7 +223,7 @@ def test_IndexedArray_NumpyArray(): def test_IndexedOptionArray_NumpyArray(): v1 = json.loads( - '{"class":"IndexedOptionArray64","index":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"IndexedOptionArray64","index":"i64","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -256,11 +233,9 @@ def test_IndexedOptionArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -268,7 +243,7 @@ def test_IndexedOptionArray_NumpyArray(): def test_ByteMaskedArray_NumpyArray(): v1 = json.loads( - '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -279,17 +254,15 @@ def test_ByteMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -300,11 +273,9 @@ def test_ByteMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -312,7 +283,7 @@ def test_ByteMaskedArray_NumpyArray(): def test_BitMaskedArray_NumpyArray(): v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"lsb_order":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":true,"lsb_order":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -324,17 +295,15 @@ def test_BitMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"lsb_order":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":false,"lsb_order":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -346,17 +315,15 @@ def test_BitMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"lsb_order":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":true,"lsb_order":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -368,17 +335,15 @@ def test_BitMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"lsb_order":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"valid_when":false,"lsb_order":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -390,11 +355,9 @@ def test_BitMaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -402,7 +365,7 @@ def test_BitMaskedArray_NumpyArray(): def test_UnmaskedArray_NumpyArray(): v1 = json.loads( - '{"class":"UnmaskedArray","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"UnmaskedArray","content":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -411,11 +374,9 @@ def test_UnmaskedArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -423,7 +384,7 @@ def test_UnmaskedArray_NumpyArray(): def test_UnionArray_NumpyArray(): v1 = json.loads( - '{"class":"UnionArray8_64","tags":"i8","index":"i64","contents":[{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","has_identities":false,"parameters":{},"form_key":null},{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}],"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"UnionArray8_64","tags":"i8","index":"i64","contents":[{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","parameters":{},"form_key":null},{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}],"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -435,7 +396,6 @@ def test_UnionArray_NumpyArray(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -443,12 +403,10 @@ def test_UnionArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -456,7 +414,7 @@ def test_UnionArray_NumpyArray(): def test_RegularArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"RegularArray","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"size":3,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RegularArray","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"size":3,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -470,22 +428,19 @@ def test_RegularArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"RegularArray","content":{"class":"RecordArray","contents":{"nest":{"class":"EmptyArray","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"size":0,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"RegularArray","content":{"class":"RecordArray","contents":{"nest":{"class":"EmptyArray","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"size":0,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -497,16 +452,13 @@ def test_RegularArray_RecordArray_NumpyArray(): "contents": [ { "class": "EmptyArray", - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -514,7 +466,7 @@ def test_RegularArray_RecordArray_NumpyArray(): def test_ListArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"ListArray64","starts":"i64","stops":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ListArray64","starts":"i64","stops":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -529,16 +481,13 @@ def test_ListArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -546,7 +495,7 @@ def test_ListArray_RecordArray_NumpyArray(): def test_ListOffsetArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ListOffsetArray64","offsets":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -560,16 +509,13 @@ def test_ListOffsetArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -577,7 +523,7 @@ def test_ListOffsetArray_RecordArray_NumpyArray(): def test_IndexedArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"IndexedArray64","index":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"IndexedArray64","index":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -591,16 +537,13 @@ def test_IndexedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -608,7 +551,7 @@ def test_IndexedArray_RecordArray_NumpyArray(): def test_IndexedOptionArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"IndexedOptionArray64","index":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"IndexedOptionArray64","index":"i64","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -622,16 +565,13 @@ def test_IndexedOptionArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -639,7 +579,7 @@ def test_IndexedOptionArray_RecordArray_NumpyArray(): def test_ByteMaskedArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -654,22 +594,19 @@ def test_ByteMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"ByteMaskedArray","mask":"i8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -684,16 +621,13 @@ def test_ByteMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -701,7 +635,7 @@ def test_ByteMaskedArray_RecordArray_NumpyArray(): def test_BitMaskedArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"lsb_order":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":true,"lsb_order":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -717,22 +651,19 @@ def test_BitMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"lsb_order":false,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":false,"lsb_order":false,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -748,22 +679,19 @@ def test_BitMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":true,"lsb_order":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":true,"lsb_order":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -779,22 +707,19 @@ def test_BitMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } v1 = json.loads( - '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"valid_when":false,"lsb_order":true,"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"BitMaskedArray","mask":"u8","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"valid_when":false,"lsb_order":true,"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -810,16 +735,13 @@ def test_BitMaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -827,7 +749,7 @@ def test_BitMaskedArray_RecordArray_NumpyArray(): def test_UnmaskedArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"UnmaskedArray","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"UnmaskedArray","content":{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -840,16 +762,13 @@ def test_UnmaskedArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, - "has_identifier": False, "parameters": {}, "form_key": None, } @@ -857,7 +776,7 @@ def test_UnmaskedArray_RecordArray_NumpyArray(): def test_UnionArray_RecordArray_NumpyArray(): v1 = json.loads( - '{"class":"UnionArray8_64","tags":"i8","index":"i64","contents":[{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null},{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","has_identities":false,"parameters":{},"form_key":null}},"has_identities":false,"parameters":{},"form_key":null}],"has_identities":false,"parameters":{},"form_key":null}' + '{"class":"UnionArray8_64","tags":"i8","index":"i64","contents":[{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"l","primitive":"int64","parameters":{},"form_key":null}},"parameters":{},"form_key":null},{"class":"RecordArray","contents":{"nest":{"class":"NumpyArray","inner_shape":[],"itemsize":8,"format":"d","primitive":"float64","parameters":{},"form_key":null}},"parameters":{},"form_key":null}],"parameters":{},"form_key":null}' ) v2 = ak.forms.from_dict(v1).to_dict() assert v2 == { @@ -873,12 +792,10 @@ def test_UnionArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, @@ -890,17 +807,14 @@ def test_UnionArray_RecordArray_NumpyArray(): "class": "NumpyArray", "primitive": "float64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": None, } ], - "has_identifier": False, "parameters": {}, "form_key": None, }, ], - "has_identifier": False, "parameters": {}, "form_key": None, } diff --git a/tests/test_1613-generator-tolayout-records.py b/tests/test_1613-generator-tolayout-records.py index 6e368f2784..f4df5850ea 100644 --- a/tests/test_1613-generator-tolayout-records.py +++ b/tests/test_1613-generator-tolayout-records.py @@ -126,32 +126,6 @@ def test_RecordArray_NumpyArray(flatlist_as_rvec): assert array.to_list() == array_out.to_list() -@pytest.mark.skip( - reason="AttributeError: 'Record' object has no attribute 'form', 'Record' object has no attribute 'identifier'" -) -@pytest.mark.parametrize("flatlist_as_rvec", [False, True]) -def test_Record(flatlist_as_rvec): - array = ak.contents.RecordArray( - [ - ak.contents.NumpyArray(np.array([0, 1, 2, 3, 4], np.int64)), - ak.contents.NumpyArray(np.array([0.0, 1.1, 2.2, 3.3, 4.4, 5.5])), - ], - ["x", "y"], - parameters={"__record__": "Something"}, - ) - assert isinstance(array[2], ak.record.Record) - - layout = array[2] - generator = ak._connect.cling.togenerator( - array.form, flatlist_as_rvec=flatlist_as_rvec - ) - lookup = ak._lookup.Lookup(layout) - generator.generate(compiler) - - array_out = generator.tolayout(lookup, 0, ()) - assert layout.to_list() == array_out.to_list() - - @pytest.mark.parametrize("flatlist_as_rvec", [False, True]) def test_RecordArray_tuple(flatlist_as_rvec): array = ak.Array([(1, 2)]) diff --git a/tests/test_1766-record-form-fields.py b/tests/test_1766-record-form-fields.py index 8905bdaaf1..103a272ce5 100644 --- a/tests/test_1766-record-form-fields.py +++ b/tests/test_1766-record-form-fields.py @@ -15,7 +15,6 @@ def test_new_style_record(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node1", }, @@ -23,12 +22,10 @@ def test_new_style_record(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node2", }, ], - "has_identifier": False, "parameters": {}, "form_key": "node0", } @@ -55,7 +52,6 @@ def test_new_style_tuple(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node1", }, @@ -63,12 +59,10 @@ def test_new_style_tuple(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node2", }, ], - "has_identifier": False, "parameters": {}, "form_key": "node0", } @@ -94,7 +88,6 @@ def test_old_style_record(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node1", }, @@ -102,12 +95,10 @@ def test_old_style_record(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node2", }, }, - "has_identifier": False, "parameters": {}, "form_key": "node0", } @@ -133,7 +124,6 @@ def test_old_style_tuple(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node1", }, @@ -141,12 +131,10 @@ def test_old_style_tuple(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node2", }, ], - "has_identifier": False, "parameters": {}, "form_key": "node0", } @@ -173,7 +161,6 @@ def test_old_style_contents_new_style_list(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node1", }, @@ -181,12 +168,10 @@ def test_old_style_contents_new_style_list(): "class": "NumpyArray", "primitive": "int64", "inner_shape": [], - "has_identifier": False, "parameters": {}, "form_key": "node2", }, }, - "has_identifier": False, "parameters": {}, "form_key": "node0", } From 9e9907e501c2b5347742ee6c97d2fcba77a0130d Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Fri, 28 Oct 2022 22:28:52 +0100 Subject: [PATCH 2/3] docs: remove old v1 C++ references in Doxygen --- docs-doxygen/index.md | 139 ++++++------------------------------------ 1 file changed, 18 insertions(+), 121 deletions(-) diff --git a/docs-doxygen/index.md b/docs-doxygen/index.md index c6f9799d3f..6267cf013a 100644 --- a/docs-doxygen/index.md +++ b/docs-doxygen/index.md @@ -6,9 +6,8 @@ Arrays are **dynamically typed**, but operations on them are **compiled and fast ## Documentation - * [Main page (quickstart)](https://awkward-array.readthedocs.io/>) * C++ API reference: **this site** - * [Python API reference](../../index.html) + * [Main reference](../../index.html) * [GitHub repository](https://github.com/scikit-hep/awkward-1.0) ## Navigation @@ -26,76 +25,9 @@ This reference describes the * **CPU kernels:** no namespace, but contained entirely within the [kernels directory](dir_6225843069e7cc68401bbec110a1667f.html), which are compiled into **libawkward-cpu-kernels.so** (or dylib or lib). This library is fully usable from any language that can call functions through [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface). * **GPU kernels:** FIXME! (not implemented yet) -### Array layout nodes - -Awkward Arrays are a tree of layout nodes nested within each other, some of which carry one-dimensional arrays that get reinterpreted as part of the structure. These descend from the abstract base class [ak::Content](classawkward_1_1Content.html) and are reflected through pybind11 as [ak.layout.Content](../ak.layout.Content.html) and subclasses in Python. - - * [ak::Content](classawkward_1_1Content.html): the abstract base class. - * [ak::EmptyArray](classawkward_1_1EmptyArray.html): an array of unknown type with no elements (usually produced by [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html), which can't determine type at a given level without samples). - * [ak::RawArrayOf](classawkward_1_1RawArrayOf.html): a one-dimensional array of any fixed-bytesize C++ type `T`. [RawArray.h](RawArray_8h.html) is a header-only implementation and [ak::RawArrayOf](classawkward_1_1RawArrayOf.html) are not used anywhere else in the Awkward Array project, Python in particular. This node type only exists for pure C++ dependent projects. - * [ak::NumpyArray](classawkward_1_1NumpyArray.html): any NumPy array (e.g. multidimensional shape, arbitrary dtype), though usually only one-dimensional arrays of numbers. Contrary to its name, [ak::NumpyArray](classawkward_1_1NumpyArray.html) can be used in pure C++, without dependence on pybind11 or Python. The NumPy array is described in terms of `std::vectors` and a `std::string`. - * [ak::RegularArray](classawkward_1_1RegularArray.html): splits its nested content into equal-length lists. - * [ak::ListArrayOf](classawkward_1_1ListArrayOf.html): splits its nested content into variable-length lists with full generality (may use its content non-contiguously, overlapping, or out-of-order). - * [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html): splits its nested content into variable-length lists, assuming contiguous, non-overlapping, in-order content. - * [ak::RecordArray](classawkward_1_1RecordArray.html): represents a logical array of records with a "struct of arrays" layout in memory. - * [ak::Record](classawkward_1_1Record.html): represents a single record (a subclass of [ak::Content](classawkward_1_1Content.html) in C++, but not Python). - * [ak::IndexedArrayOf](classawkward_1_1IndexedArrayOf.html): rearranges and/or duplicates its content by lazily applying an integer index. - * [ak::ByteMaskedArray](classawkward_1_1ByteMaskedArray.html): represents its content with missing values with an 8-bit boolean mask. - * [ak::BitMaskedArray](classawkward_1_1BitMaskedArray.html): represents its content with missing values with a 1-bit boolean mask. - * [ak::UnmaskedArray](classawkward_1_1UnmaskedArray.html): specifies that its content can contain missing values in principle, but no mask is supplied because all elements are non-missing. - * [ak::UnionArrayOf](classawkward_1_1UnionArrayOf.html): interleaves a set of arrays as a tagged union, can represent heterogeneous data. - * [ak::VirtualArray](classawkward_1_1VirtualArray.html): generates an array on demand from an [ak::ArrayGenerator](classawkward_1_1ArrayGenerator.html) or a [ak::SliceGenerator](classawkward_1_1SliceGenerator.html) and optionally caches the generated array in an [ak::ArrayCache](classawkward_1_1ArrayCache.html). - * [ak::None](classawkward_1_1None.html): represents a missing value that will be converted to `None` in Python (a subclass of [ak::Content](classawkward_1_1Content.html) in C++). - -The [ak::Record](classawkward_1_1Record.html), [ak::None](classawkward_1_1None.html), and [ak::NumpyArray](classawkward_1_1NumpyArray.html) with empty [shape](classawkward_1_1NumpyArray.html#ab4eec3bfd0e50bc035c26e62974d209d) are technically [ak::Content](classawkward_1_1Content.html) in C++ even though they represent scalar data, rather than arrays. (This can be checked with the [isscalar](classawkward_1_1Content.html#a878ae38b66c14067b231469863d6d1a1) method.) This is because they are possible return values of methods that would ordinarily return [ak::Contents](classawkward_1_1Content.html), so they are subclasses to simplify the type hierarchy. However, in the [Python layer](dir_91f33a3f1dd6262845ebd1570075970c.html), they are converted directly into Python scalars, such as [ak.layout.Record](../ak.layout.Record.html) (which isn't an [ak.layout.Content](../ak.layout.Content.html) subclass), Python's `None`, or a Python number/bool. - -Most layout nodes contain another content node ([ak::RecordArray](classawkward_1_1RecordArray.html) and [ak::UnionArrayOf](classawkward_1_1UnionArrayOf.html) can contain more than one), thus forming a tree. Only [ak::EmptyArray](classawkward_1_1EmptyArray.html), [ak::RawArrayOf](classawkward_1_1RawArrayOf.html), and [ak::NumpyArray](classawkward_1_1NumpyArray.html) cannot contain a content, and hence these are leaves of the tree. - -Note that [ak::PartitionedArray](classawkward_1_1PartitionedArray.html) and its concrete class, [ak::IrregularlyPartitionedArray](classawkward_1_1IrregularlyPartitionedArray.html), are not [ak::Content](classawkward_1_1Content.html) because they cannot be nested within a tree. Partitioning is only allowed at the root of the tree. - -**Iterator for layout nodes:** [ak::Iterator](classawkward_1_1Iterator.html). - -**Index for layout nodes:** integer and boolean arrays that define the shape of the data structure, such as boolean masks in [ak::ByteMaskedArray](classawkward_1_1ByteMaskedArray.html), are not [ak::NumpyArray](classawkward_1_1NumpyArray.html) but a more constrained type called [ak::IndexOf](classawkward_1_1IndexOf.html). - -### High-level data types - -This is the type of data in a high-level [ak.Array](../_auto/ak.Array.html) or [ak.Record](../_auto/ak.Record.html) as reported by [ak.type](../_auto/ak.type.html). It represents as much information as a data analyst needs to know (e.g. the distinction between variable and fixed-length lists, but not the distinction between [ak::ListArrayOf](classawkward_1_1ListArrayOf.html) and [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html)). - - * [ak::Type](classawkward_1_1Type.html): the abstract base class. - * [ak::ArrayType](classawkward_1_1ArrayType.html): type of a non-composable, high-level [ak.Array](../_auto/ak.Array.html), which includes the length of the array. - * [ak::UnknownType](classawkward_1_1UnknownType.html): a type that is not known because it is represented by an [ak::EmptyArray](classawkward_1_1EmptyArray.html). - * [ak::PrimitiveType](classawkward_1_1PrimitiveType.html): a numeric or boolean type. - * [ak::RegularType](classawkward_1_1RegularType.html): lists of a fixed length; this ``size`` is part of the type description. - * [ak::ListType](classawkward_1_1ListType.html): lists of unspecified or variable length. - * [ak::RecordType](classawkward_1_1RecordType.html): records with named fields or tuples with a fixed number of unnamed slots. The fields/slots and their types are part of the type description. - * [ak::OptionType](classawkward_1_1OptionType.html): data that may be missing. - * [ak::UnionType](classawkward_1_1UnionType.html): heterogeneous data selected from a short list of possibilities. - -All concrete [ak::Type](classawkward_1_1Type.html) subclasses are composable except [ak::ArrayType](classawkward_1_1ArrayType.html). - -### Low-level array forms - -This is the type of a [ak::Content](classawkward_1_1Content.html) array expressed with low-level granularity (e.g. including the distinction between [ak::ListArrayOf](classawkward_1_1ListArrayOf.html) and [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html)). There is a one-to-one relationship between [ak::Content](classawkward_1_1Content.html) subclasses and [ak::Form](classawkward_1_1Form.html) subclasses, and each [ak::Form](classawkward_1_1Form.html) maps to only one [ak::Type](classawkward_1_1Type.html). - - * [ak::Form](classawkward_1_1Form.html): the abstract base class. - * [ak::EmptyForm](classawkward_1_1EmptyForm.html) for [ak::EmptyArray](classawkward_1_1EmptyArray.html). - * [ak::RawForm](classawkward_1_1RawForm.html) for [ak::RawArrayOf](classawkward_1_1RawArrayOf.html). - * [ak::NumpyForm](classawkward_1_1NumpyForm.html) for [ak::NumpyArray](classawkward_1_1NumpyArray.html). - * [ak::RegularForm](classawkward_1_1RegularForm.html) for [ak::RegularArray](classawkward_1_1RegularArray.html). - * [ak::ListForm](classawkward_1_1ListForm.html) for [ak::ListArrayOf](classawkward_1_1ListArrayOf.html). - * [ak::ListOffsetForm](classawkward_1_1ListOffsetForm.html) for [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html). - * [ak::RecordForm](classawkward_1_1RecordForm.html) for [ak::RecordArray](classawkward_1_1RecordArray.html). - * [ak::IndexedForm](classawkward_1_1IndexedForm.html) for [ak::IndexedArrayOf](classawkward_1_1IndexedArrayOf.html) with `ISOPTION = false`. - * [ak::IndexedOptionForm](classawkward_1_1IndexedOptionForm.html) for [ak::IndexedArrayOf](classawkward_1_1IndexedArrayOf.html) with `ISOPTION = true`. - * [ak::ByteMaskedForm](classawkward_1_1ByteMaskedForm.html) for [ak::ByteMaskedArray](classawkward_1_1ByteMaskedArray.html). - * [ak::BitMaskedForm](classawkward_1_1BitMaskedForm.html) for [ak::BitMaskedArray](classawkward_1_1BitMaskedArray.html). - * [ak::UnmaskedForm](classawkward_1_1UnmaskedForm.html) for [ak::UnmaskedArray](classawkward_1_1UnmaskedArray.html). - * [ak::UnionForm](classawkward_1_1UnionForm.html) for [ak::UnionArrayOf](classawkward_1_1UnionArrayOf.html). - * [ak::VirtualForm](classawkward_1_1VirtualForm.html) for [ak::VirtualArray](classawkward_1_1VirtualArray.html). - ### ArrayBuilder structure -The [ak.ArrayBuilder](../_auto/ak.ArrayBuilder.html) is an append-only array for generating data backed by `ak._ext.ArrayBuilder` (layout-level ArrayBuilder) and [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) (C++ implementation). +The [ak.ArrayBuilder](../../reference/generated/ak.ArrayBuilder.html) is an append-only array for generating data backed by `ak._ext.ArrayBuilder` (layout-level ArrayBuilder) and [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) (C++ implementation). [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) is the front-end for a tree of [ak::Builder](classawkward_1_1Builder.html) instances. The structure of this tree indicates the current state of knowledge about the type of the data it's being filled with, and this tree can grow from any node. Types always grow in the direction of more generality, so the tree only gets bigger. @@ -134,68 +66,33 @@ ak.to_list(b.snapshot()) # [[1.0, 2.0, 3.0], [], [4.0, None, 5.0], [{'x': 1, 'y': [2, 3]}]] ``` -The [ak::Builder](classawkward_1_1Builder.html) instances contain arrays of accumulated data, and thus store both data (in these arrays) and type (in their tree structure). The hierarchy is not exactly the same as [ak::Content](classawkward_1_1Content.html)/[ak::Form](classawkward_1_1Form.html) (which are identical to each other) or [ak::Type](classawkward_1_1Type.html), since it reflects the kinds of data to be encountered in the input data: mostly JSON-like, but with a distinction between records with named fields and tuples with unnamed slots. +The [ak::Builder](classawkward_1_1Builder.html) instances contain arrays of accumulated data, and thus store both data (in these arrays) and type (in their tree structure). The hierarchy is not exactly the same as [`ak.Content`](../../reference/generated/ak.contents.Content.html)/[`ak.Form`](../../reference/generated/ak.forms.Form.html) (which are identical to each other) or [`ak.Type`](../../reference/generated/ak.types.Type.html), since it reflects the kinds of data to be encountered in the input data: mostly JSON-like, but with a distinction between records with named fields and tuples with unnamed slots. * [ak::Builder](classawkward_1_1Builder.html): the abstract base class. - * [ak::UnknownBuilder](classawkward_1_1UnknownBuilder.html): the initial builder; a builder for unknown type; generates an [ak::EmptyArray](classawkward_1_1EmptyArray.html) (which is why we have that class). - * [ak::BoolBuilder](classawkward_1_1BoolBuilder.html): boolean type; generates a [ak::NumpyArray](classawkward_1_1NumpyArray.html). - * [ak::Int64Builder](classawkward_1_1Int64Builder.html): 64-bit integer type; generates a [ak::NumpyArray](classawkward_1_1NumpyArray.html). Appending integer data to boolean data generates a union; it does not promote the booleans to integers. - * [ak::Float64Builder](classawkward_1_1Float64Builder.html): 64-bit floating point type; generates a [ak::NumpyArray](classawkward_1_1NumpyArray.html). Appending floating-point data to integer data does not generate a union; it promotes integers to floating-point. - * [ak::StringBuilder](classawkward_1_1StringBuilder.html): UTF-8 encoded string or raw bytestring type; generates a [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html) with parameter `"__array__"` equal to `"string"` or `"bytestring"`. - * [ak::ListBuilder](classawkward_1_1ListBuilder.html): list type; generates a [ak::ListOffsetArrayOf](classawkward_1_1ListOffsetArrayOf.html). - * [ak::OptionBuilder](classawkward_1_1OptionBuilder.html): option type; generats an [ak::IndexedArrayOf](classawkward_1_1IndexedArrayOf.html) with `ISOPTION = true`. - * [ak::RecordBuilder](classawkward_1_1RecordBuilder.html): record type with field names; generates a [ak::RecordArray](classawkward_1_1RecordArray.html) with a non-null [ak::util::RecordLookup](namespaceawkward_1_1util.html#a86f80ddab98f968a2845db832f0c8210). - * [ak::TupleBuilder](classawkward_1_1TupleBuilder.html): tuple type without field names; generates a [ak::RecordArray](classawkward_1_1RecordArray.html) with a null [ak::util::RecordLookup](namespaceawkward_1_1util.html#a86f80ddab98f968a2845db832f0c8210). - * [ak::UnionBuilder](classawkward_1_1UnionBuilder.html): union type; generates a [ak::UnionArrayOf](classawkward_1_1UnionArrayOf.html). - * [ak::IndexedBuilder](classawkward_1_1IndexedBuilder.html): indexed [ak::Content](classawkward_1_1Content.html); inserts an existing array node into the new array under construction, referencing its elements with an [ak::IndexedArrayOf](classawkward_1_1IndexedArrayOf.html). This way, complex structures can be included by reference, rather than by copying. + * [ak::UnknownBuilder](classawkward_1_1UnknownBuilder.html): the initial builder; a builder for unknown type; generates an [`ak.forms.EmptyForm`](../../reference/generated/ak.forms.EmptyForm.html) (which is why we have that class). + * [ak::BoolBuilder](classawkward_1_1BoolBuilder.html): boolean type; generates a [`ak.forms.NumpyForm`](../../reference/generated/ak.forms.NumpyForm.html) and associated data buffers. + * [ak::Int64Builder](classawkward_1_1Int64Builder.html): 64-bit integer type; generates a [`ak.forms.NumpyForm`](../../reference/generated/ak.forms.NumpyForm.html) and associated data buffers. Appending integer data to boolean data generates a union; it does not promote the booleans to integers. + * [ak::Float64Builder](classawkward_1_1Float64Builder.html): 64-bit floating point type; generates a [`ak.forms.NumpyForm`](../../reference/generated/ak.forms.NumpyForm.html) and associated data buffers. Appending floating-point data to integer data does not generate a union; it promotes integers to floating-point. + * [ak::StringBuilder](classawkward_1_1StringBuilder.html): UTF-8 encoded string or raw bytestring type; generates a [`ak.forms.ListOfsetForm`](../../reference/generated/ak.forms.ListOfsetForm.html) and associated data buffers, with parameter `"__array__"` equal to `"string"` or `"bytestring"`. + * [ak::ListBuilder](classawkward_1_1ListBuilder.html): list type; generates a [`ak.forms.ListOffsetForm`](../../reference/generated/ak.forms.ListOffsetForm.html) and associated data buffers. + * [ak::OptionBuilder](classawkward_1_1OptionBuilder.html): option type; generates an [`ak.forms.IndexedOptionForm`](../../reference/generated/ak.forms.IndexedOptionForm.html) and associated data buffers. + * [ak::RecordBuilder](classawkward_1_1RecordBuilder.html): record type with field names; generates a [`ak.forms.RecordForm`](../../reference/generated/ak.forms.RecordForm.html) and associated data buffers with a non-null `fields`. + * [ak::TupleBuilder](classawkward_1_1TupleBuilder.html): tuple type without field names; generates a [`ak.forms.RecordForm`](../../reference/generated/ak.forms.RecordForm.html) and associated data buffers with null `fields`. + * [ak::UnionBuilder](classawkward_1_1UnionBuilder.html): union type; generates a [`ak.forms.UnionForm`](../../reference/generated/ak.forms.UnionForm.html) and associated data buffers. + * [ak::IndexedBuilder](classawkward_1_1IndexedBuilder.html): indexed [`ak.forms.CoForm`](../../reference/generated/ak.forms.CoForm.html) and associated data buffers; inserts an existing array node into the new array under construction, referencing its elements with an [`ak.forms.IndexedForm`](../../reference/generated/ak.forms.IndexedForm.html). This way, complex structures can be included by reference, rather than by copying. **Options for building an array:** [ak::ArrayBuilderOptions](classawkward_1_1ArrayBuilderOptions.html) are passed to every [ak::Builder](classawkward_1_1Builder.html) in the tree. **Buffers for building an array:** [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html) is a one-dimensional array with append-only semantics, used both for buffers that will become [ak::IndexOf](classawkward_1_1IndexOf.html) and buffers that will become [ak::NumpyArray](classawkward_1_1NumpyArray.html). It works like `std::vector` in that it replaces its underlying storage at logarithmically frequent intervals, but unlike a `std::vector` in that the underlying storage is a `std::shared_ptr`. -After an [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) is turned into a [ak::Content](classawkward_1_1Content.html) with [snapshot](classawkward_1_1ArrayBuilder.html#ac064fd827abb99f81772e59706f1a6a8), the read-only data and its append-only source share buffers (with `std::shared_ptr`). This makes the [snapshot](classawkward_1_1ArrayBuilder.html#ac064fd827abb99f81772e59706f1a6a8) operation fast and capable of being called frequently, and the `std::shared_ptr` manages the lifetime of buffers that stay in scope because a [ak::Content](classawkward_1_1Content.html) is using it, even if a [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html) is not (because it reallocated its internal buffer). - -Array building is not as efficient as computing with pre-built arrays because the type-discovery makes each access a tree-descent. Array building is also an exception to the rule that C++ implementations do not touch array data (do not dereference pointers in [ak::RawArrayOf](classawkward_1_1RawArrayOf.html), [ak::NumpyArray](classawkward_1_1NumpyArray.html), and [ak::IndexOf](classawkward_1_1IndexOf.html). The [ak::Builder](classawkward_1_1Builder.html) instances append to their [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html), which are assumed to exist in main memory, not a GPU. - -### Reducers - -Reducer operations like [ak.sum](../_auto/ak.sum.html) and [ak.max](../_auto/ak.max.html) are implemented as a group for code reuse. The most complex part is how elements from variable-length lists are grouped when `axis != -1` (see [ak::Content::reduce_next](classawkward_1_1Content.html#a4f4a15fd7609dbbc75a44e47291c186d)). The problem of actually computing sums and maxima is comparatively simple. - -Each reducer has a class that implements the sum, max, etc. - - * [ak::Reducer](classawkward_1_1Reducer.html): the abstract base class. - * [ak::ReducerCount](classawkward_1_1ReducerCount.html): for [ak.count](../_auto/ak.count.html). - * [ak::ReducerCountNonzero](classawkward_1_1ReducerCountNonzero.html): for [ak.count_nonzero](../_auto/ak.count_nonzero.html). - * [ak::ReducerSum](classawkward_1_1ReducerSum.html): for [ak.sum](../_auto/ak.sum.html). - * [ak::ReducerProd](classawkward_1_1ReducerProd.html): for [ak.prod](../_auto/ak.prod.html). - * [ak::ReducerAny](classawkward_1_1ReducerAny.html): for [ak.any](../_auto/ak.any.html). - * [ak::ReducerAll](classawkward_1_1ReducerAll.html): for [ak.all](../_auto/ak.all.html). - * [ak::ReducerMin](classawkward_1_1ReducerMin.html): for [ak.min](../_auto/ak.min.html). - * [ak::ReducerMax](classawkward_1_1ReducerMax.html): for [ak.max](../_auto/ak.max.html). - * [ak::ReducerArgmin](classawkward_1_1ReducerArgmin.html): for [ak.argmin](../_auto/ak.argmin.html). - * [ak::ReducerArgmax](classawkward_1_1ReducerArgmax.html): for [ak.argmax](../_auto/ak.argmax.html). - -### Slices - -Many Python objects can be used as slices; they are each converted into a specialized C++ type before being passed to [ak::Content::getitem](classawkward_1_1Content.html#afe0d7eaa5d9d72290e3211efa4003678). +Upon calling the [to_buffers](classawkward_1_1Builder.html#a24ef6967f0648462def1c03e00e8a610) method of [`ak::Builder`](classawkward_1_1Builder.html), the potentially non-contiguous data are copied into the given [`ak::BuffersContainer`](classawkward_1_1BuffersContainer.html). This ensures that the Python runtime manages the memory associated with the builder. - * [ak::Slice](classawkward_1_1Slice.html): represents a Python tuple of slice items, which selects multiple dimensions at once. A non-tuple slice in Python is wrapped as a single-item [ak::Slice](classawkward_1_1Slice.html) in C++. - * [ak::SliceItem](classawkward_1_1SliceItem.html): abstract base class for non-tuple slice items. - * [ak::SliceAt](classawkward_1_1SliceAt.html): represents a single integer as a slice item, which selects an element. - * [ak::SliceRange](classawkward_1_1SliceRange.html): represents a Python `slice` object with `start`, `stop`, and `step`, which selects a range of elements. - * [ak::SliceField](classawkward_1_1SliceField.html): represents a single string as a slice item, which selects a record field or projects across all record fields in an array. - * [ak::SliceFields](classawkward_1_1SliceFields.html): represents an iterable of strings as a slice item, which selects a set of record fields or projects across a set of all record fields in an array. - * [ak::SliceNewAxis](classawkward_1_1SliceNewAxis.html): represents `np.newaxis` (a.k.a. `None`), which inserts a new regular dimension of length 1 in the sliced output. - * [ak::SliceEllipsis](classawkward_1_1SliceEllipsis.html): represents `Elipsis` (a.k.a. `...`), which skips enough dimensions to put the rest of the slice items at the deepest possible level. - * [ak::SliceArrayOf](classawkward_1_1SliceArrayOf.html): represents an integer or boolean array (boolean arrays are converted into integers early), which do general element-selection (rearrangement, filtering, and duplication). - * [ak::SliceJaggedOf](classawkward_1_1SliceJaggedOf.html): represents a one level of jaggedness in an array as a slice item. - * [ak::SliceMissingOf](classawkward_1_1SliceMissingOf.html): represents an array with missing values as a slice item. +Array building is not as efficient as computing with pre-built arrays because the type-discovery makes each access a tree-descent. Additionally, the [ak::Builder](classawkward_1_1Builder.html) instances append to their [ak::GrowableBuffer](classawkward_1_1GrowableBuffer.html), which are assumed to exist in main memory, not a GPU. -Note: [ak::SliceGenerator](classawkward_1_1SliceGenerator.html) is not a [ak::SliceItem](classawkward_1_1SliceItem.html); it's an [ak::ArrayGenerator](classawkward_1_1ArrayGenerator.html). (A case of clashing naming conventions.) -### Conversion to JSON +### Conversion from JSON -The following classes hide Awkward Array's dependence on RapidJSON, so that it's a swappable component. Header files do not reference RapidJSON, but the implementation of these classes do: [ak::ToJson](classawkward_1_1ToJson.html), [ak::ToJsonString](classawkward_1_1ToJsonString.html), [ak::ToJsonPrettyString](classawkward_1_1ToJsonPrettyString.html), [ak::ToJsonFile](classawkward_1_1ToJsonFile.html), [ak::ToJsonPrettyFile](classawkward_1_1ToJsonPrettyFile.html). +The [`ak::fromjsonobject`](namespaceawkward.html#a8f042641c01a0ec3206b2f169d3a396b) and [`ak::FromJsonObjectSchema`](classawkward_1_1FromJsonObjectSchema.html) symbols are used to facilitate fast construction of Awkward Arrays from JSON data using [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html). ### CPU kernels and GPU kernels From 90fac5625ee27a8e7c0cb7ef3b09629d1893cdb8 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Fri, 28 Oct 2022 17:30:25 -0500 Subject: [PATCH 3/3] Simplify the f-strings in RecordArrayType and UnionArrayType. --- src/awkward/_connect/numba/layout.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/awkward/_connect/numba/layout.py b/src/awkward/_connect/numba/layout.py index bd563ce2d4..a6a1ced29b 100644 --- a/src/awkward/_connect/numba/layout.py +++ b/src/awkward/_connect/numba/layout.py @@ -1033,8 +1033,11 @@ def from_form(cls, form): ) def __init__(self, contenttypes, fields, parameters): + tmp1 = ", ".join(x.name for x in contenttypes) + tmp2 = "," if len(contenttypes) == 1 else "" + tmp3 = "None" if fields is None else repr(tuple(fields)) super().__init__( - name=f"ak.RecordArrayType(({', '.join(x.name for x in contenttypes)}{',' if len(contenttypes) == 1 else ''}), {'None' if fields is None else repr(tuple(fields))}, {json.dumps(parameters)})" + name=f"ak.RecordArrayType(({tmp1}{tmp2}), {tmp3}, {json.dumps(parameters)})" ) self.contenttypes = contenttypes self.fields = fields @@ -1320,8 +1323,10 @@ def from_form(cls, form): ) def __init__(self, tagstype, indextype, contenttypes, parameters): + tmp1 = ", ".join(x.name for x in contenttypes) + tmp2 = "," if len(contenttypes) == 1 else "" super().__init__( - name=f"ak.UnionArrayType({tagstype.name}, {indextype.name}, ({', '.join(x.name for x in contenttypes)}{',' if len(contenttypes) == 1 else ''}), {json.dumps(parameters)})" + name=f"ak.UnionArrayType({tagstype.name}, {indextype.name}, ({tmp1}{tmp2}), {json.dumps(parameters)})" ) self.tagstype = tagstype self.indextype = indextype