Initialize the period of BF.

        :period: datetime.datetime for setting the period explicity.
356710
def initialize_period(self, period=None):
        
        if not period:
            self.current_period = dt.datetime.now()
        else:
            self.current_period = period
        self.current_period = dt.datetime(self.current_period.year, self.current_period.month, self.current_period.day)
        self.date = self.current_period.strftime("%Y-%m-%d")
277776
def on_open(self, callback, period):
        
        super().on_open()
        self.callback = callback
        self.period = period
        self.reset_event = asyncio.Event(loop=self.loop)
962474
public function init()
    {
        parent::init();

        $this->datetimeFormat = (empty(Yii::$app->params['site']->datetimeFormat)) ? $this->datetimeFormat : Yii::$app->params['site']->datetimeFormat;
        $this->timezone = (empty(Yii::$app->params['site']->timezone)) ? $this->timezone : Yii::$app->params['site']->timezone;
    }
1240775
def activate_absence_with_period(self, endtime: datetime):
        
        data = {"endTime": endtime.strftime("%Y_%m_%d %H:%M")}
        return self._restCall(
            "home/heating/activateAbsenceWithPeriod", json.dumps(data)
        )
970609
def conflicts_with(self, period):
        ""
        if self.tba or period.tba:
            return False
        same_day = False
        for i in self.int_days:
            if i in period.int_days:
                same_day = True

        if not same_day:
            return False

        return self.start <= period.start <= self.end or \
            period.start <= self.start <= period.end or \
            self.start <= period.end <= self.end or \
            period.start <= self.end <= period.end
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.");
    }
611659
def get_period(date_from: date, date_to: date) -> str:
    
    assert isinstance(date_from, date)
    assert isinstance(date_to, date)

    str_from: str = date_from.isoformat()
    str_to: str = date_to.isoformat()

    return str_from + " - " + str_to
1249721
def get_time_period(value):
        
        for time_period in TimePeriod:
            if time_period.period == value:
                return time_period
        raise ValueError('{} is not a valid TimePeriod'.format(value))
683217
def set_plc_datetime(self, dt):
        
        type_ = c_int32
        buffer = (type_ * 9)()
        buffer[0] = dt.second
        buffer[1] = dt.minute
        buffer[2] = dt.hour
        buffer[3] = dt.day
        buffer[4] = dt.month - 1
        buffer[5] = dt.year - 1900

        return self.library.Cli_SetPlcDateTime(self.pointer, byref(buffer))
15960
@Override
    public void setPeriod(int pPeriod) {
	if (pPeriod < 0) {
	    throw new IllegalArgumentException("Period cannot be negative");
	}
	int actual = Math.max(pPeriod, MIN_PERIOD);
	log.debug("Changing clock period to {}", actual);
	period = actual;

	if (isRunning()) {
	    stop();
	    start(false);
	}
    }
1305276
public function getQuarter(): Period
    {
        $startDate = $this
            ->setTime(0, 0)
            ->setDate((int) $this->format('Y'), (intdiv((int) $this->format('n'), 3) * 3) + 1, 1);

        return new Period($startDate, $startDate->add(new DateInterval('P3M')));
    }
575104
def begin_date(self, value):
        

        if not isinstance(value, datetime):
            raise TypeError(_pretty_message(
                '''
                begin_date must be an instance of datetime.datetime, not %s
                ''',
                _type_name(value)
            ))

        self._begin_date = value
1164307
def randomize(self, period=None):
		
		if period is not None:
			self.period = period
		perm = list(range(self.period))
		perm_right = self.period - 1
		for i in list(perm):
			j = self.randint_function(0, perm_right)
			perm[i], perm[j] = perm[j], perm[i]
		self.permutation = tuple(perm) * 2
59461
function preparePeriod(period, value, year) {

    var range;
    var subUnit;
    var start;
    var length;
    var unit;

    switch (period) {
      case 'year':
        unit = 'month';
        break;
      case 'month':
        unit = 'dayOfYear';
        break;
      case 'dayOfYear':
        unit = 'hourOfYear';
        break;
    }

    var result = {
      year: year,
      period: period,
      unit: unit
    };

    var utc = moment().utc();

    if (year) {
      utc.year(year);
    } else {
      year = utc.year();
    }

    if (value || value ===0) {
      utc[period](value);
    } else {
      value = utc[period]();
    }

    result.value = value;
    result.period = period;

    switch (unit) {

      case 'month':
        switch (period) {
          case 'year':
            range = _.range(12);
            break;

          default:
        }

        subUnit = 'dayOfYear';
        break;

      case 'dayOfYear':

        switch (period) {
          case 'month':
            start = utc.month(value).date(1).dayOfYear();
            length = utc.month(value).daysInMonth();

            range = _.range(start, start + length);
            break;

          default:
        }

        subUnit = 'hourOfYear';
        break;

      case 'hourOfYear':

        switch (period) {
          case 'dayOfYear':
            start = utc.dayOfYear(value).hour(0).hourOfYear();
            length = 24;

            range = _.range(start, start + length);
            break;

          default:
        }
        break;
    }

    result.subUnit = subUnit;

    if (!range) {

      var err = new Error('Could not calculate the range');
      err.statusCode = 400;
      err.code = 'NO_RANGE_SET';

      throw err;
    }

    return {
      unit: unit,
      range: range,
      year: year,
      result: result
    };

  }
754180
public StructuredQueryBuilder.Period period(Calendar start, Calendar end) {
    return new TemporalPeriod(DatatypeConverter.printDateTime(start),
      DatatypeConverter.printDateTime(end));
  }
1327623
def setDateTimeStart(self, dtime):
        
        self._dateStart = dtime.date()
        self._timeStart = dtime.time()
        self._allDay = False
858161
def datetime_period(base=None, hours=None, minutes=None, seconds=None):
	
	
	if base is None:
		base = utcnow()
	
	base -= timedelta(
			hours = 0 if hours is None else (base.hour % hours),
			minutes = (base.minute if hours else 0) if minutes is None else (base.minute % minutes),
			seconds = (base.second if minutes or hours else 0) if seconds is None else (base.second % seconds),
			microseconds = base.microsecond
		)
	
	return base