Create a new ServicePeriod object, make it the default service period and
    return it. The default service period is used when you create a trip without
    providing an explict service period.
350623
def NewDefaultServicePeriod(self):
    
    service_period = self._gtfs_factory.ServicePeriod()
    service_period.service_id = util.FindUniqueId(self.service_periods)
    # blank service won't validate in AddServicePeriodObject
    self.SetDefaultServicePeriod(service_period, validate=False)
    return service_period
328624
function (id) {
      var custom = later[id];
      if(!custom) throw new Error('Custom time period ' + id + ' not recognized!');

      add(id, custom.extent(new Date())[0], custom.extent(new Date())[1]);
      return this;
    }
405896
private Service initService(String serviceName) {
        m_logger.debug("Initializing service: " + serviceName);
        try {
            @SuppressWarnings("unchecked")
            Class<Service> serviceClass = (Class<Service>) Class.forName(serviceName);
            Method instanceMethod = serviceClass.getMethod("instance", (Class<?>[])null);
            Service instance = (Service)instanceMethod.invoke(null, (Object[])null);
            instance.initialize();
            return instance;
        } catch (Exception e) {
            throw new RuntimeException("Error initializing service: " + serviceName, e);
        }
    }
227398
private DefaultServiceDefaultsContext resolveServiceDefaults(ServiceDefaultsType serviceDefaults, RealmsContext realmsContext) {

        if (serviceDefaults == null) {
            return null;
        }

        DefaultAcceptOptionsContext acceptOptions = null;

        ServiceAcceptOptionsType serviceAcceptOptions = serviceDefaults.getAcceptOptions();
        if (serviceAcceptOptions != null) {
            acceptOptions = new DefaultAcceptOptionsContext(null, serviceAcceptOptions);
        }

        DefaultConnectOptionsContext connectOptions = null;
        ServiceConnectOptionsType serviceConnectOptions = serviceDefaults.getConnectOptions();
        if (serviceConnectOptions != null) {
            connectOptions = new DefaultConnectOptionsContext(null, serviceConnectOptions);
        }

        Map<String, String> mimeMappings = null;

        MimeMappingType[] mimeMappingTypes = serviceDefaults.getMimeMappingArray();
        if (mimeMappingTypes != null) {
            mimeMappings = new HashMap<>();
            for (MimeMappingType mmt : mimeMappingTypes) {
                mimeMappings.put(mmt.getExtension(), mmt.getMimeType());
            }
        }

        return new DefaultServiceDefaultsContext(acceptOptions, connectOptions, mimeMappings);
    }
362140
public static PeriodDuration of(Duration duration) {
        Objects.requireNonNull(duration, "The duration must not be null");
        return new PeriodDuration(Period.ZERO, duration);
    }
1262691
private Billing generateDefaultReservation() {
        Billing billing = new Billing();
        Billing.Reservation reservation = new Billing.Reservation();
        billing.setReservation(reservation);
        reservation.setReservationLength(1);
        return billing;
    }
66021
def create(self, max_wait=180, **kwargs):
        
        # Will need to wait for the service to be provisioned before can add
        # service keys and get env details.
        self.service.create(async=True, create_keys=False)
        while self._create_in_progress() and max_wait > 0:
            time.sleep(1)
            max_wait -= 1

        # Now get the service env (via service keys)
        cfg = self.service._get_service_config()
        self.service.settings.save(cfg)

        host = predix.config.get_env_key(self.use_class, 'host')
        os.environ[host] = self.service.settings.data['host']

        password = predix.config.get_env_key(self.use_class, 'password')
        os.environ[password] = self.service.settings.data['password']

        port = predix.config.get_env_key(self.use_class, 'port')
        os.environ[port] = str(self.service.settings.data['port'])
282713
def create(self):
        
        self.service.create()
        os.environ[self.__module__ + '.uri'] = self.service.settings.data['url']
        os.environ[self.__module__ + '.zone_id'] = self.get_predix_zone_id()
12659
public final void start() {
        if (!enabled) {
            return;
        }

        long periodSeconds = properties.getSeconds(PERIOD_SECONDS);
        if (periodSeconds <= 0) {
            long defaultValue = Long.parseLong(PERIOD_SECONDS.getDefaultValue());
            logger.warning("Provided client statistics " + PERIOD_SECONDS.getName()
                    + " cannot be less than or equal to 0. You provided " + periodSeconds
                    + " seconds as the configuration. Client will use the default value of " + defaultValue + " instead.");
            periodSeconds = defaultValue;
        }

        // Note that the OperatingSystemMetricSet and RuntimeMetricSet are already registered during client start,
        // hence we do not re-register
        periodicStats = new PeriodicStatistics();

        schedulePeriodicStatisticsSendTask(periodSeconds);

        logger.info("Client statistics is enabled with period " + periodSeconds + " seconds.");
    }
846232
private static ChronoUnit create(DateUnit dateUnit) {
        switch (dateUnit) {
            case YEAR:
                return ChronoUnit.YEARS;
            case MONTH:
                return ChronoUnit.MONTHS;
            case DAY:
                return ChronoUnit.DAYS;
            case HOUR:
                return ChronoUnit.HOURS;
            case MINUTE:
                return ChronoUnit.MINUTES;
            case SECOND:
                return ChronoUnit.SECONDS;
            default:
                throw new DateUtilException("没有单位：" + dateUnit);
        }
    }
830157
def make_service(self, my_args=None):
        
        LOGGER.debug("natsd.Driver.make_service")
        if my_args is None:
            raise exceptions.ArianeConfError('service factory arguments')
        if not self.configuration_OK or self.connection_args is None:
            raise exceptions.ArianeConfError('NATS connection arguments')
        service = Service.start(my_args, self.connection_args).proxy()
        self.services_registry.append(service)
        return service
473278
function createService (app, Service, Model, options) {
  Model = options.Model || Model;
  if (typeof Model === 'function') {
    assert(options.ModelName, 'createService but options.ModelName not provided');
    options.Model = Model(app, options.ModelName);
  } else {
    options.Model = Model;
  }
  const service = new Service(options);
  return service;
}
144536
function(service) {

		// If the service doesn't exist
		service = service || this.settings.default_service;

		if (!service || !(service in this.services)) {
			return null;
		}

		return this.utils.store(service) || null;
	}
300567
def routeDefault(self, request, year=None):
        """"""
        eventsView = request.GET.get('view', self.default_view)
        if eventsView in ("L", "list"):
            return self.serveUpcoming(request)
        elif eventsView in ("W", "weekly"):
            return self.serveWeek(request, year)
        else:
            return self.serveMonth(request, year)
732281
def _create_service(self, parameters={}, **kwargs):
        
        logging.debug("_create_service()")
        logging.debug(str.join(',', [self.service_name, self.plan_name,
            self.name, str(parameters)]))

        return self.service.create_service(self.service_name, self.plan_name,
                self.name, parameters, **kwargs)
750040
public static DefaultJobSpecScheduleImpl createNoSchedule(JobSpec jobSpec,
                                                            Runnable jobRunnable) {
    return new DefaultJobSpecScheduleImpl(jobSpec, jobRunnable,
                                          Optional.<Long>absent());
  }
483766
public static Interval create (RunQueue runQueue, final Runnable onExpired)
    {
        // we could probably avoid all the wacky machinations internal to Interval that do the
        // runbuddy reposting and whatever and just create a non-runqueue interval that posts the
        // supplied runnable to the runqueue when it expires, but we'll just punt on that for now
        return new Interval(runQueue) {
            @Override public void expired () {
                onExpired.run();
            }
            @Override public String toString () {
                return onExpired.toString();
            }
        };
    }