In case of uncertainty (times not specified), we assume that we are in a valid range.
184806
def _before_valid_time_range(self):
        
        if self.start_time is not None:
            try:
                if self.time < self.start_time:
                    return True
            except TypeError:
                return False
        return False
67547
def valid_representation?(date, time)
      year, month, day = date
      hour = time.first

      date.nil? || !(!year.nil? && (month.nil? || day.nil?) && !hour.nil?)
    end
793384
def check_valid_ad_range(date):
    
    if date < values.START_EN_DATE or date > values.END_EN_DATE:
        raise ValueError("Date out of range")
    return True
149932
def allows(self):
        '''
        

        '''
        tick = time.time()
        passed = tick - self.lasttick

        self.allowance = min(self.rate, self.allowance + (passed * self.persec))

        self.lasttick = tick

        if self.allowance < 1.0:
            return False

        self.allowance -= 1.0
        return True
309911
def isValid(self):
        
        return self.isOutOfDate() is False \
            and self.isQCValid() is True \
            and self.getDisposeUntilNextCalibrationTest() is False \
            and self.isValidationInProgress() is False \
            and self.isCalibrationInProgress() is False
1318949
private void validateMetricRange(DateTime from, DateTime to) throws InvalidMetricCriteriaException {
        if (from.isAfter(to)) {
            throw ExceptionFactory.invalidMetricCriteriaException(Messages.i18n.format("OrganizationResourceImpl.InvalidMetricDateRange")); //$NON-NLS-1$
        }
    }
978793
def is_correct(self):
        
        valid = True
        # We do not want a same hg to be explode again and again
        # so we tag it
        for timeperiod in list(self.items.values()):
            timeperiod.rec_tag = False

        for timeperiod in list(self.items.values()):
            for tmp_tp in list(self.items.values()):
                tmp_tp.rec_tag = False
            valid = timeperiod.check_exclude_rec() and valid

        # We clean the tags and collect the warning/erro messages
        for timeperiod in list(self.items.values()):
            del timeperiod.rec_tag

            # Now other checks
            if not timeperiod.is_correct():
                valid = False
                source = getattr(timeperiod, 'imported_from', "unknown source")
                msg = "Configuration in %s::%s is incorrect; from: %s" % (
                    timeperiod.my_type, timeperiod.get_name(), source
                )
                self.add_error(msg)

            self.configuration_errors += timeperiod.configuration_errors
            self.configuration_warnings += timeperiod.configuration_warnings

        # And check all timeperiods for correct (sunday is false)
        for timeperiod in self:
            valid = timeperiod.is_correct() and valid

        return valid
1099155
def _value_validate(self, value, rnge, identifier="Given"):
        
        if value is not None and (value < rnge[0] or value > rnge[1]):
            raise ValueError('%s value must be between %d and %d.'
                             % (identifier, rnge[0], rnge[1]))
24103
public void validate() {
    if (interval == null || interval.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty interval");
    }
    DateTime.parseDuration(interval);
    
    if (aggregator == null || aggregator.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty aggregator");
    }
    try {
      Aggregators.get(aggregator.toLowerCase());
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Invalid aggregator");
    }
    
    if (fill_policy != null) {
      fill_policy.validate();
    }
  }
667478
def _in_bounds(prop, instance, value):
    """"""
    if (
            (prop.min is not None and value < prop.min) or
            (prop.max is not None and value > prop.max)
    ):
        prop.error(instance, value, extra='Not within allowed range.')
671438
def is_valid_interval(edtf_candidate):
    """"""

    # resolve interval into from / to datetime objects
    from_date = None
    to_date = None
    # initialize interval flags for special cases, assume positive
    end, start = 'pos', 'pos'
    if edtf_candidate.count('/') == 1:
        # replace all 'problem' cases (unspecified, 0000 date, ?~, -, y)
        # break the interval into two date strings
        edtf_candidate = replace_all(edtf_candidate, interval_replacements)
        edtf_candidate = re.sub(U_PATTERN, replace_u, edtf_candidate)
        parts = edtf_candidate.split('/')
        # set flag for negative start date
        if parts[0].startswith("-"):
            start = 'neg'
            parts[0] = parts[0][1:]
        # set flag for negative end date
        if parts[1].startswith("-"):
            end = 'neg'
            parts[1] = parts[1][1:]
        # if starts positive and ends negative, that's always False
        if start == 'pos' and end == 'neg':
            return False
        # handle special case of 0000 year
        if parts[0].startswith("0000") or parts[1].startswith("0000"):
            return zero_year_special_case(parts[0], parts[1], start, end)
        # 2 '-' characters means we are matching year-month-day
        if parts[0].count("-") == 2:
            from_date = datetime.datetime.strptime(parts[0], "%Y-%m-%d")
        if parts[1].count("-") == 2:
            to_date = datetime.datetime.strptime(parts[1], "%Y-%m-%d")
        # 1 '-' character means we are match year-month
        if parts[0].count("-") == 1:
            from_date = datetime.datetime.strptime(parts[0], "%Y-%m")
        if parts[1].count("-") == 1:
            to_date = datetime.datetime.strptime(parts[1], "%Y-%m")
        # zero '-' characters means we are matching a year
        if parts[0].count("-") == 0:
            # if from_date is unknown, we can assume the lowest possible date
            if parts[0] == 'unknown':
                from_date = datetime.datetime.strptime("0001", "%Y")
            else:
                from_date = datetime.datetime.strptime(parts[0], "%Y")
        if parts[1].count("-") == 0:
            # when the to_date is open and the from_date is valid, it's valid
            if parts[1] == 'open' or parts[1] == 'unknown':
                to_date = 'open'
            else:
                to_date = datetime.datetime.strptime(parts[1], "%Y")
        # if it starts negative and ends positive, that's always True
        if start == 'neg' and end == 'pos':
            return True
        # if start and end are negative, the from_date must be >= to_date
        elif start == 'neg' and end == 'neg':
            if from_date >= to_date and from_date and to_date:
                return True
        # if the to_date is unknown or open, it could be any date, therefore
        elif (
            parts[1] == 'unknown' or
            parts[1] == 'open' or
            parts[0] == 'unknown'
        ):
            return True
        # if start and end are positive, the from_date must be <= to_date
        elif start == 'pos' and end == 'pos':
            if from_date <= to_date and from_date and to_date:
                return True
        else:
            return False
    else:
        return False
484138
protected function validateRanges()
    {
        if (!$this->isStartTimeValid()) {
            $message = sprintf(
                Swat::_(
                    'The time you have entered is invalid. ' .
                        'It must be on or after %s.'
                ),
                $this->getFormattedTime($this->valid_range_start)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        } elseif (!$this->isEndTimeValid()) {
            $message = sprintf(
                Swat::_(
                    'The time you have entered is invalid. ' .
                        'It must be on or before %s.'
                ),
                $this->getFormattedTime($this->valid_range_end)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        }
    }
1262416
private boolean inRange() {
        if (m_working == null || m_nextOut == null) {
            return false;
        }

        Timestamp rangeUpper = m_nextOut.getTimestamp();
        Timestamp rangeLower = m_nextOut.getTimestamp().minus(m_resolution);

        return m_working.getTimestamp().lte(rangeUpper) && m_working.getTimestamp().gt(rangeLower);
    }
890882
def is_correct(self):
        
        valid = self.day in Daterange.weekdays
        if not valid:
            logger.error("Error: %s is not a valid day", self.day)
        # Check also if Daterange is correct.
        valid &= super(StandardDaterange, self).is_correct()
        return valid
47893
def is_valid(self):
        
        valid = np.any((self.points - self.points[0]) != 0)
        return valid
730713
def _check_validity(self, i, j, height, width):
        
        return all(self._check_cell_validity(ii, jj) for ii in range(i, i+height) for jj in range(j, j+width))
196241
protected function isEndDateValid()
    {
        $this->valid_range_end->setTZById('UTC');
        return SwatDate::compare($this->value, $this->valid_range_end, true) <
            0;
    }