Check that the value is nonnegative.
966182
def check_nonnegative(value):
  """"""
  if isinstance(value, tf.Tensor):
    with tf.control_dependencies([tf.assert_greater_equal(value, 0)]):
      value = tf.identity(value)
  elif value < 0:
    raise ValueError("Value must be non-negative.")
  return value
561148
def filter_not_empty_values(value):
    """"""
    if not value:
        return None
    data = [x for x in value if x]
    if not data:
        return None
    return data
705425
def eq(self, value):
        
        self.op = '='
        self.negate_op = '!='
        self.value = self._value(value)
        return self
709318
def state_not_literal(self, value):
        """"""
        value = negate = chr(value)
        while value == negate:
            value = choice(self.literals)
        yield value
238745
def _check_L(self, L):
        """"""
        # TODO: Take this out?
        if issparse(L):
            L = L.todense()

        # Check for correct values, e.g. warning if in {-1,0,1}
        if np.any(L < 0):
            raise ValueError("L must have values in {0,1,...,k}.")
1295750
def positive_int(string):
    """"""
    error_msg = 'Positive integer required, {string} given.'.format(string=string)
    try:
        value = int(string)
    except ValueError:
        raise ArgumentTypeError(error_msg)
    if value < 0:
        raise ArgumentTypeError(error_msg)
    return value
1244774
def must_contain(self, value, q, strict=False):
        """"""
        if value is not None:
            if value.find(q) != -1:
                return
        self.shout('Value %r does not contain %r', strict, value, q)
1195239
def strictly_positive_int_or_none(val):
    """"""
    val = positive_int_or_none(val)
    if val is None or val > 0:
        return val
    raise ValueError('"{}" must be strictly positive'.format(val))
181578
def ask(question, no_input=False):
    """"""
    if no_input:
        return True
    else:
        input_ = input('%s [Y/n] ' % question)
        input_ = input_.strip().lower()
        if input_ in ('y', 'yes', ''):
            return True
        if input_ in ('n', 'no'):
            return False
        print('Invalid selection')
95619
def valid_value?(v)
      v.respond_to?(:nan?) && v.nan? || v.nil? ? false : true
    end
285693
public static void notNegative(Integer value) {
		if(!validation) return;
		Validate.notNull(value);
		if(value < 0)
			throw new ParameterException(ErrorCode.NEGATIVE);
	}
874146
def truthy(value):
    
    if value is None or value == '':
        return False
    value = str(value)
    try:
        return (int(value) != 0)
    except:
        pass
    return (truthy_true_yes.match(value) is not None)
1294061
public static double nonNegative(final double value, final String message) {
		if (value < 0) {
			throw new IllegalArgumentException(format(
				"%s must not be negative: %f.", message, value
			));
		}
		return value;
	}
1027655
def checkValue(self,value,strict=0):
        
        v = self._coerceValue(value,strict)
        for i in range(len(v)):
            self.checkOneValue(v[i],strict=strict)
        return v
301637
def validate(self, value):
        ''''''
        if not self.blank and value == '':
            self.error_message = 'Can not be empty.  Please provide a value.'
            return False
        self._choice = value
        return True
925998
public static void validateNonNegative(int[] data, String paramName){

        if(data == null) {
            return;
        }

        boolean nonnegative = true;

        for(int value : data){
            if(value < 0) {
                nonnegative = false;
            }
        }

        Preconditions.checkArgument(nonnegative,
                "Values for %s must be >= 0, got: %s", paramName, data);
    }
1247567
def check(self, value):
        
        if self._inclusive:
            return False if self._min <= value <= self._max else True
        else:
            return False if value > self._max or value < self._min else True