Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# list collection
cname = "n" + name
counts = arrays[cname]
content = {
k[len(cname) :]: arrays[k]
for k in arrays
if k.startswith(name + "_")
}
recordparams = {
"__doc__": counts.parameters["__doc__"],
"__record__": mixin,
"events_key": self._keyprefix,
}
form = awkward1.forms.ListOffsetForm(
"i32",
awkward1.forms.RecordForm(
{k: v.form for k, v in content.items()}, parameters=recordparams
),
)
generator = awkward1.layout.ArrayGenerator(
self._listarray,
(counts, content, recordparams),
{},
form=form,
length=len(self),
)
return awkward1.layout.VirtualArray(
generator,
self._cache,
cache_key="/".join([self._keyprefix, "file", name]),
parameters=recordparams,
)
# list collection
offsets = arrays["o" + name]
content = {
k[len(name) + 1 :]: arrays[k]
for k in arrays
if k.startswith(name + "_")
}
recordparams = {
"__doc__": offsets.parameters["__doc__"],
"__record__": mixin,
"events_key": self._keyprefix,
"collection_name": name,
}
form = awkward1.forms.ListOffsetForm(
"i32",
awkward1.forms.RecordForm(
{k: v.form for k, v in content.items()}, parameters=recordparams
),
)
generator = awkward1.layout.ArrayGenerator(
self._listarray,
(offsets, content, recordparams),
{},
form=form,
length=len(self),
)
source = "runtime"
return awkward1.layout.VirtualArray(
generator,
self._cache,
cache_key="/".join([self._keyprefix, source, name]),
parameters=recordparams,