Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generator,
self._cache,
cache_key="/".join([self._keyprefix, source, name]),
parameters=params,
)
elif name in arrays:
# singleton
return arrays[name]
else:
# simple collection
content = {
k[len(name) + 1 :]: arrays[k]
for k in arrays
if k.startswith(name + "_")
}
return awkward1.layout.RecordArray(
content,
parameters={
"__record__": mixin,
"events_key": self._keyprefix,
"collection_name": name,
},
{},
form=form,
length=len(self),
)
return awkward1.layout.VirtualArray(
generator,
self._cache,
cache_key="/".join([self._keyprefix, "file", name]),
parameters=recordparams,
)
elif name in arrays:
# singleton
return arrays[name]
else:
# simple collection
return awkward1.layout.RecordArray(
{
k[len(name) + 1 :]: arrays[k]
for k in arrays
if k.startswith(name + "_")
},
parameters={
"__record__": mixin,
"events_key": self._keyprefix,
},
return arrays[name]
else:
# simple collection
return awkward1.layout.RecordArray(
{
k[len(name) + 1 :]: arrays[k]
for k in arrays
if k.startswith(name + "_")
},
parameters={
"__record__": mixin,
"events_key": self._keyprefix,
},
)
events = awkward1.layout.RecordArray(
{name: collectionfactory(name) for name in collections},
parameters={"metadata": self._metadata},
)
self._events = awkward1.Array(events)
return self._events
def _listarray(self, counts, content, recordparams):
offsets = awkward1.layout.Index32(
numpy.concatenate([[0], numpy.cumsum(counts)])
)
length = offsets[-1]
return awkward1.layout.ListOffsetArray32(
offsets,
awkward1.layout.RecordArray(
{k: _with_length(v, length) for k, v in content.items()},
parameters=recordparams,
),
def _listarray(self, offsets, content, params):
offsets = awkward1.layout.Index32(offsets)
length = offsets[-1]
if isinstance(content, dict):
content = awkward1.layout.RecordArray(
{k: _with_length(v, length) for k, v in content.items()},
parameters=params,
)
return awkward1.layout.ListOffsetArray32(offsets, content)
return awkward1.layout.ListOffsetArray32(offsets, content, parameters=params)