recursively finds ids within a range
480029
def find(self, node, interval, start, end):
        """"""
        data = []
        
        if len(interval) != 2:
            raise SyntaxError('Interval malformed %s. Allways specify start and end position for interval.' % str(interval))
        
        left = (start, node[0])
        right = (node[0], end)

        if self.overlap(left, interval):
            data.extend(node[-1])
            if node[1] != -1:
                data.extend(self.find(node[1], interval, left[0], left[1]))

        if self.overlap(right, interval):
            data.extend(node[-1])
            if node[2] != -1:
                data.extend(self.find(node[2], interval, right[0], right[1]))

        return list(set(data))
1021138
protected void precomputeInterestingRadii(DBIDs ids, RangeQuery<O> rangeQuery, WritableDataStore<DoubleIntArrayList> interestingDistances) {
    FiniteProgress progressPreproc = LOG.isVerbose() ? new FiniteProgress("LOCI preprocessing", ids.size(), LOG) : null;
    for(DBIDIter iditer = ids.iter(); iditer.valid(); iditer.advance()) {
      DoubleDBIDList neighbors = rangeQuery.getRangeForDBID(iditer, rmax);
      // build list of critical distances
      DoubleIntArrayList cdist = new DoubleIntArrayList(neighbors.size() << 1);
      {
        int i = 0;
        DoubleDBIDListIter ni = neighbors.iter();
        while(ni.valid()) {
          final double curdist = ni.doubleValue();
          ++i;
          ni.advance();
          // Skip, if tied to the next object:
          if(ni.valid() && curdist == ni.doubleValue()) {
            continue;
          }
          cdist.append(curdist, i);
          // Scale radius, and reinsert
          if(alpha != 1.) {
            final double ri = curdist / alpha;
            if(ri <= rmax) {
              cdist.append(ri, Integer.MIN_VALUE);
            }
          }
        }
      }
      cdist.sort();

      // fill the gaps to have fast lookups of number of neighbors at a given
      // distance.
      int lastk = 0;
      for(int i = 0, size = cdist.size(); i < size; i++) {
        final int k = cdist.getInt(i);
        if(k == Integer.MIN_VALUE) {
          cdist.setValue(i, lastk);
        }
        else {
          lastk = k;
        }
      }
      // TODO: shrink the list, removing duplicate radii?

      interestingDistances.put(iditer, cdist);
      LOG.incrementProcessed(progressPreproc);
    }
    LOG.ensureCompleted(progressPreproc);
  }
260897
function findClosestValue (values, lookupVal) {
  let diff = 1;
  let id = 0;

  values.forEach((value, index) => {
    const actualDiff = Math.abs(value - lookupVal);
    if (actualDiff < diff) {
      id = index;
      diff = actualDiff;
    }
  });

  return id;
}
1101022
function internal_find_deletes($diff,$count2) {
        $deletes=array();
        
        // 1. Create a new array that includes the lowest-valued
        //    index2 value below each run of 0s.
        //    I.e. if our array is say 1,2,0,0,0,3,0 then the
        //    resulting array will be -,-,3,3,3,-,0
        $squidges=array();
        $lowest=0;
        $countdiff = count($diff);
        for($index1=$countdiff;$index1>=1;$index1--) {
            $index2=$diff[$index1];
            if($index2===0) {
                $squidges[$index1]=$lowest;
            } else {
                $lowest=$index2;
            }
        }
        
        // 2. OK now we can use this new array to work out 
        //    items that are known to be deleted because we
        //    have matching items either side        
        $highest=0;
        foreach($diff as $index1=>$index2) {
            if($index2===0) {
                if($highest===$count2 || $highest+1===$squidges[$index1]) {
                    // Yep! Definitely deleted.
                    $deletes[]=$index1;                    
                } 
            } else {
                $highest=$index2;                
            }
        }
        return $deletes;        
    }
1109325
def _find(self, id_):
        
        cur = self._connection.cursor()
        cur.execute(
            'SELECT fileNumber, offset FROM sequences WHERE id = ?', (id_,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return self._getFilename(row[0]), row[1]
132148
def filter_by_ids(original_list, ids_to_filter):
    """"""
    if not ids_to_filter:
        return original_list

    return [i for i in original_list if i['id'] in ids_to_filter]
113623
function createLookup(ids) {
  for (let value of lookup) {
    if (ids.length === value.length) {
      let match = true;
      value.forEach(subItem=>{
        if (ids[n] !== subItem) match = false;
      });
      if (match) return value;
    }
  }
  return ids;
}
795815
def get_ids(self, start=0, rows=1000, **query_dict):
        """"""
        resp_dict = self._get_query(start=start, rows=rows, **query_dict)
        return {
            'matches': resp_dict['response']['numFound'],
            'start': start,
            'ids': [d['id'] for d in resp_dict['response']['docs']],
        }
366997
def get_id2parents(objs):
    """"""
    id2parents = {}
    for obj in objs:
        _get_id2parents(id2parents, obj.item_id, obj)
    return id2parents
1331951
function findAllIndices(needle = mandatory(), haystack = mandatory()) {
  var indices = [];
  for (var i = 0; i < haystack.length; i++) {
    if (haystack.substr(i, needle.length) === needle) {
      indices.push(i);
    }
  }

  if (indices.length) {
    return indices;
  } else {
    return -1;
  }
}
426761
function findAllIndices() {
  var needle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : mandatory();
  var haystack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mandatory();

  var indices = [];
  for (var i = 0; i < haystack.length; i++) {
    if (haystack.substr(i, needle.length) === needle) {
      indices.push(i);
    }
  }

  if (indices.length) {
    return indices;
  } else {
    return -1;
  }
}
418210
def find_by_ids(ids, _connection=None, page_size=100, page_number=0,
        sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
        
        if not isinstance(ids, (list, tuple)):
            err = "Video.find_by_ids expects an iterable argument"
            raise exceptions.PyBrightcoveError(err)
        ids = ','.join([str(i) for i in ids])
        return connection.ItemResultSet('find_videos_by_ids',
            Video, _connection, page_size, page_number, sort_by, sort_order,
            video_ids=ids)
256811
def get_sub_array_ids():
    """"""
    ids = set()
    for key in sorted(DB.keys(pattern='scheduling_block/*')):
        config = json.loads(DB.get(key))
        ids.add(config['sub_array_id'])
    return sorted(list(ids))
1164876
function findLastIndex(array, exp) {

  if(!isArray(array) || isUndefined(exp)) {
    return array;
  }
  //return the the index of the last member
  var index = (array.length - 1) - findInArray(reverse(array), $parse(exp), true);
  //if it's a NaN
  return index === index ? index : -1;
}
519013
function find(items, pred) {
  var len = items.length,
      i = -1;

  while(++i < len) {
    if (pred(items[i], i)) {
      return items[i];
    }
  }

  return null;
}
475079
def _get_id2parents(id2parents, item_id, item_obj):
    """"""
    if item_id in id2parents:
        return id2parents[item_id]
    parent_ids = set()
    for parent_obj in item_obj.parents:
        parent_id = parent_obj.item_id
        parent_ids.add(parent_id)
        parent_ids |= _get_id2parents(id2parents, parent_id, parent_obj)
    id2parents[item_id] = parent_ids
    return parent_ids
55024
def find_by_b64ids(self, _ids, **kwargs):
        

        return self.find_by_ids([ObjectId(base64.b64decode(_id)) for _id in _ids], **kwargs)