Check that IDs are increasing and consecutive

    returns tuple (bool, list of IDs that are not consecutive
    with their predecessor)
422734
def has_sequential_ids(data_wrapper):
    '''
    '''
    db = data_wrapper.data_block
    ids = db[:, COLS.ID]
    steps = ids[np.where(np.diff(ids) != 1)[0] + 1].astype(int)
    return CheckResult(len(steps) == 0, steps)
205430
def _recenter(self):
        
        for split_idx in range(len(self._splits)):
            split = self._splits[split_idx]
            len_idx = self._split2len_idx[split]
            if split == self._splits[-1]:
                continue
            right_split = self._splits[split_idx + 1]

            # Try shifting the centroid to the left
            if len_idx > 0 and self._lengths[len_idx - 1] not in self._split_cntr:
                new_split = self._lengths[len_idx - 1]
                left_delta = self._len_cntr[split] * (right_split - new_split) - self._split_cntr[split] * (
                        split - new_split)
                if left_delta < 0:
                    self._splits[split_idx] = new_split
                    self._split2len_idx[new_split] = len_idx - 1
                    del self._split2len_idx[split]
                    self._split_cntr[split] -= self._len_cntr[split]
                    self._split_cntr[right_split] += self._len_cntr[split]
                    self._split_cntr[new_split] = self._split_cntr[split]
                    del self._split_cntr[split]

            # Try shifting the centroid to the right
            elif len_idx < len(self._lengths) - 2 and self._lengths[len_idx + 1] not in self._split_cntr:
                new_split = self._lengths[len_idx + 1]
                right_delta = self._split_cntr[split] * (new_split - split) - self._len_cntr[split] * (
                        new_split - split)
                if right_delta <= 0:
                    self._splits[split_idx] = new_split
                    self._split2len_idx[new_split] = len_idx + 1
                    del self._split2len_idx[split]
                    self._split_cntr[split] += self._len_cntr[split]
                    self._split_cntr[right_split] -= self._len_cntr[split]
                    self._split_cntr[new_split] = self._split_cntr[split]
                    del self._split_cntr[split]
703396
def next_id(self):
        """"""
        msgid = self._id_template.format(self._next_id)
        self._next_id += 1
        return msgid
1228490
function compareRelids(a, b) {
            var aRel = self.getRelid(a),
                bRel = self.getRelid(b);

            if (aRel < bRel) {
                return -1;
            } else if (aRel > bRel) {
                return 1;
            } else {
                return 0;
            }
        }
1103742
def status(self, *ids):
		
		with self.lock:
			if len(ids) > 1:
				return [self._status[i] for i in ids]
			else:
				return self._status[ids[0]]
147486
def _is_contiguous(positions):
    """"""
    previous = positions[0]
    for current in positions[1:]:
        if current != previous + 1:
            return False
        previous = current
    return True
836483
def check_next_match(self, match, new_relations, subject_graph, one_match):
        """"""
        # only returns true for ecaxtly one set of new_relations from all the
        # ones that are symmetrically equivalent
        if not (self.criteria_sets is None or one_match):
            for check in self.duplicate_checks:
                vertex_a = new_relations.get(check[0])
                vertex_b = new_relations.get(check[1])
                if vertex_a is None and vertex_b is None:
                    continue # if this pair is completely absent in the new
                    # relations, it is either completely in the match or it
                    # is to be matched. So it is either already checked for
                    # symmetry duplicates, or it will be check in future.
                if vertex_a is None:
                    # maybe vertex_a is in the match and vertex_b is the only
                    # one in the new relations. try to get vertex_a from the
                    # match.
                    vertex_a = match.forward.get(check[0])
                    if vertex_a is None:
                        # ok, vertex_a is to be found, don't care about it right
                        # now. it will be checked in future calls.
                        continue
                elif vertex_b is None:
                    # maybe vertex_b is in the match and vertex_a is the only
                    # one in the new relations. try to get vertex_b from the
                    # match.
                    vertex_b = match.forward.get(check[1])
                    if vertex_b is None:
                        # ok, vertex_b is to be found, don't care about it right
                        # now. it will be checked in future calls.
                        continue
                if vertex_a > vertex_b:
                    # Why does this work? The answer is not so easy to explain,
                    # and certainly not easy to find. if vertex_a > vertex_b, it
                    # means that there is a symmetry operation that leads to
                    # an equivalent match where vertex_b < vertex_a. The latter
                    # match is preferred for as much pairs (vertex_a, vertex_b)
                    # as possible without rejecting all possible matches. The
                    # real difficulty is to construct a proper list of
                    # (vertex_a, vertex_b) pairs that will reject all but one
                    # matches. I conjecture that this list contains all the
                    # first two vertices from each normalized symmetry cycle of
                    # the pattern graph. We need a math guy to do the proof. -- Toon
                    return False
            return True
        return True
476286
def is_block(bin_list):

    
    id_set = set((my_bin[1] for my_bin in bin_list))
    start_id, end_id = min(id_set), max(id_set)
    return id_set == set(range(start_id, end_id + 1))
62331
function getNextId() {
    var dataIds = Object.keys(idIndexData)

    dataIds.sort(function (a, b) {
      return b - a
    })

    if (dataIds && dataIds[0]) {
      var id = _.parseInt(dataIds[0]) + 1
      return id
    } else {
      return 1
    }
  }
276157
def diff_since(time)
      other_audit = auditable.audits.where("created_at <= ? AND id != ?", time, id).order("id DESC").limit(1).first

      diff(other_audit)
    end
21456
def is_contiguous(self):
        ''''''
        previous = None
        for index in self.indexes:
            if previous is None:
                previous = index
                continue

            if index != (previous + 1):
                return False

            previous = index

        return True
895798
def isSequence(arg):
    """"""
    if hasattr(arg, "strip"):
        return False
    if hasattr(arg, "__getslice__"):
        return True
    if hasattr(arg, "__iter__"):
        return True
    return False
1145802
def sequential_id(k, identifier):
    """"""
    key = _key(k)
    return int(monotonic_zadd(keys=[key], args=[identifier]))
588955
def nextId(self):
        
        if self._next_id is False:
            # Request the next urn
            self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.urn.reference)
        return self._next_id
520271
def check(self, read_tuple_name):
        

        parts = read_tuple_name.split("__")

        if len(parts[0]) != self.prefix_width or len(parts[1]) != self.read_tuple_id_width:
            return False

        segments = parts[2][1:-1].split("),(")
        for segment in segments:
            int_widths = list(map(len, segment.split(",")))
            if self.genome_id_width != int_widths[0]:
                return False
            if self.chr_id_width != int_widths[1]:
                return False
            if self.coor_width != int_widths[3] or self.coor_width != int_widths[4]:
                return False

        return True
31896
public boolean next()
	{
		if( indexes.length <= 1 || permutation >= total-1 )
			return false;

		int N = indexes.length-2;
		int k = N;

		swap(k, counters[k]++);
		while( counters[k] == indexes.length ) {
			k -= 1;
			swap(k, counters[k]++);
		}
		swap(counters[k], k);  //before
		while (k < indexes.length - 1) {
			k++;
			counters[k] = k;
		}

		permutation++;
		return true;
	}
344541
def next(self):
        
        if self._records_iter >= len(self._records):
            raise StopIteration
        self._records_iter += 1
        return self._records[self._records_iter - 1]