Returns all trains that are due to start in the next 10 minutes
        @param train_type: ['mainline', 'suburban', 'dart']
13668
def get_all_current_trains(self, train_type=None, direction=None):
        
        params = None
        if train_type:
            url = self.api_base_url + 'getCurrentTrainsXML_WithTrainType'
            params = {
                'TrainType': STATION_TYPE_TO_CODE_DICT[train_type]
            }
        else:
            url = self.api_base_url + 'getCurrentTrainsXML'

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

        if response.status_code != 200:
            return []

        trains = self._parse_all_train_data(response.content)

        if direction is not None:
            return self._prune_trains(trains, direction=direction)

        return trains
1173283
def get_load_times(self, asset_type):
        
        load_times = []
        search_str = '{0}_load_time'.format(asset_type)
        for har_page in self.pages:
            val = getattr(har_page, search_str, None)
            if val is not None:
                load_times.append(val)
        return load_times
900981
def suppression_get(suppression_type, start_time:, end_time:, limit: 100, offset: 0)
      unless SUPPRESSION_TYPES.include?(suppression_type.to_s)
        # 警告のみ
        Rails.logger.error("Unknown suppresssion type '#{suppression_type}'")
      end

      params = {
        start_time: start_time.to_i,
        end_time: end_time.to_i,
        limit: limit,
        offset: offset,
      }
      res = client.suppression._(suppression_type).get(query_params: params)
      @last_response = Response.new(res)
    end
33675
def getTimeOfClassesRemaining(self,numClasses=0):
        '''
        
        '''
        occurrences = EventOccurrence.objects.filter(
            cancelled=False,
            event__in=[x.event for x in self.temporaryeventregistration_set.filter(event__series__isnull=False)],
        ).order_by('-endTime')
        if occurrences.count() > numClasses:
            return occurrences[numClasses].endTime
        else:
            return occurrences.last().startTime
112097
def next(pointer)
      super

      half_day = 60 * 60 * 12
      full_day = 60 * 60 * 24

      first = false

      unless @current_time
        first = true
        midnight = Chronic.time_class.local(@now.year, @now.month, @now.day)

        yesterday_midnight = midnight - full_day
        tomorrow_midnight = midnight + full_day

        offset_fix = midnight.gmt_offset - tomorrow_midnight.gmt_offset
        tomorrow_midnight += offset_fix

        catch :done do
          if pointer == :future
            if @type.ambiguous?
              [midnight + @type.time + offset_fix, midnight + half_day + @type.time + offset_fix, tomorrow_midnight + @type.time].each do |t|
                (@current_time = t; throw :done) if t >= @now
              end
            else
              [midnight + @type.time + offset_fix, tomorrow_midnight + @type.time].each do |t|
                (@current_time = t; throw :done) if t >= @now
              end
            end
          else # pointer == :past
            if @type.ambiguous?
              [midnight + half_day + @type.time + offset_fix, midnight + @type.time + offset_fix, yesterday_midnight + @type.time + half_day].each do |t|
                (@current_time = t; throw :done) if t <= @now
              end
            else
              [midnight + @type.time + offset_fix, yesterday_midnight + @type.time].each do |t|
                (@current_time = t; throw :done) if t <= @now
              end
            end
          end
        end

        @current_time || raise("Current time cannot be nil at this point")
      end

      unless first
        increment = @type.ambiguous? ? half_day : full_day
        @current_time += pointer == :future ? increment : -increment
      end

      Span.new(@current_time, @current_time + width)
    end
1113510
def sort_classes(timetable, classes)
      classes.each do |c|
        if !(cmodule = timetable.module_for_code(c.code))
          cmodule = Tableau::Module.new(c.code)
          timetable.push_module(cmodule)
        end

        cmodule.add_class(c)
      end
    end
19465
def all_build_trains(app_id: nil, platform: 'ios')
      platform = 'ios' if platform.nil?
      r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=#{platform}")
      handle_itc_response(r.body)
    end
477283
def get_event_ticket_classes(self, id, **data):
        
        
        return self.get("/events/{0}/ticket_classes/".format(id), data=data)
429428
def on_train_begin(self, **kwargs:Any)->None:
        ""
        self.best = float('inf') if self.operator == np.less else -float('inf')
543574
def GetTimeStops(self):
    """"""
    return [(st.arrival_secs, st.departure_secs, st.stop) for st in
            self.GetStopTimes()]
611171
def ttl(self, steps, relative_time=None):
    '''
    
    '''
    if steps:
      if relative_time:
        rtime = self.to_bucket(relative_time)
        ntime = self.to_bucket(time.time())
        # The relative time is beyond our TTL cutoff
        if (ntime - rtime) > steps:
          return 0
        # The relative time is in "recent" past or future
        else:
          return (steps + rtime - ntime) * self._step
      return steps * self._step

    return None
295540
def on_train_begin(self, epoch:int, **kwargs:Any)->None:
        ""
        res = {'epoch':self.start_epoch} if self.start_epoch is not None else None
        self.start_epoch = ifnone(self.start_epoch, epoch)
        self.scheds = [p.scheds for p in self.phases]
        self.opt = self.learn.opt
        for k,v in self.scheds[0].items(): 
            v.restart()
            self.opt.set_stat(k, v.start)
        self.idx_s = 0
        return res
1344085
def delay(self):
        
        delay = {'departure_time': None, 'departure_delay': None, 'requested_differs': None,
                'remarks': self.trip_remarks, 'parts': []}
        if self.departure_time_actual > self.departure_time_planned:
            delay['departure_delay'] = self.departure_time_actual - self.departure_time_planned
            delay['departure_time'] = self.departure_time_actual
        if self.requested_time != self.departure_time_actual:
            delay['requested_differs'] = self.departure_time_actual
        for part in self.trip_parts:
            if part.has_delay:
                delay['parts'].append(part)
        return delay
858231
def on_train_begin(self, pbar:PBar, metrics_names:Collection[str], **kwargs:Any)->None:
        ""
        self.pbar = pbar
        self.names = ['epoch', 'train_loss'] if self.no_val else ['epoch', 'train_loss', 'valid_loss']
        self.metrics_names = metrics_names
        self.names += self.metrics_names
        if hasattr(self, '_added_met_names'): self.names += self._added_met_names
        if self.add_time: self.names.append('time')
        if not self.silent: self.pbar.write(self.names, table=True)
        self.losses,self.val_losses,self.lrs,self.moms,self.metrics,self.nb_batches = [],[],[],[],[],[]
916584
def type_has_good_TimeMS(self, type):
        ''''''
        if type.startswith('ACC'):
            return False;
        if type.startswith('GYR'):
            return False;
        return True
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]
1064304
def get_upcoming_events_within_the_current_week(self):
        ''''''
        now = datetime.now(tz=self.timezone) # timezone?
        start_time = datetime(year=now.year, month=now.month, day=now.day, hour=now.hour, minute=now.minute, second=now.second, tzinfo=self.timezone)
        end_time = start_time + timedelta(days = 6 - now.weekday())
        end_time = datetime(year = end_time.year, month = end_time.month, day = end_time.day, hour=23, minute=59, second=59, tzinfo=self.timezone)
        assert(end_time.weekday() == 6)
        start_time = start_time.isoformat()
        end_time = end_time.isoformat()
        return self.get_events(start_time, end_time)