returns splits only up to the given date
343077
def get_splits_in_period(self, start: Datum, end: Datum) -> List[Split]:
        
        # from gnucash_portfolio.lib import generic

        query = (
            self.book.session.query(Split)
            .join(Transaction)
            .filter(Split.account == self.account,
                    Transaction.post_date >= start.value.date(),
                    Transaction.post_date <= end.value.date()
                    )
        )
        # sql = generic.get_sql(query)
        return query.all()
130664
function splitAroundSuspends (currentEvent, pumpSuspends, firstResumeTime, suspendedPrior, lastSuspendTime, currentlySuspended) {
    var events = [];

    var firstResumeStarted = new Date(firstResumeTime);
    var firstResumeDate = firstResumeStarted.getTime()

    var lastSuspendStarted = new Date(lastSuspendTime);
    var lastSuspendDate = lastSuspendStarted.getTime();

    if (suspendedPrior && (currentEvent.date < firstResumeDate)) {
        if ((currentEvent.date+currentEvent.duration*60*1000) < firstResumeDate) {
            currentEvent.duration = 0;
        } else {
            currentEvent.duration = ((currentEvent.date+currentEvent.duration*60*1000)-firstResumeDate)/60/1000;

            currentEvent.started_at = new Date(tz(firstResumeTime));
            currentEvent.date = firstResumeDate
        }
    }

    if (currentlySuspended && ((currentEvent.date+currentEvent.duration*60*1000) > lastSuspendTime)) {
        if (currentEvent.date > lastSuspendTime) {
            currentEvent.duration = 0;
        } else {
            currentEvent.duration = (firstResumeDate - currentEvent.date)/60/1000;
        }
    }

    events.push(currentEvent);

    if (currentEvent.duration == 0) {
        // bail out rather than wasting time going through the rest of the suspend events
        return events;
    }

    for (var i=0; i < pumpSuspends.length; i++) {
        var suspend = pumpSuspends[i];

        for (var j=0; j < events.length; j++) {

            if ((events[j].date <= suspend.date) && (events[j].date+events[j].duration*60*1000) > suspend.date) {
                // event started before the suspend, but finished after the suspend started

                if ((events[j].date+events[j].duration*60*1000) > (suspend.date+suspend.duration*60*1000)) {
                    var event2 = _.cloneDeep(events[j]);

                    var event2StartDate = moment(suspend.started_at).add(suspend.duration,'minutes');

                    event2.timestamp = event2StartDate.format();
                    event2.started_at = new Date(tz(event2.timestamp));
                    event2.date = suspend.date+suspend.duration*60*1000;

                    event2.duration = ((events[j].date+events[j].duration*60*1000) - (suspend.date+suspend.duration*60*1000))/60/1000;

                    events.push(event2);
                }

                events[j].duration = (suspend.date-events[j].date)/60/1000;

            } else if ((suspend.date <= events[j].date) && (suspend.date+suspend.duration*60*1000 > events[j].date)) {
                // suspend started before the event, but finished after the event started
            
                events[j].duration = ((events[j].date+events[j].duration*60*1000) - (suspend.date+suspend.duration*60*1000))/60/1000;

                var eventStartDate = moment(suspend.started_at).add(suspend.duration,'minutes');

                events[j].timestamp = eventStartDate.format();
                events[j].started_at = new Date(tz(events[j].timestamp));
                events[j].date = suspend.date + suspend.duration*60*1000;
            }
        }
    }

    return events;
}
229097
public static String[] splitToArray(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
		return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
	}
1133682
def splits(self):
        
        return list(map(lambda x: self.select_code(x), self.code))
1205637
def split_date(datetime)
			datetime=Time.now.iso8601 if datetime == :now
			date,time=datetime.to_s.split("T")
			year,month,day=date.split("-")
			return year,month,day,time
		end
15105
def _getFromDate(l, date):
    '''
    
    '''
    try:
        date = _toDate(date)
        i = _insertDateIndex(date, l) - 1
        if i == -1:
            return l[0]
        return l[i]
    except (ValueError, TypeError):
        # ValueError: date invalid / TypeError: date = None
        return l[0]
1326982
function splitOne(str, sep) {
  let index = str.indexOf(sep);
  return index < 0 ? null : [str.slice(0, index), str.slice(index + sep.length)];
}
781360
def split(self, granularity_after_split, exclude_partial=True):
        

        if granularity_after_split == Granularity.DAY:
            return self.get_days()

        elif granularity_after_split == Granularity.WEEK:
            return self.get_weeks(exclude_partial)

        elif granularity_after_split == Granularity.MONTH:
            return self.get_months(exclude_partial)

        elif granularity_after_split == Granularity.QUARTER:
            return self.get_quarters(exclude_partial)

        elif granularity_after_split == Granularity.HALF_YEAR:
            return self.get_half_years(exclude_partial)

        elif granularity_after_split == Granularity.YEAR:
            return self.get_years(exclude_partial)

        else:
            raise Exception("Invalid granularity: %s" % granularity_after_split)
1250668
def sepBy(p, sep):
    ''''''
    return separated(p, sep, 0, maxt=float('inf'), end=False)
874474
def split_on_condition(seq, condition):
    """"""
    l1, l2 = tee((condition(item), item) for item in seq)
    return (i for p, i in l1 if p), (i for p, i in l2 if not p)
652330
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty){
		return split(str, separator, limit, isTrim, ignoreEmpty, false);
	}
132697
def split_data(self):
        

        try:
            # Extract data ranging in time_period1
            time_period1 = (slice(self.baseline_period[0], self.baseline_period[1]))
            self.baseline_in = self.original_data.loc[time_period1, self.input_col]
            self.baseline_out = self.original_data.loc[time_period1, self.output_col]

            if self.exclude_time_period:
                for i in range(0, len(self.exclude_time_period), 2):
                    # Drop data ranging in exclude_time_period1
                    exclude_time_period1 = (slice(self.exclude_time_period[i], self.exclude_time_period[i+1]))
                    self.baseline_in.drop(self.baseline_in.loc[exclude_time_period1].index, axis=0, inplace=True)
                    self.baseline_out.drop(self.baseline_out.loc[exclude_time_period1].index, axis=0, inplace=True)
        except Exception as e:
            raise e

        # CHECK: Can optimize this part
        # Error checking to ensure time_period values are valid
        if self.projection_period:
            for i in range(0, len(self.projection_period), 2):
                period = (slice(self.projection_period[i], self.projection_period[i+1]))
                try:
                    self.original_data.loc[period, self.input_col]
                    self.original_data.loc[period, self.output_col]
                except Exception as e:
                    raise e
1027881
function filterData(str, data) {
  data = data || [];
  var ctx = String(str || '').trim();
  var slashParts = ctx.split('/');
  ctx = slashParts.pop();
  var wordParts = String(ctx).trim().split(' ');
  var res = data.filter(function (item) {
    return (strip(item).slice(0, ctx.length) === ctx);
  });
  res = res.map(function (item) {
    var parts = String(item).trim().split(' ');
    if (parts.length > 1) {
      parts = parts.slice(wordParts.length);
      return parts.join(' ');
    }
    return item;
  });
  return res;
}
583991
private SortedMap<String, List<QueryResult>> splitQueryResultsByTime(Iterable<QueryResult> results) {
        SortedMap<String, List<QueryResult>> resultsByTime = new TreeMap<String, List<QueryResult>>();

        for (QueryResult result : results) {
            String epoch = String.valueOf(result.getEpoch(TimeUnit.SECONDS));

            if (resultsByTime.containsKey(epoch)) {
                List<QueryResult> current = resultsByTime.get(epoch);
                current.add(result);
                resultsByTime.put(epoch, current);
            } else {
                ArrayList<QueryResult> newQueryList = new ArrayList<QueryResult>();
                newQueryList.add(result);
                resultsByTime.put(epoch, newQueryList);
            }
        }

        return resultsByTime;
    }
1040474
def split_data(data, subset, splits):
  '''
  '''

  return dict([(k, data[k][splits[subset]]) for k in data])
773078
def splitSong(songToSplit, start1, start2):
    """"""
    print "start1 " + str(start1)
    print "start2 " + str(start2)
    # songs = [songToSplit[:start1+2000], songToSplit[start2-2000:]]
    songs = [songToSplit[:start1], songToSplit[start2:]]
    return songs
442157
def cut(self, times: Union[datetime.datetime,
                               List[datetime.datetime]]) -> List["Interval"]:
        
        if not isinstance(times, list):
            # Single time
            time = times
            if not self.contains(time):
                return []
            return [
                Interval(self.start, time),
                Interval(time, self.end)
            ]
        else:
            # Multiple times
            times = [t for t in times if self.contains(t)]  # discard others
            times.sort()
            times = [self.start] + times + [self.end]
            intervals = []
            for i in range(len(times) - 1):
                intervals.append(Interval(times[i], times[i + 1]))
            return intervals