How to use the larray.util.misc._isnoneslice function in larray

To help you get started, we’ve selected a few larray 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 liam2 / liam2 / liam2 / larray_monkey.py View on Github external
extra_key_axes = axis_key.axes - self
                if extra_key_axes:
                    raise ValueError("boolean subset key contains more axes ({}) than array ({})"
                                     .format(axis_key.axes, self))

                # nonzero (currently) returns a tuple of IGroups containing 1D Arrays (one IGroup per axis)
                nonboolkey.extend(axis_key.nonzero())
        else:
            nonboolkey.append(axis_key)
    key = tuple(nonboolkey)

    # drop slice(None) and Ellipsis since they are meaningless because of guess_axis.
    # XXX: we might want to raise an exception when we find Ellipses or (most) slice(None) because except for
    #      a single slice(None) a[:], I don't think there is any point.
    key = [axis_key for axis_key in key
           if not _isnoneslice(axis_key) and axis_key is not Ellipsis]

    # translate all keys to IGroup
    return tuple(self._translate_axis_key(axis_key) for axis_key in key)