How to use the awkward1.forms.ListOffsetForm function in awkward1

To help you get started, we’ve selected a few awkward1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
mixin = self._mixin_map.get(name, "NanoCollection")
            if "o" + name in arrays and name not in arrays:
                # 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,