Convert single index to corresponding (ell, m) pair
483152
def ind_lm(index, lmax):
    """"""
    import numpy as np
    lm = np.empty(2, dtype=np.float64)
    _ind_lm(index, lmax, lm)
    return lm
182050
def index(elem):
    '''
    
    '''
    parent = elem.getparent()
    for x in range(0, len(parent.getchildren())):
        if parent.getchildren()[x] == elem:
            return x
    return -1
1367851
def get(self, index):
        
        data = self.data
        index2 = self._split(index)
        for c in index2[:-1]:
            i = int(c) - 1
            data = data[i][4]
        return [index[:-2] or ""] + data[int(index[-1]) - 1]
394742
function indexPairs(num_pairs, context){
    var vertex_elements = context.vertex_data.vertex_elements;
    var num_vertices = context.vertex_data.vertex_count;
    var offset = num_vertices - 2 * num_pairs - 2;

    for (var i = 0; i < num_pairs; i++){
        vertex_elements.push(offset + 2 * i + 2);
        vertex_elements.push(offset + 2 * i + 1);
        vertex_elements.push(offset + 2 * i + 0);
        vertex_elements.push(offset + 2 * i + 2);
        vertex_elements.push(offset + 2 * i + 3);
        vertex_elements.push(offset + 2 * i + 1);
        context.geom_count += 2;
    }
}
870504
def _transform_indices(self, key):
        
        ndims = self.ndims
        if all(not (isinstance(el, slice) or callable(el)) for el in key):
            dim_inds = []
            for dim in self.kdims:
                dim_type = self.get_dimension_type(dim)
                if isinstance(dim_type, type) and issubclass(dim_type, Number):
                    dim_inds.append(self.get_dimension_index(dim))
            str_keys = iter(key[i] for i in range(self.ndims)
                            if i not in dim_inds)
            num_keys = []
            if len(dim_inds):
                keys = list({tuple(k[i] if ndims > 1 else k for i in dim_inds)
                             for k in self.keys()})
                q = np.array([tuple(key[i] if ndims > 1 else key for i in dim_inds)])
                idx = np.argmin([np.inner(q - np.array(x), q - np.array(x))
                                 if len(dim_inds) == 2 else np.abs(q-x)
                                     for x in keys])
                num_keys = iter(keys[idx])
            key = tuple(next(num_keys) if i in dim_inds else next(str_keys)
                        for i in range(self.ndims))
        elif any(not (isinstance(el, slice) or callable(el)) for el in key):
            keys = self.keys()
            for i, k in enumerate(key):
                if isinstance(k, slice):
                    continue
                dim_keys = np.array([ke[i] for ke in keys])
                if dim_keys.dtype.kind in 'OSU':
                    continue
                snapped_val = dim_keys[np.argmin(np.abs(dim_keys-k))]
                key = list(key)
                key[i] = snapped_val
            key = tuple(key)
        return key
376786
def to_m(*attrs)
      m=Matrix.build(self.row_size, self.column_size){nil}
      self.each_with_index do |x, row, col|
        if attrs.size == 0 || attrs.nil?
          m[row, col] = x.value
        end
      end
      return m
    end
302835
def _split_index(params):
    
    if isinstance(params, list):
        return [params[0], _split_index(params[1])]
    elif isinstance(params, dict):
        if INDEX in params.keys():
            return _split_index(params[VALUE])
        result = dict()
        for key in params:
            result[key] = _split_index(params[key])
        return result
    else:
        return params
850926
def normalize_index(index):
    """"""
    index = np.asarray(index)
    
    if len(index) == 0:
        return index.astype('int')
    
    if index.dtype == 'bool':
        index = index.nonzero()[0]
    elif index.dtype == 'int':
        pass
    else:
        raise ValueError('Index should be either integer or bool')
    return index
1077664
function fromAlphabet( str )
	{
		str = str.toUpperCase();
		var l = alpahbets.length, retVal = 1;
		for ( var x = 1; str.length > 0; x *= l )
		{
			retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x;
			str = str.substr( 0, str.length - 1 );
		}
		return retVal;
	}
191349
def _index_to_row_col(lines, index):
    
    """
    if index < 0:
        raise IndexError('negative index')
    current_index = 0
    for line_number, line in enumerate(lines):
        line_length = len(line)
        if current_index + line_length > index:
            return line_number, index - current_index
        current_index += line_length
    raise IndexError('index %d out of range' % index)
496303
def _indices(self, indices):
    """"""
    if isinstance(indices, tuple):
      out = []
      dim = 0
      for i, index in enumerate(indices):
        if index is Ellipsis:
          out.append(index)
          dim = len(self.shape) - len(indices) + i
        else:
          out.append(self._get_index(dim, index))
        dim += 1
      return tuple(out)
    else:
      return self._get_index(0, indices)
650041
def get_reg_index_value_pairs(self, regIndexList):
        
        str = b''
        regList = self._context.read_core_registers_raw(regIndexList)
        for regIndex, reg in zip(regIndexList, regList):
            str += six.b(conversion.byte_to_hex2(regIndex) + ':' + conversion.u32_to_hex8le(reg) + ';')
        return str
988222
def qindex2index(index):
        
        r = index.row()
        c = index.column()
        if c > 0x10:
            return (0x10 * r) + c - 0x11
        else:
            return (0x10 * r) + c
1213985
def _key_to_index(keys, key, single_only=False):
    ''
    if isinstance(key, int): # validate the int index
        try:
            keys[key]
        except IndexError:
            raise KeyError('Index out of range of keys: %s' % (key,))
        if key < 0:
            key += len(keys) # always positive index
        return key
#    keys = d.keys()
    if not single_only:
        if isinstance(key, (tuple, list)):
            return [_key_to_index_single(keys, k) for k in key]

        if isinstance(key, slice):
            start, stop, step = key.start, key.stop, key.step
            try:
                MI_check_index_name(start)
                start = keys.index(start)
            except TypeError:
                pass
            try:
                MI_check_index_name(stop)
                stop = keys.index(stop)
            except TypeError:
                pass
#            return slice(start, stop, step)
            args = slice(start, stop, step).indices(len(keys))
            return force_list(range(*args)) # list of indices
    try:
        return keys.index(key)
    except ValueError: # not IndexError
        raise KeyError('Key not found: %s' % (key,))
697584
def _getNearestMappingIndexList(fromValList, toValList):
    '''
    
    '''

    indexList = []
    for fromTimestamp in fromValList:
        smallestDiff = _getSmallestDifference(toValList, fromTimestamp)
        i = toValList.index(smallestDiff)
        indexList.append(i)

    return indexList
694992
def _hsig_input(self, index):
        '''
        
        '''
        hsig_input = z.ZcashByteData()
        hsig_input += self.tx_joinsplits[index].random_seed
        hsig_input += self.tx_joinsplits[index].nullifiers
        hsig_input += self.joinsplit_pubkey
        return hsig_input.to_bytes()
1212313
def _normalize_index(self, index, pipe=None):
        """"""
        pipe = self.redis if pipe is None else pipe
        len_self = self.__len__(pipe)
        positive_index = index if index >= 0 else len_self + index

        return len_self, positive_index