Substract an Interval from a Sequence.
187902
private function substractOne(Sequence $sequence, Period $interval): self
    {
        if ($sequence->isEmpty()) {
            return $sequence;
        }

        $reducer = function (Sequence $sequence, Period $period) use ($interval) {
            $substract = $period->substract($interval);
            if (!$substract->isEmpty()) {
                $sequence->push(...$substract);
            }

            return $sequence;
        };

        return $sequence->reduce($reducer, new self());
    }
628760
public static function subtractSecond($ts = null, $num = 1)
	{
		return sfTime::subtract($ts, $num, sfTime::SECOND);
	}
297963
def get_and_subtract(self, delta):
        '''
        
        '''
        with self._reference.get_lock():
            oldval = self._reference.value
            self._reference.value -= delta
            return oldval
339943
def _flatten(n):
    """"""
    if isinstance(n, collections.Sequence):
        for x in n:
            for y in _flatten(x):
                yield y
    else:
        yield n
836520
def split(self):
        """"""
        self.stop()
        interval = Interval()
        interval._start_instant = self.stop_instant
        return interval
1349058
def _strip_counters(self, sub_line):
        """"""
        try:
            end = sub_line.rindex('}')
        except ValueError:
            return sub_line
        else:
            return sub_line[:(end + 1)]
498515
def get_and_subtract(self, delta):
        '''
        
        '''
        with self._lock.exclusive:
            oldval = self._value
            self._value -= delta
            return oldval
1045573
def average(sequence, key):
    """"""
    return sum(map(key, sequence)) / float(len(sequence))
701924
def truncate(value: Decimal, n_digits: int) -> Decimal:
    """"""
    return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digits)
247808
def excluding(self, sequence) -> Generator:
        """"""
        return (element for element in sequence
                if self.indexer(element) not in self.predicates)
1221436
def subseq(start_offset=0, end_offset=None):
    
    def _(sequence):
        return sequence.subseq(start_offset, end_offset)
    return _
627495
def _set_seq(self,sequence,start=0):
    """"""
    if start+len(sequence) > self._slen: 
      sys.stderr.write("Error not long enough to add\n")
      sys.exit()
    z = 0
    for i in xrange(start, start+len(sequence)):
      self._set_nt(sequence[z],i)
      z+=1
417550
def subtract(self, **kwargs):
        """"""
        return self.from_datetime(
            pendulum.instance(self.datetime()).subtract(**kwargs)
        )
435003
def _interval_split(interval, only=None, context=None, event_re=re.compile("[A-Z][0-9]+")):
    
    def split_event(event):
        "Helper to parse events."
        kind, val = event[:1], event[1:]
        try:
            return kind, float(val)
        except (TypeError, ValueError):
            return None, 0

    if hasattr(interval, "fetch"):
        interval = interval.fetch("custom_activations")
    ##import sys; print >>sys.stderr, "!!!!!isplit", interval, event_re.findall(interval)

    return list(reversed([split_event(i) for i in event_re.findall(interval) if not only or i.startswith(only)]))
965011
def truncate(sequence):
    
    if len(sequence) > LIST_SLICE:
        return ", ".join(sequence[:LIST_SLICE] + ["..."])
    else:
        return ", ".join(sequence)
348475
public static Interval fromTo(int from, int to)
    {
        if (from <= to)
        {
            return Interval.fromToBy(from, to, 1);
        }
        return Interval.fromToBy(from, to, -1);
    }
817204
public function subtract($interval) : self
    {
        $instance = clone $this;
        
        $instance->date->sub(self::resolveDateInterval($interval));
        
        return $instance;
    }