Returns index of collection item matching the match dictionary.
487048
def _collection_match_to_index(pspath, colfilter, name, match):
    '''
    
    '''
    collection = get_webconfiguration_settings(pspath, [{'name': name, 'filter': colfilter}])[0]['value']
    for idx, collect_dict in enumerate(collection):
        if all(item in collect_dict.items() for item in match.items()):
            return idx
    return -1
1017729
def _find_matching_collections_internally(collections, record):
    
    for name, data in iteritems(collections):
        if _build_query(data['query']).match(record):
            yield data['ancestors']
    raise StopIteration
148520
def index(self, item):
        ''
        k = self._key(item)
        i = bisect_left(self._keys, k)
        j = bisect_right(self._keys, k)
        return self._items[i:j].index(item) + i
987057
def index(self, item, **kwargs):
        # type: (Any, dict) -> int
        
        return list.index(self, self.ref(item), **kwargs)
17897
def relookup(self, pattern):
        
        key = re.compile(pattern)
        return filter(lambda x : key.match(x[0]), self.data.items())
180278
def match(self, device):
        """"""
        return all(match_value(getattr(device, k), v)
                   for k, v in self._match.items())
1337234
def getitem(lst, indices):
    
    if not indices:
        return lst

    i, indices = indices[0], indices[1:]
    item = list.__getitem__(lst, i)

    if isinstance(i, int):
        return getitem(item, indices)

    # Empty slice: check if all subsequent indices are in range for the
    # full slice, raise IndexError otherwise. This is NumPy's behavior.
    if not item:
        if lst:
           _ = getitem(lst, (slice(None),) + indices)
        elif any(isinstance(k, int) for k in indices):
           raise IndexError
        return []

    return [getitem(x, indices) for x in item]
1249433
def _dict_lookup(cls, item, **kwargs):
        '''
        
        '''
        log.debug('item == %s', item)
        value_lookup = kwargs.get('value_lookup', False)
        if 'lookup' in kwargs:
            for k, v in six.iteritems(kwargs['lookup']):
                if value_lookup:
                    if six.text_type(v).lower() == six.text_type(item).lower():
                        log.debug('returning key %s', k)
                        return k
                else:
                    if six.text_type(k).lower() == six.text_type(item).lower():
                        log.debug('returning value %s', v)
                        return v
        return 'Invalid Value'
799909
function indexOf(items, item) {
    var len = items.length, i;
    for (i = 0; i < len; i++) {
      if (items[i] === item) {
        return i;
      }
    }
    return -1;
  }
448403
def find_ge(self, item):
        ''
        k = self._key(item)
        i = bisect_left(self._keys, k)
        if i != len(self):
            return self._items[i]
        raise ValueError('No item found with key at or above: %r' % (k,))
522008
def regex_matches_to_indexed_words(matches):
    
    words = [dict(v, **dict([('sentence', i)]))
             for i, s in enumerate(matches['sentences'])
             for k, v in s.items() if k != 'length']
    return words
184775
def sorted(collection):
        
        if len(collection) < 1:
            return collection

        if isinstance(collection, dict):
            return sorted(collection.items(), key=lambda x: x[0])

        if isinstance(list(collection)[0], Operation):
            key = lambda x: x.operation_id
        elif isinstance(list(collection)[0], str):
            key = lambda x: SchemaObjects.get(x).name
        else:
            raise TypeError(type(collection[0]))
        return sorted(collection, key=key)
205663
private int itemToIndex(I i) {
		Integer r = allItems.absoluteIndexOf(i);
		return r == null ? -1 : r.intValue();
	}
351906
def get_pk_index(self, collection):
        
        cls = self.collections[collection]

        if not cls.get_pk_name() in self.indexes[collection]:
            self.create_index(cls.get_pk_name(), collection)
        return self.indexes[collection][cls.get_pk_name()]
872433
def match_rstring(self, tokens, item):
        """"""
        name, suffix = tokens
        return self.match_mstring((None, name, suffix), item, use_bytes=suffix.startswith("b"))
615541
function matchIndex(prop) {
    if (!prop || !/\[\d+\]/.test(prop))
        return false;
    var prefix = prop.match(/[^\[]+/i);
    var idx;
    var indices = prop.match(/\d+/g);
    if (!indices)
        return false;
    return {
        name: prefix[0],
        index: indices[0],
        indices: indices.slice(1)
    };
}
69402
function getIndex(item) {
            return isNumber(item) ? within(item, 0, items.length - 1) : item === undefined ? -1 : $items.index(item);
        }