Return a list of StopTime objects for each headway-based run.

    Returns:
      a list of list of StopTime objects. Each list of StopTime objects
      represents one run. If this trip doesn't have headways returns an empty
      list.
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
1108386
def end_time(self):
        
        resource_list = self.traffic_incident()
        end_time = namedtuple('end_time', 'end_time')
        if len(resource_list) == 1 and resource_list[0] is None:
            return None
        else:
            try:
                return [end_time(resource['end'])
                        for resource in resource_list]
            except (KeyError, TypeError):
                return [end_time(resource['EndTimeUTC'])
                        for resource in resource_list]
870283
def get_records(self):
        
        # Won't be able to find new records.
        if self.exhausted:
            return []

        # Already caught up, just the one call please.
        if self.empty_responses >= CALLS_TO_REACH_HEAD:
            return self._apply_get_records_response(self.session.get_stream_records(self.iterator_id))

        # Up to 5 calls to try and find a result
        while self.empty_responses < CALLS_TO_REACH_HEAD and not self.exhausted:
            records = self._apply_get_records_response(self.session.get_stream_records(self.iterator_id))
            if records:
                return records

        return []
482442
def runtime(self):
        
        t = time.time() - self.start
        self.start = time.time()
        return t
77602
def check_stop_times(
    feed: "Feed", *, as_df: bool = False, include_warnings: bool = False
) -> List:
    
    table = "stop_times"
    problems = []

    # Preliminary checks
    if feed.stop_times is None:
        problems.append(["error", "Missing table", table, []])
    else:
        f = feed.stop_times.copy().sort_values(["trip_id", "stop_sequence"])
        problems = check_for_required_columns(problems, table, f)
    if problems:
        return format_problems(problems, as_df=as_df)

    if include_warnings:
        problems = check_for_invalid_columns(problems, table, f)

    # Check trip_id
    problems = check_column_linked_id(
        problems, table, f, "trip_id", feed.trips
    )

    # Check arrival_time and departure_time
    v = lambda x: pd.isnull(x) or valid_time(x)
    for col in ["arrival_time", "departure_time"]:
        problems = check_column(problems, table, f, col, v)

    # Check that arrival and departure times exist for the first and last
    # stop of each trip and for each timepoint.
    # For feeds with many trips, iterating through the stop time rows is
    # faster than uisg groupby.
    if "timepoint" not in f.columns:
        f["timepoint"] = np.nan  # This will not mess up later timepoint check

    indices = []
    prev_tid = None
    prev_atime = 1
    prev_dtime = 1
    for i, tid, atime, dtime, tp in f[
        ["trip_id", "arrival_time", "departure_time", "timepoint"]
    ].itertuples():
        if tid != prev_tid:
            # Check last stop of previous trip
            if pd.isnull(prev_atime) or pd.isnull(prev_dtime):
                indices.append(i - 1)
            # Check first stop of current trip
            if pd.isnull(atime) or pd.isnull(dtime):
                indices.append(i)
        elif tp == 1 and (pd.isnull(atime) or pd.isnull(dtime)):
            # Failure at timepoint
            indices.append(i)

        prev_tid = tid
        prev_atime = atime
        prev_dtime = dtime

    if indices:
        problems.append(
            [
                "error",
                "First/last/time point arrival/departure time missing",
                table,
                indices,
            ]
        )

    # Check stop_id
    problems = check_column_linked_id(
        problems, table, f, "stop_id", feed.stops
    )

    # Check for duplicated (trip_id, stop_sequence) pairs
    cond = f[["trip_id", "stop_sequence"]].dropna().duplicated()
    problems = check_table(
        problems, table, f, cond, "Repeated pair (trip_id, stop_sequence)"
    )

    # Check stop_headsign
    problems = check_column(
        problems, table, f, "stop_headsign", valid_str, column_required=False
    )

    # Check pickup_type and drop_off_type
    for col in ["pickup_type", "drop_off_type"]:
        v = lambda x: x in range(4)
        problems = check_column(
            problems, table, f, col, v, column_required=False
        )

    # Check if shape_dist_traveled decreases on a trip
    if "shape_dist_traveled" in f.columns:
        g = f.dropna(subset=["shape_dist_traveled"])
        indices = []
        prev_tid = None
        prev_dist = -1
        for i, tid, dist in g[["trip_id", "shape_dist_traveled"]].itertuples():
            if tid == prev_tid and dist < prev_dist:
                indices.append(i)

            prev_tid = tid
            prev_dist = dist

        if indices:
            problems.append(
                [
                    "error",
                    "shape_dist_traveled decreases on a trip",
                    table,
                    indices,
                ]
            )

    # Check timepoint
    v = lambda x: x in range(2)
    problems = check_column(
        problems, table, f, "timepoint", v, column_required=False
    )

    if include_warnings:
        # Check for duplicated (trip_id, departure_time) pairs
        cond = f[["trip_id", "departure_time"]].duplicated()
        problems = check_table(
            problems,
            table,
            f,
            cond,
            "Repeated pair (trip_id, departure_time)",
            "warning",
        )

    return format_problems(problems, as_df=as_df)
20378
public List<TimeUnit> getUnits()
   {
      if (cachedUnits == null) {
         List<TimeUnit> result = new ArrayList<TimeUnit>(units.keySet());
         Collections.sort(result, new TimeUnitComparator());
         cachedUnits = Collections.unmodifiableList(result);
      }

      return cachedUnits;
   }
89352
def get_paths(self):
        
        paths = []
        for key, child in six.iteritems(self):
            if isinstance(child, TreeMap) and child:
                # current child is an intermediate node
                for path in child.get_paths():
                    path.insert(0, key)
                    paths.append(path)
            else:
                # current child is an endpoint
                paths.append([key])
        return paths
1129670
def _GetTripSequence(self, schedule=None):
    
    if schedule is None:
      schedule = getattr(self, "_schedule", None)
    if schedule is None:
      warnings.warn("No longer supported. _schedule attribute is  used to get "
                    "stop_times table", DeprecationWarning)
    cursor = schedule._connection.cursor()
    cursor.execute("SELECT trip_id,stop_sequence FROM stop_times "
                   "WHERE stop_id=?",
                   (self.stop_id, ))
    return [(schedule.GetTrip(row[0]), row[1]) for row in cursor]
1343084
def get_times():
    
    if f.root.stopped:
        return copy.deepcopy(f.root.times)
    else:
        t = timer()
        times = collapse.collapse_times()
        f.root.self_cut += timer() - t
        return times
34821
def ValidateChildren(self, problems):
    """"""
    assert self._schedule, "Trip must be in a schedule to ValidateChildren"
    # TODO: validate distance values in stop times (if applicable)

    self.ValidateNoDuplicateStopSequences(problems)
    stoptimes = self.GetStopTimes(problems)
    stoptimes.sort(key=lambda x: x.stop_sequence)
    self.ValidateTripStartAndEndTimes(problems, stoptimes)
    self.ValidateStopTimesSequenceHasIncreasingTimeAndDistance(problems,
                                                               stoptimes)
    self.ValidateShapeDistTraveledSmallerThanMaxShapeDistance(problems,
                                                              stoptimes)
    self.ValidateDistanceFromStopToShape(problems, stoptimes)
    self.ValidateFrequencies(problems)
511231
def get_trips(self, authentication_info, start, end):
        """"""
        import requests

        if (authentication_info is None or
            not authentication_info.is_valid()):
            return []

        data_url = "https://api.ritassist.nl/api/trips/GetTrips"
        query = f"?equipmentId={self.identifier}&from={start}&to={end}&extendedInfo=True"
        header = authentication_info.create_header()
        response = requests.get(data_url + query, headers=header)
        trips = response.json()

        result = []
        for trip_json in trips:
            trip = Trip(trip_json)
            result.append(trip)
        return result
712855
def all_stop_places_quays(self) -> list:
        """"""
        all_places = self.stops.copy()
        for quay in self.quays:
            all_places.append(quay)
        return all_places
310699
def get_train_stops(self, train_code, date=None):
        
        if date is None:
            date = datetime.date.today().strftime("%d %B %Y")

        url = self.api_base_url + 'getTrainMovementsXML'
        params = {
            'TrainId': train_code,
            'TrainDate': date
        }

        response = requests.get(
            url, params=params, timeout=10)

        if response.status_code != 200:
            return []

        return self._parse_train_movement_data(response.content)
553162
def getall(self):
        

        vrrps = dict()

        # Find the available interfaces
        interfaces = re.findall(r'^interface\s(\S+)', self.config, re.M)

        # Get the vrrps defined for each interface
        for interface in interfaces:
            vrrp = self.get(interface)
            # Only add those interfaces that have vrrps defined
            if vrrp:
                vrrps.update({interface: vrrp})

        return vrrps
337428
def get_blocks(self, chrom, start, end):
    
    if chrom not in self.block_trees:
      return []
    return self.block_trees[chrom].intersectingInterval(start, end)
673526
def GetCountStopTimes(self):
    """"""
    cursor = self._schedule._connection.cursor()
    cursor.execute(
        'SELECT count(*) FROM stop_times WHERE trip_id=?', (self.trip_id,))
    return cursor.fetchone()[0]
1129319
def get_event_times(self):
        
        times = []

        times.extend(self.Breaker.get_times())

        for model in self.__dict__['Event'].all_models:
            times.extend(self.__dict__[model].get_times())

        if times:
            times = sorted(list(set(times)))

        return times