How to use the awkward1._util.wrap 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 / methods / util.py View on Github external
def apply_global_index(index, target):
    def flat_take(layout):
        idx = awkward1.Array(layout)
        return target._content()[idx.mask[idx >= 0]]

    def descend(layout, depth):
        if layout.purelist_depth == 1:
            return lambda: flat_take(layout)

    (index,) = awkward1.broadcast_arrays(index)
    out = awkward1._util.recursively_apply(index.layout, descend)
    return awkward1._util.wrap(out, target.behavior)