Return a modified list containing only the indices indicated.

    Args:
        lst: Original list of values
        indices: List of indices to keep from the original list

    Returns:
        list: Filtered list of values
321063
def filter_list_by_indices(lst, indices):
    
    return [x for i, x in enumerate(lst) if i in indices]
1024584
def _finish_filter(self, lst, key, include_self, exclusive, biggest_first):
        """"""
        key = self._actual_key(key)
        locations = [x[0] for x in lst]

        if not include_self and key in locations:
            lst.pop(locations.index(key))

        lst.sort(key=lambda x: x[1], reverse=biggest_first)
        lst = [x for x, y in lst]

        # RoW in both key and lst, but not defined; only RoW remains if exclusive
        if key == 'RoW' and 'RoW' not in self and exclusive:
            return ['RoW'] if 'RoW' in lst else []
        elif exclusive:
            removed, remaining = set(), []
            while lst:
                current = lst.pop(0)
                faces = self[current]
                if not faces.intersection(removed):
                    removed.update(faces)
                    remaining.append(current)
            lst = remaining

        # If RoW not resolved, make it the smallest
        if 'RoW' not in self and 'RoW' in lst:
            lst[-1 if biggest_first else 0] = lst.pop(lst.index('RoW'))

        return lst
1356233
def extendlist(lst, i, value=''):
    """"""
    if i < len(lst):
        pass
    else:
        lst.extend([value, ] * (i - len(lst) + 1))
833103
def _list_to_seq(lst):
    """"""
    ml = autoclass('scala.collection.mutable.MutableList')()
    for element in lst:
        ml.appendElem(element)
    return ml
1135312
def FilterList(l, offset, count=0, filter_value=None):
  """"""

  if offset < 0:
    raise ValueError("Offset needs to be greater than or equal to zero")

  if count < 0:
    raise ValueError("Count needs to be greater than or equal to zero")

  count = count or sys.maxsize
  if not filter_value:
    return l[offset:offset + count]

  index = 0
  items = []
  for item in l:
    serialized_item = item.SerializeToString()
    if re.search(re.escape(filter_value), serialized_item, re.I):
      if index >= offset:
        items.append(item)
      index += 1

      if len(items) >= count:
        break

  return items
359375
def ignore(self, *ignore_lst: str):
        

        def stream():
            for each in ignore_lst:
                each = ConstStrPool.cast_to_const(each)
                yield id(each), each

        self.ignore_lst.update(stream())
244646
def reject(lst, *values):
    """"""
    lst = List.from_maybe(lst)
    values = frozenset(List.from_maybe_starargs(values))

    ret = []
    for item in lst:
        if item not in values:
            ret.append(item)
    return List(ret, use_comma=lst.use_comma)
1161530
def clean_list(l0, clean_item_fn=None):
    
    clean_item_fn = clean_item_fn if clean_item_fn else clean_item
    l = list()
    for index, item in enumerate(l0):
        cleaned_item = clean_item_fn(item)
        l.append(cleaned_item)
    return l
223588
def normalize_array(lst):
    
    np_arr = np.array(lst)
    x_normalized = np_arr / np_arr.max(axis=0)
    return list(x_normalized)
1306161
def filter_vectors(self, input_list):
        
        unique_dict = {}
        for v in input_list:
            unique_dict[v[1]] = v
        return list(unique_dict.values())
490934
def split_list(alist, wanted_parts=1):
    
    length = len(alist)
    return [
        alist[i * length // wanted_parts:(i + 1) * length // wanted_parts]
        for i in range(wanted_parts)
    ]
437741
def replace (inlst,oldval,newval):
    
    lst = inlst*1
    for i in range(len(lst)):
        if type(lst[i]) not in [ListType,TupleType]:
            if lst[i]==oldval: lst[i]=newval
        else:
            lst[i] = replace(lst[i],oldval,newval)
    return lst
294614
def remove(self, indices):
        
        if not self._is_valid_index(indices):
            self.log_exc(u"The given list of indices is not valid", None, True, ValueError)
        new_fragments = []
        sorted_indices = sorted(indices)
        i = 0
        j = 0
        while (i < len(self)) and (j < len(sorted_indices)):
            if i != sorted_indices[j]:
                new_fragments.append(self[i])
            else:
                j += 1
            i += 1
        while i < len(self):
            new_fragments.append(self[i])
            i += 1
        self.__fragments = new_fragments
538148
def indexMatch(L, func):
    ''
    for i, x in enumerate(L):
        if func(x):
            return i
213194
def map(lst, serialize_func):
    
    if not isinstance(lst, list):
        return lst
    return [serialize_func(e) for e in lst]
379632
def load_lst(self):
        
        with open(self._lst_file, 'r') as fd:
            lines = fd.readlines()

        idx, uname, fname = list(), list(), list()

        for line in lines:
            values = line.split(',')
            values = [x.strip() for x in values]

            # preserve the idx ordering here in case variables are not
            # ordered by idx
            idx.append(int(values[0]))  # convert to integer
            uname.append(values[1])
            fname.append(values[2])

        self._idx = idx
        self._fname = fname
        self._uname = uname
482276
def get_filters_values(self):
        
        return [(flt, value) for flt, value in zip(self.filters, self.values)]