Reverse the order of sites in sequences.
977658
def reverse_sequences(records):
    
    logging.info('Applying _reverse_sequences generator: '
                 'reversing the order of sites in sequences.')
    for record in records:
        rev_record = SeqRecord(record.seq[::-1], id=record.id,
                               name=record.name,
                               description=record.description)
        # Copy the annotations over
        _reverse_annotations(record, rev_record)

        yield rev_record
1006874
def prune_overridden(ansi_string):
    
    multi_seqs = set(p for p in RE_ANSI.findall(ansi_string) if ';' in p[1])  # Sequences with multiple color codes.

    for escape, codes in multi_seqs:
        r_codes = list(reversed(codes.split(';')))

        # Nuke everything before {/all}.
        try:
            r_codes = r_codes[:r_codes.index('0') + 1]
        except ValueError:
            pass

        # Thin out groups.
        for group in CODE_GROUPS:
            for pos in reversed([i for i, n in enumerate(r_codes) if n in group][1:]):
                r_codes.pop(pos)

        # Done.
        reduced_codes = ';'.join(sorted(r_codes, key=int))
        if codes != reduced_codes:
            ansi_string = ansi_string.replace(escape, '\033[' + reduced_codes + 'm')

    return ansi_string
812627
function reverse(a) {
  var len = a.length;
  for (var i = 0; i < Math.floor(len/2); i++) {
    [a[i], a[len-i-1]] = [a[len-i-1], a[i]];
  }
  return a;
}
1605
public static <C extends Comparable> Ordering<Range<C>> reverseOrderingByUpperEndpoint() {
        Ordering<Range<C>> orderingByUpperEndpoint = orderingByUpperEndpoint();
        return orderingByUpperEndpoint.reverse();
    }
430558
def _reverse(self):
    
    for p in self.items:
      for h in p.hunks:
        h.startsrc, h.starttgt = h.starttgt, h.startsrc
        h.linessrc, h.linestgt = h.linestgt, h.linessrc
        for i,line in enumerate(h.text):
          # need to use line[0:1] here, because line[0]
          # returns int instead of bytes on Python 3
          if line[0:1] == b'+':
            h.text[i] = b'-' + line[1:]
          elif line[0:1] == b'-':
            h.text[i] = b'+' +line[1:]
158699
private void reverse(WritableDataStore<HashSetModifiableDBIDs> sampleNewHash, WritableDataStore<HashSetModifiableDBIDs> newReverseNeighbors, WritableDataStore<HashSetModifiableDBIDs> oldReverseNeighbors) {
    for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
      KNNHeap heap = store.get(iditer);
      HashSetDBIDs newNeighbors = sampleNewHash.get(iditer);
      for(DoubleDBIDListIter heapiter = heap.unorderedIterator(); heapiter.valid(); heapiter.advance()) {
        (newNeighbors.contains(heapiter) ? newReverseNeighbors : oldReverseNeighbors).get(heapiter).add(iditer);
      }
    }
  }
1214512
def strip_head(sequence, values):
    """"""
    values = set(values)
    return list(itertools.dropwhile(lambda x: x in values, sequence))
758596
def reversed(self):
        """"""
        newpath = [seg.reversed() for seg in self]
        newpath.reverse()
        return Path(*newpath)
143790
def _reverse(self):
        """"""
        # Reverse the contents of each byte
        n = [BYTE_REVERSAL_DICT[b] for b in self._datastore.rawbytes]
        # Then reverse the order of the bytes
        n.reverse()
        # The new offset is the number of bits that were unused at the end.
        newoffset = 8 - (self._offset + self.len) % 8
        if newoffset == 8:
            newoffset = 0
        self._setbytes_unsafe(bytearray().join(n), self.length, newoffset)
1122513
public function reverse() {
		if(!$this->orderBy)
			throw new \Exception('Cannot reverse a query without order by.');

		preg_match_all('/([^,])*([(].*?[)])([^,])*|([^,])+/', $this->orderBy, $e);
		$e = $e[0];
		foreach($e as $k=>$v) {
			$v = preg_replace_callback('/(DESC|ASC)[\s]*/', function($r) {
				$r = $r[0];
				if(strpos($r, 'DESC') !== false)
					return str_replace('DESC', 'ASC', $r);
				else
					return str_replace('ASC', 'DESC', $r);
			}, $v, -1, $c);
			if($c === 0)
				$v = $v.' DESC';
			$e[$k] = $v;
		}
		$orderBy = implode(', ', $e);

		$this->orderBy($orderBy);
		return $this;
	}
1005073
def _join_sequence(seq, last_separator=''):
    """"""
    count = len(seq)
    return ', '.join(_format_element(element, count, i, last_separator)
                     for i, element in enumerate(seq))
128688
def remove_duplicates(seq):
    '''
    
    '''
    last_boundary = False
    for char in seq:
        if char == '\x00':
            if not last_boundary:
                last_boundary = True
                yield char
        else:
            last_boundary = False
            yield char
463056
public static void reverse(final char[] a, int fromIndex, int toIndex) {
        checkFromToIndex(fromIndex, toIndex, len(a));

        if (N.isNullOrEmpty(a) || a.length == 1) {
            return;
        }

        char tmp = 0;

        for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
    }
60272
def enumerate_reversed(sequence):
    
    for index in reversed(xrange(len(sequence))):
        yield index, sequence[index]
1158202
public function reverse() : void
    {
        $newBits = new SplFixedArray(count($this->bits));

        for ($i = 0; $i < $this->size; ++$i) {
            if ($this->get($this->size - $i - 1)) {
                $newBits[$i >> 5] = $newBits[$i >> 5] | (1 << ($i & 0x1f));
            }
        }

        $this->bits = $newBits;
    }
821064
def Reverse(self, y):
        """"""
        return self._Bisect(y, self.ys, self.xs)
230011
def dePrefixAndSuffixFasta(sequences):
    
    sequences = sorted(sequences, key=lambda s: len(s.seq), reverse=True)
    seen = set()
    for s in sequences:
        thisSeq = str(s.seq)
        thisHash = md5(thisSeq.encode('UTF-8')).digest()
        if thisHash not in seen:
            # Add prefixes.
            newHash = md5()
            for nucl in thisSeq:
                newHash.update(nucl.encode('UTF-8'))
                seen.add(newHash.digest())
            # Add suffixes.
            for start in range(len(thisSeq) - 1):
                seen.add(md5(thisSeq[start + 1:].encode('UTF-8')).digest())
            yield s