Verifies the value is between 1 and 9 inclusively.
184434
def fan_speed(self, value):
        """"""
        if value not in range(1, 10):
            raise exceptions.RoasterValueError

        self._fan_speed.value = value
1341373
public static boolean isBitOn(int value, int bitNumber) {
    if (bitNumber <= 0 || bitNumber > 8) {
      throw new IllegalArgumentException("Only bits 1 through 8 are supported");
    }

    return ((value & MASKS[bitNumber - 1]) == MASKS[bitNumber - 1]);
  }
396859
private function validateLowerThan(): bool
    {
        if ($this->options['max'] !== null) {
            if ($this->options['inclusive'] === false && $this->value >= $this->options['max']) {
                $this->setError(self::VALIDATOR_ERROR_NUMBER_MUST_BE_LOWER_THAN_MAX);
                return false;
            }

            if ($this->value > $this->options['max']) {
                $this->setError(self::VALIDATOR_ERROR_NUMBER_MUST_BE_LOWER_OR_EQUAL_TO_MAX);
                return false;
            }
        }
        return true;
    }
715117
def ok(self):
        
        try:
            v = int(self._value)
            if v < 0:
                return False
            else:
                return True
        except:
            return False
614076
def is_one(self):
        
        return all(abs(v - 1.) < pmf.PRECISION for v in self.dic.values())
396729
function checkDifficulty(value) {
    var v = bignumber_1.bigNumberify(value);
    try {
        return v.toNumber();
    }
    catch (error) { }
    return null;
}
1313899
def __CheckValid(self, value):
        ""
        val = self.__val
        self.is_valid = True
        try:
            val = set_float(value)
            if self.__min is not None and (val < self.__min):
                self.is_valid = False
                val = self.__min
            if self.__max is not None and (val > self.__max):
                self.is_valid = False
                val = self.__max
        except:
            self.is_valid = False
        self.__bound_val = self.__val = val
        fgcol, bgcol = self.fgcol_valid, self.bgcol_valid
        if not self.is_valid:
            fgcol, bgcol = self.fgcol_invalid, self.bgcol_invalid

        self.SetForegroundColour(fgcol)
        self.SetBackgroundColour(bgcol)
        self.Refresh()
222061
def _is_numeric(self, values):
        """"""
        if len(values) > 0:
            assert isinstance(values[0], (float, int)), \
                "values must be numbers to perform math operations. Got {}".format(
                    type(values[0]))
        return True
215026
def Validate(self, win):
        """"""

        val = self.GetWindow().GetValue()

        for x in val:
            if x not in string.digits:
                return False

        return True
919979
private void verifyNumber(Number value, Number minimum, Number maximum) {

    if (minimum != null) {
      if (maximum != null) {
        assert ((value.doubleValue() >= minimum.doubleValue()) || (value.doubleValue() <= maximum.doubleValue()));
      } else {
        assert (value.doubleValue() >= minimum.doubleValue());
      }
    } else if (maximum != null) {
      assert (value.doubleValue() <= maximum.doubleValue());
    } else {
      throw new NlsNullPointerException("minimum & maximum");
    }
  }
758071
def validate_SUMTO(in_value, restriction):
    
    #Sometimes restriction values can accidentally be put in the template <item>100</items>,
    #Making them a list, not a number. Rather than blowing up, just get value 1 from the list.
    if type(restriction) is list:
        restriction = restriction[0]

    value = _get_val(in_value, full=True)

    if len(value) == 0:
        return

    flat_list = _flatten_value(value)

    try:
        sum(flat_list)
    except:
        raise ValidationError("List cannot be summed: %s"%(flat_list,))

    if sum(flat_list) != restriction:
        raise ValidationError("SUMTO: %s"%(restriction))
926231
private boolean isNoOfDigitsInvalid() {
        final double AVAILABLE_WIDTH = width - 2 - valueOffsetLeft - valueOffsetRight;
        final double NEEDED_WIDTH    = valueText.getLayoutBounds().getWidth();
        return Double.compare(AVAILABLE_WIDTH, NEEDED_WIDTH) < 0;
    }
905815
private function validateNip(): bool
    {
        if (!\preg_match('/^[0-9]{10}$/', $this->value)) {
            $this->setError(self::VALIDATOR_ERROR_NIP_INCORRECT_FORMAT);
            return false;
        }

        $checksum = 0;
        $weightArray = [6, 5, 7, 2, 3, 4, 5, 6, 7];

        for ($i = 0; $i < 9; $i++) {
            $checksum += $weightArray[$i] * $this->value[$i];
        }
        $isValid = $checksum % 11 == $this->value[9] ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_NIP_INVALID_NUMBER);
        }

        return $isValid;
    }
1106476
private double checkThreshold(int value) {
    double threshold = (double) value;
    try {
      if (threshold < 0 || threshold > 100) {
        throw new NumberFormatException();
      }
      LOG.info("Using a threshold of " + threshold);
    } catch (NumberFormatException e) {
      System.err.println("Expect a double parameter in the range of [0, 100]: "
          + value);
      throw e;
    }
    return threshold;
  }
132892
def is_numeric(self, value, strict=False):
        """"""
        value = stringify(value)
        if value is not None:
            if value.isnumeric():
                return
        self.shout('value %r is not numeric', strict, value)
1282520
function canParse() {
        return !/^[0-9]+$/.test(val) &&
            (is_1.isString(val) && /[0-9]/g.test(val) &&
                /(\.|\/|-|:)/g.test(val));
    }
1074378
def chk_fraction_digits_arg(s):
    """"""
    try:
        v = int(s)
        if v >= 1 and v <= 18:
            return True
        else:
            return False
    except ValueError:
        return False