Set the maximum lease period in months.
        :param availability:
978084
def set_availability(self, availability):
        
        if availability >= 5:
            availability = '5%2B'
        self._query_params += str(QueryParam.AVALIABILITY) + str(availability)
1141780
private void writeAvailability(Project.Resources.Resource xml, Resource mpx)
   {
      AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods();
      xml.setAvailabilityPeriods(periods);
      List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
      for (Availability availability : mpx.getAvailability())
      {
         AvailabilityPeriod period = m_factory.createProjectResourcesResourceAvailabilityPeriodsAvailabilityPeriod();
         list.add(period);
         DateRange range = availability.getRange();

         period.setAvailableFrom(range.getStart());
         period.setAvailableTo(range.getEnd());
         period.setAvailableUnits(DatatypeConverter.printUnits(availability.getUnits()));
      }
   }
60489
def setDuration(self, duration):
        
        if duration < 1:
            return False
        
        self.setDateEnd(self.dateStart().addDays(duration - 1))
        return True
820692
def set_pump_status(self, status):
        
        self.pump_status = status
        _logger.info("%r partition %r", status, self.lease.partition_id)
435685
function setPeriodicalSchedule (start, end, time, timeUnit, frequency, point) {
  var periodical = {
    'start': start,
    'end': end,
    'time': time,
    'time_unit': timeUnit,
    'frequency': frequency,
    'point': point
  }
  this.trigger = JUtil.extend(this.trigger, {
    'periodical': periodical
  })
  return this
}
908376
synchronized void replaceLease(Lease newLease) {
    leases.put(newLease.getHolder(), newLease);
    sortedLeases.remove(newLease);
    sortedLeases.add(newLease);

    for (String path : newLease.paths) {
      sortedLeasesByPath.put(
        path, new LeaseOpenTime(newLease, System.currentTimeMillis()));
    }
  }
533764
private function setPeriod($period, $options)
    {
        $format  = 'Y-m-d 00:00:00';
        $obj     = new \stdClass();
        $obj->to = Carbon::now();

        switch ($period) {
            case 'lastweek':
                $obj->from = new Carbon('last week');
                break;

            case 'lastmonth':
                $obj->from = new Carbon('last month');
                break;

                // TODO
            case 'range':
                // $obj->from = new Carbon('last month');
                break;

            default:
                //TODO: get install date from generated config
                $obj->from = Carbon::createFromFormat('Y-m-d', '2014-11-11'); //Carbon::createFromDate(2014, 11, 11);
                break;
        }

        $obj->formated = $obj->from->format($format).'::'.$obj->to->format($format);

        return $obj;
    }
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;
}
800329
def set_lease(self, new_lease):
        
        if self.partition_context:
            self.partition_context.lease = new_lease
            self.partition_context.event_processor_context = new_lease.event_processor_context
64890
def set_limits(self, min_=None, max_=None):
        
        self._min, self._max = min_, max_
238097
function tryReservation(schedules, min,max) {
    var reservation = {success: false},
        resources = [], start, end;

    for(var i = 0, len = schedules.length; i < len; i++) {
      var schedule = schedules[i],
          range = schedule.range;

      if(!isInternal(schedule)) {
        resources.push(schedule.id);
      }

      start = !start || range[0] > start ? range[0] : start;
      end = !end || range[1] < end ? range[1] : end;
    }

    var duration = (end - start) / later.MIN;
    if(duration >= min || duration >= max) {
      duration = max && duration > max ? max : duration;
      reservation = createReservation(resources, start, duration);
    }

    return reservation;
  }
161404
def add_quota(self, quota):
        """"""
        if quota.limit in (None, -1, float('inf')):
            # Handle "unlimited" quotas.
            self.usages[quota.name]['quota'] = float("inf")
            self.usages[quota.name]['available'] = float("inf")
        else:
            self.usages[quota.name]['quota'] = int(quota.limit)
1130955
public function setAvailability($availability)
    {
        $allowedValues = $this->getAvailabilityAllowableValues();
        if (!in_array($availability, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'availability', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['availability'] = $availability;

        return $this;
    }
986200
def maintain_leases(self):
        
        while self._manager.is_active and not self._stop_event.is_set():
            # Determine the appropriate duration for the lease. This is
            # based off of how long previous messages have taken to ack, with
            # a sensible default and within the ranges allowed by Pub/Sub.
            p99 = self._manager.ack_histogram.percentile(99)
            _LOGGER.debug("The current p99 value is %d seconds.", p99)

            # Make a copy of the leased messages. This is needed because it's
            # possible for another thread to modify the dictionary while
            # we're iterating over it.
            leased_messages = copy.copy(self._leased_messages)

            # Drop any leases that are well beyond max lease time. This
            # ensures that in the event of a badly behaving actor, we can
            # drop messages and allow Pub/Sub to resend them.
            cutoff = time.time() - self._manager.flow_control.max_lease_duration
            to_drop = [
                requests.DropRequest(ack_id, item.size)
                for ack_id, item in six.iteritems(leased_messages)
                if item.added_time < cutoff
            ]

            if to_drop:
                _LOGGER.warning(
                    "Dropping %s items because they were leased too long.", len(to_drop)
                )
                self._manager.dispatcher.drop(to_drop)

            # Remove dropped items from our copy of the leased messages (they
            # have already been removed from the real one by
            # self._manager.drop(), which calls self.remove()).
            for item in to_drop:
                leased_messages.pop(item.ack_id)

            # Create a streaming pull request.
            # We do not actually call `modify_ack_deadline` over and over
            # because it is more efficient to make a single request.
            ack_ids = leased_messages.keys()
            if ack_ids:
                _LOGGER.debug("Renewing lease for %d ack IDs.", len(ack_ids))

                # NOTE: This may not work as expected if ``consumer.active``
                #       has changed since we checked it. An implementation
                #       without any sort of race condition would require a
                #       way for ``send_request`` to fail when the consumer
                #       is inactive.
                self._manager.dispatcher.modify_ack_deadline(
                    [requests.ModAckRequest(ack_id, p99) for ack_id in ack_ids]
                )

            # Now wait an appropriate period of time and do this again.
            #
            # We determine the appropriate period of time based on a random
            # period between 0 seconds and 90% of the lease. This use of
            # jitter (http://bit.ly/2s2ekL7) helps decrease contention in cases
            # where there are many clients.
            snooze = random.uniform(0.0, p99 * 0.9)
            _LOGGER.debug("Snoozing lease management for %f seconds.", snooze)
            self._stop_event.wait(timeout=snooze)

        _LOGGER.info("%s exiting.", _LEASE_WORKER_NAME)
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)
        )
114516
def set_schedule(self, schedule):
        
        self.Tmax = schedule['tmax']
        self.Tmin = schedule['tmin']
        self.steps = int(schedule['steps'])
        self.updates = int(schedule['updates'])
605549
@Override
    public void setPeerRecoveryLeaseTimeout(int leaseTimeout)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "setPeerRecoveryLeaseTimeout", leaseTimeout);

        // Store the Lease Timeout  
        _leaseTimeout = leaseTimeout;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "setPeerRecoveryLeaseTimeout", this);

    }