Return a list of (arrival_secs, departure_secs, stop) tuples.

    Caution: arrival_secs and departure_secs may be 0, a false value meaning a
    stop at midnight or None, a false value meaning the stop is untimed.
543574
def GetTimeStops(self):
    """"""
    return [(st.arrival_secs, st.departure_secs, st.stop) for st in
            self.GetStopTimes()]
239220
def handle_json_GET_neareststops(self, params):
    """'"""
    schedule = self.server.schedule
    lat = float(params.get('lat'))
    lon = float(params.get('lon'))
    limit = int(params.get('limit'))
    stops = schedule.GetNearestStops(lat=lat, lon=lon, n=limit)
    return [StopToTuple(s) for s in stops]
651068
def get_min_sec_out_from_morning(self):
        
        mins = []
        for timerange in self.timeranges:
            mins.append(timerange.get_first_sec_out_from_morning())
        return min(mins)
1334087
def get_taf_flight_rules(lines: [dict]) -> [dict]:  # type: ignore
    
    for i, line in enumerate(lines):
        temp_vis, temp_cloud = line['visibility'], line['clouds']
        for report in reversed(lines[:i]):
            if not _is_tempo_or_prob(report['type']):
                if temp_vis == '':
                    temp_vis = report['visibility']
                if 'SKC' in report['other'] or 'CLR' in report['other']:
                    temp_cloud = 'temp-clear'
                elif temp_cloud == []:
                    temp_cloud = report['clouds']
                if temp_vis != '' and temp_cloud != []:
                    break
        if temp_cloud == 'temp-clear':
            temp_cloud = []
        line['flight_rules'] = FLIGHT_RULES[get_flight_rules(temp_vis, get_ceiling(temp_cloud))]
    return lines
958834
async def get_departures(self):
        """"""
        from .common import CommonFunctions
        common = CommonFunctions(self.loop, self.session)
        departures = []
        endpoint = '{}/StopVisit/GetDepartures/{}'.format(BASE_URL,
                                                          str(self.stopid))
        data = await common.api_call(endpoint)
        for entries in data or []:
            try:
                data = entries['MonitoredVehicleJourney']
                if self.destination is not None:
                    if data['DestinationName'] == self.destination:
                        data = entries['MonitoredVehicleJourney']
                        line = data['LineRef']
                        destinationname = data['DestinationName']
                        monitored = data['MonitoredCall']
                        time = monitored['ExpectedDepartureTime']
                        departures.append({"time": time,
                                           "line": line,
                                           "destination": destinationname})
                else:
                    data = entries['MonitoredVehicleJourney']
                    line = data['LineRef']
                    destinationname = data['DestinationName']
                    monitored = data['MonitoredCall']
                    time = monitored['ExpectedDepartureTime']
                    departures.append({"time": time,
                                       "line": line,
                                       "destination": destinationname})
            except (TypeError, KeyError, IndexError) as error:
                LOGGER.error('Error connecting to Ruter, %s', error)
        self._departures = await common.sort_data(departures, 'time')
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(":");
	}
642734
def parseEvent(self, result, i):
        """"""
        fmt = '%Y-%m-%dT%H:%M:%SZ'
        due = 0
        delay = 0
        real_time = 'n'
        number = result['stopEvents'][i]['transportation']['number']
        planned = datetime.strptime(result['stopEvents'][i]
            ['departureTimePlanned'], fmt)
        destination = result['stopEvents'][i]['transportation']['destination']['name']
        mode = self.get_mode(result['stopEvents'][i]['transportation']['product']['class'])
        estimated = planned
        if 'isRealtimeControlled' in result['stopEvents'][i]:
            real_time = 'y'
            estimated = datetime.strptime(result['stopEvents'][i]
                ['departureTimeEstimated'], fmt)
        # Only deal with future leave times
        if estimated > datetime.utcnow():
            due = self.get_due(estimated)
            delay = self.get_delay(planned, estimated)
            return[
                number,
                due,
                delay,
                planned,
                estimated,
                real_time,
                destination,
                mode
                ]
        else:
            return None
426681
def get_actual(cls, trip_list, time):
        
        for trip in trip_list:
            if simple_time(trip.departure_time_planned) == time:
                return trip
        return None
522536
def _pass_list(self) -> List[Dict[str, Any]]:
        """"""
        stops: List[Dict[str, Any]] = []
        for stop in self.journey.PassList.BasicStop:
            index = stop.get("index")
            station = stop.Location.Station.HafasName.Text.text
            station_id = stop.Location.Station.ExternalId.text
            stops.append({"index": index, "stationId": station_id, "station": station})
        return stops
893603
def stops(self):
    """"""
    serves = set()
    for trip in self.trips():
      for stop_time in trip.stop_times():
        serves |= stop_time.stops()
    return serves
1159943
function getAvailabilitiesForDuration(duration, availabilities) {
    const durationAvailabilities = [];
    let startTime = '10:00';
    while (startTime !== '17:00') {
        if (availabilities.indexOf(startTime) !== -1) {
            if (duration === 30) {
                durationAvailabilities.push(startTime);
            } else if (availabilities.indexOf(incrementTimeByThirtyMins(startTime)) !== -1) {
                durationAvailabilities.push(startTime);
            }
        }
        startTime = incrementTimeByThirtyMins(startTime);
    }
    return durationAvailabilities;
}
84413
def moments(self):
        """"""
        timepoints = self.ma.delays
        response = self.response
        moment1 = statstools.calc_mean_time(timepoints, response)
        moment2 = statstools.calc_mean_time_deviation(
            timepoints, response, moment1)
        return numpy.array([moment1, moment2])
1297622
def _GetTripIndex(self, schedule=None):
    
    trip_index = []
    for trip, sequence in self._GetTripSequence(schedule):
      for index, st in enumerate(trip.GetStopTimes()):
        if st.stop_sequence == sequence:
          trip_index.append((trip, index))
          break
      else:
        raise RuntimeError("stop_sequence %d not found in trip_id %s" %
                           sequence, trip.trip_id)
    return trip_index
1205130
def get_min_sec_from_morning(self):
        
        mins = []
        for timerange in self.timeranges:
            mins.append(timerange.get_sec_from_morning())
        return min(mins)
1267144
def time_stops(self):
        

        if not self.supports_time:
            return []

        if self.service.calendar == 'standard':
            units = self.service.time_interval_units
            interval = self.service.time_interval
            steps = [self.time_start]

            if units in ('years', 'decades', 'centuries'):
                if units == 'years':
                    years = interval
                elif units == 'decades':
                    years = 10 * interval
                else:
                    years = 100 * interval

                next_value = lambda x: x.replace(year=x.year + years)
            elif units == 'months':
                def _fn(x):
                    year = x.year + (x.month+interval-1) // 12
                    month = (x.month+interval) % 12 or 12
                    day = min(x.day, calendar.monthrange(year, month)[1])

                    return x.replace(year=year, month=month, day=day)
                next_value = _fn
            else:
                if units == 'milliseconds':
                    delta = timedelta(milliseconds=interval)
                elif units == 'seconds':
                    delta = timedelta(seconds=interval)
                elif units == 'minutes':
                    delta = timedelta(minutes=interval)
                elif units == 'hours':
                    delta = timedelta(hours=interval)
                elif units == 'days':
                    delta = timedelta(days=interval)
                elif units == 'weeks':
                    delta = timedelta(weeks=interval)
                else:
                    raise ValidationError(
                        "Service has an invalid time_interval_units: {}".format(self.service.time_interval_units)
                    )

                next_value = lambda x: x + delta

            while steps[-1] < self.time_end:
                value = next_value(steps[-1])
                if value > self.time_end:
                    break
                steps.append(value)
            return steps

        else:
            # TODO
            raise NotImplementedError
1302516
def _get_business_hours_by_sec(self):
        
        if self._get_daytime_flag:
            # create dummy datetime to calculate businesshours in a day
            dtstart = datetime(2014, 4, 1, self.start.hour, self.start.minute)
            until = datetime(2014, 4, 1, self.end.hour, self.end.minute)
            return (until - dtstart).total_seconds()
        else:
            dtstart = datetime(2014, 4, 1, self.start.hour, self.start.minute)
            until = datetime(2014, 4, 2, self.end.hour, self.end.minute)
            return (until - dtstart).total_seconds()
1207389
def _validate_time_range(trange, status, msg):
    '''
    
    '''
    # If trange is empty, just return the current status & msg
    if not trange:
        return status, msg

    if not isinstance(trange, dict):
        status = False
        msg = ('The time_range parameter for '
               'wtmp beacon must '
               'be a dictionary.')

    if not all(k in trange for k in ('start', 'end')):
        status = False
        msg = ('The time_range parameter for '
               'wtmp beacon must contain '
               'start & end options.')

    return status, msg