Returns
        -------
        List of tuples of (start, stop) which represent the ranges of minutes
        which should be excluded when a market minute window is requested.
960194
def _exclusion_indices_for_range(self, start_idx, end_idx):
        
        itree = self._minute_exclusion_tree
        if itree.overlaps(start_idx, end_idx):
            ranges = []
            intervals = itree[start_idx:end_idx]
            for interval in intervals:
                ranges.append(interval.data)
            return sorted(ranges)
        else:
            return None
492915
def _check_holiday_structure(self, times):
        

        if not isinstance(times, list):
            raise TypeError("an list is required")

        for time in times:
            if not isinstance(time, tuple):
                raise TypeError("a tuple is required")
            if len(time) > 5:
                raise TypeError("Target time takes at most 5 arguments"
                                " ('%d' given)" % len(time))
            if len(time) < 5:
                raise TypeError("Required argument '%s' (pos '%d')"
                                " not found" % (TIME_LABEL[len(time)], len(time)))

            self._check_time_format(TIME_LABEL, time)
1063343
def read_tuple_ticks(self, symbol, start, end):
        '''  '''
        if end is None:
            end=sys.maxint

        session=self.getReadSession()()
        try:
            rows=session.query(Tick).filter(and_(Tick.symbol == symbol,
                                                      Tick.time >= int(start),
                                                      Tick.time < int(end)))
        finally:
            self.getReadSession().remove()

        return [self.__sqlToTupleTick(row) for row in rows]
1202303
def range(start, stop):
    

    length = stop - start

    out = list(length=length)

    index = 0

    orig_start = start

    while start < stop:
        val = index + orig_start
        out[index] = val
        index = index + 1
        start = orig_start + index

    return out
947687
def create_traj_ranges(start, stop, N):
    
    steps = (1.0/(N-1)) * (stop - start)
    if np.isscalar(steps):
        return steps*np.arange(N) + start
    else:
        return steps[:, None]*np.arange(N) + start[:, None]
73803
def source_range_slices(start, end, nr_var_dict):
    

    return OrderedDict((k, slice(s,e,1))
        for k, (s, e)
        in source_range_tuple(start, end, nr_var_dict).iteritems())
1229814
def allowed_values(self):
        
        data = clips.data.DataObject(self._env)

        lib.EnvSlotAllowedValues(
            self._env, self._cls, self._name, data.byref)

        return tuple(data.value) if isinstance(data.value, list) else ()
1264353
def calculate_intervals(chunk_sizes):
        
        start_indexes = [sum(chunk_sizes[:i]) for i in range(0, len(chunk_sizes))]
        end_indexes = [sum(chunk_sizes[:i+1]) for i in range(0, len(chunk_sizes))]
        return tuple(zip(start_indexes, end_indexes))
966860
function (t, use_UTC) {
		if (!use_UTC) {
			return [
				String("0" + t.getHours()).substr(-2),
				String("0" + t.getMinutes()).substr(-2)
			].join(":");
		}
		return [
			String("0" + t.getUTCHours()).substr(-2),
			String("0" + t.getUTCMinutes()).substr(-2)
		].join(":");
	}
893669
def get_availabilities_for_duration(duration, availabilities):
    
    duration_availabilities = []
    start_time = '10:00'
    while start_time != '17:00':
        if start_time in availabilities:
            if duration == 30:
                duration_availabilities.append(start_time)
            elif increment_time_by_thirty_mins(start_time) in availabilities:
                duration_availabilities.append(start_time)

        start_time = increment_time_by_thirty_mins(start_time)

    return duration_availabilities
1012983
public static Collection<TimeSlot> calculateAvailableSots(Collection<TimeInterval> takenTimeSlots, Date date, int intervalSeconds,Time startTime, Time endTime)
   {
      Day day = new Day(date);
      
      Collection<TimeSlot> allTimeSlots = calculateTimeSots(day,intervalSeconds,startTime, endTime);
      
      if(takenTimeSlots == null || takenTimeSlots.isEmpty())
         return allTimeSlots;
      
      TimeSlot timeSlot = null;
      TreeSet<TimeSlot> availableSlots = new TreeSet<TimeSlot>();
      for (Iterator<TimeSlot> i = allTimeSlots.iterator(); i.hasNext();)
      {
         timeSlot =  i.next();
         
         if(!takenTimeSlots.contains(timeSlot))
         {
            availableSlots.add(timeSlot);
         }         
      }
      return availableSlots;
   }
1012200
def time_choices():
    """"""
    hours = list(range(0, 24))
    times = []
    for h in hours:
        hour = str(h).zfill(2)
        times.append(hour+':00')
        times.append(hour+':30')
    return list(zip(times, times))
16098
def GetFrequencyStopTimes(self, problems=None):
    
    stoptimes_list = [] # list of stoptime lists to be returned
    stoptime_pattern = self.GetStopTimes()
    first_secs = stoptime_pattern[0].arrival_secs # first time of the trip
    stoptime_class = self.GetGtfsFactory().StopTime
    # for each start time of a headway run
    for run_secs in self.GetFrequencyStartTimes():
      # stop time list for a headway run
      stoptimes = []
      # go through the pattern and generate stoptimes
      for st in stoptime_pattern:
        arrival_secs, departure_secs = None, None # default value if the stoptime is not timepoint
        if st.arrival_secs != None:
          arrival_secs = st.arrival_secs - first_secs + run_secs
        if st.departure_secs != None:
          departure_secs = st.departure_secs - first_secs + run_secs
        # append stoptime
        stoptimes.append(stoptime_class(problems=problems, stop=st.stop,
                                        arrival_secs=arrival_secs,
                                        departure_secs=departure_secs,
                                        stop_headsign=st.stop_headsign,
                                        pickup_type=st.pickup_type,
                                        drop_off_type=st.drop_off_type,
                                        shape_dist_traveled= \
                                            st.shape_dist_traveled,
                                        stop_sequence=st.stop_sequence,
                                        timepoint=st.timepoint))
      # add stoptimes to the stoptimes_list
      stoptimes_list.append ( stoptimes )
    return stoptimes_list
1205130
def get_min_sec_from_morning(self):
        
        mins = []
        for timerange in self.timeranges:
            mins.append(timerange.get_sec_from_morning())
        return min(mins)
1316902
def _get_history_minute_window(self, assets, end_dt, bar_count,
                                   field_to_use):
        
        # get all the minutes for this window
        try:
            minutes_for_window = self.trading_calendar.minutes_window(
                end_dt, -bar_count
            )
        except KeyError:
            self._handle_minute_history_out_of_bounds(bar_count)

        if minutes_for_window[0] < self._first_trading_minute:
            self._handle_minute_history_out_of_bounds(bar_count)

        asset_minute_data = self._get_minute_window_data(
            assets,
            field_to_use,
            minutes_for_window,
        )

        return pd.DataFrame(
            asset_minute_data,
            index=minutes_for_window,
            columns=assets
        )
142370
def handle_json_GET_boundboxstops(self, params):
    """"""
    schedule = self.server.schedule
    n = float(params.get('n'))
    e = float(params.get('e'))
    s = float(params.get('s'))
    w = float(params.get('w'))
    limit = int(params.get('limit'))
    stops = schedule.GetStopsInBoundingBox(north=n, east=e, south=s, west=w, n=limit)
    return [StopToTuple(s) for s in stops]
529241
def hours(self):
        
        if not isinstance(self.duration, tuple):
            return self.duration

        if self.duration[1] is None:
            return 0

        time_start = self.get_start_time()

        # This can happen if the previous entry has a non-tuple duration
        # and the current entry has a tuple duration without a start time
        if time_start is None:
            return 0

        now = datetime.datetime.now()
        time_start = now.replace(
            hour=time_start.hour,
            minute=time_start.minute, second=0
        )
        time_end = now.replace(
            hour=self.duration[1].hour,
            minute=self.duration[1].minute, second=0
        )
        total_time = time_end - time_start
        total_hours = total_time.seconds / 3600.0

        return total_hours