Return a slice object to slice a list/bytearray by.

        Positional arguments:
        index -- index of self.SIGNATURE to target self.bytearray by.

        Returns:
        slice() object. E.g. `x = _get_slicers(0); ba_instance[x]`
556458
def _get_slicers(self, index):
        
        if not index:  # first item.
            return slice(0, self.SIGNATURE[0])
        if index >= len(self.SIGNATURE):
            raise IndexError('index out of self.SIGNATURE range')
        pad_start = sum(self.SIGNATURE[:index])
        pad_stop = pad_start + self.SIGNATURE[index]
        return slice(pad_start, pad_stop)
1219085
def get_children_from_slice(self, s):
        
        if isinstance(s.start, str):
            s = slice(
                self.get_index_from_name(s.start), s.stop, s.step)
        if isinstance(s.stop, str):
            s = slice(
                s.start, self.get_index_from_name(s.stop), s.step)
        return WellSeries(self.get_children_list()[s])
219316
def iterator_from_slice(s):
    
    import numpy as np
    start = s.start if s.start is not None else 0
    step = s.step if s.step is not None else 1

    if s.stop is None:
        # Infinite iterator.
        return itertools.count(start=start, step=step)
    else:
        # xrange-like iterator that supports float.
        return iter(np.arange(start, s.stop, step))
1095162
def get_parameter(self, index):
        
        result = []
        for target in self.targets:
            if target is not None:
                result.append(target.get_parameter(index))

        return result
1365692
def getitem(source, index):
    
    if isinstance(index, builtins.slice):
        return slice.raw(source, index.start, index.stop, index.step)
    if isinstance(index, int):
        return item.raw(source, index)
    raise TypeError("Not a valid index (int or slice)")
39130
def get_int(bytearray_, byte_index):
    
    data = bytearray_[byte_index:byte_index + 2]
    data[1] = data[1] & 0xff
    data[0] = data[0] & 0xff
    packed = struct.pack('2B', *data)
    value = struct.unpack('>h', packed)[0]
    return value
790343
def index(self, weighted=True, prune=False):
        
        warnings.warn(
            "CrunchCube.index() is deprecated. Use CubeSlice.index_table().",
            DeprecationWarning,
        )
        return Index.data(self, weighted, prune)
926207
def _slice(self, view):
        
        if self._data is not None:
            return self._data[view]
        return self._proxy.get_view(self.id, view)
201616
def out_of_bounds(self, index):
        
        if type(index) is int:
            return self.int_out_of_bounds(index)

        elif type(index) is slice:
            return self.slice_out_of_bounds(index)

        elif type(index) is tuple:

            local_index = []

            for k, item in enumerate(index):

                if type(item) is slice:
                    temp_index = self.slice_out_of_bounds(item, k)

                elif type(item) is int:
                    temp_index = self.int_out_of_bounds(item, k)
                # FIXME: will fail if item is no int or slice!
                if temp_index is None:
                    return temp_index

                local_index.append(temp_index)

            return tuple(local_index)
1353288
def get_index(self, key: Hashable) -> pd.Index:
        
        if key not in self.dims:
            raise KeyError(key)

        try:
            return self.indexes[key]
        except KeyError:
            # need to ensure dtype=int64 in case range is empty on Python 2
            return pd.Index(range(self.sizes[key]), name=key, dtype=np.int64)
624920
def cut(list_, index=0):
    """"""
    if isinstance(index, int):
        cut_ = lambda x: x[index]
    else:
        cut_ = lambda x: getattr(x, index)
    return list(map(cut_, list_))
326791
def convert_to_index_sliceable(obj, key):
    
    idx = obj.index
    if isinstance(key, slice):
        return idx._convert_slice_indexer(key, kind='getitem')

    elif isinstance(key, str):

        # we are an actual column
        if obj._data.items.contains(key):
            return None

        # We might have a datetimelike string that we can translate to a
        # slice here via partial string indexing
        if idx.is_all_dates:
            try:
                return idx._get_string_slice(key)
            except (KeyError, ValueError, NotImplementedError):
                return None

    return None
150007
def _make_index(self):
        

        out = {}

        for layer in self._layers:
            cls = layer.__class__
            out[cls] = out.get(cls, []) + [layer]

        return out
652841
def _get_index(self, index=None):
        

        if self.is_freq_type:
            if index is None:
                index = self._on
            return index, index.asi8
        return index, index
843887
public ByteBuffer sliceAsByteBuffer(int index, int length)
    {
        if (hasArray()) {
            return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length);
        }
        else {
            assert (!isUniversalBuffer);
            return DirectBufferAccess.newByteBuffer(address, index, length, reference);
        }
    }
690743
def indexXY(self, index):
        
        rect = self.visualRect(index)
        return rect.x(), rect.y()
576750
def p_array_index(self, p):
        ''''''
        if len(p) == 3:
            p[0] = slice(0, -1, -1)
        elif len(p) == 1 or p[1] == ':':
            p[0] = slice(0, -1, 1)
        else:
            p[0] = slice(0, int(p[1]), 1)