Detect if a value is acceptable to return, or should be stemmed further.
324369
function acceptable(value) {
  return vowels.test(value.charAt(0))
    ? value.length > 1
    : value.length > 2 && vowels.test(value)
}
143063
function(i,value){
           if(!value) return;
           var i = i || 1,message = "";
           while(true){
            message += value;
            if((--i) <= 0) break;
          }

          return message;
    }
175634
def validate(self, value):
        
        if isinstance(value, (str, unicode, int, long)):
            value = float(value)
        value = super(Float, self).validate(value)
        if not isinstance(value, (float)):
            raise ValueError("Not an float: %r" % (value, ))
        return value
108094
boolean allowsValue(String str, ValidationContext vc) {
    try {
      getValue(str, vc);
      return true;
    }
    catch (DatatypeException e) {
      return false;
    }
  }
216396
def has_safe_repr(value):
    """"""
    if value is None or value is NotImplemented or value is Ellipsis:
        return True
    if type(value) in (bool, int, float, complex, range_type, Markup) + string_types:
        return True
    if type(value) in (tuple, list, set, frozenset):
        for item in value:
            if not has_safe_repr(item):
                return False
        return True
    elif type(value) is dict:
        for key, value in iteritems(value):
            if not has_safe_repr(key):
                return False
            if not has_safe_repr(value):
                return False
        return True
    return False
11490
def use_value(self, value):
        """"""
        if self.check_value(value):
            return value
        return self.convert_value(value)
176086
def clean_value(self, value):
    """"""
    if self._clean_value:
      return self._clean_value(value)
    else:
      return self.reduce_value(value)
348102
function shouldUpdateValue (elm, checkVal) {
  return (!elm.composing && (
    elm.tagName === 'OPTION' ||
    isNotInFocusAndDirty(elm, checkVal) ||
    isDirtyWithModifiers(elm, checkVal)
  ))
}
1147112
def is_valid(cls, arg):
        """"""
        if not isinstance(arg, (int, long)) or isinstance(arg, bool):
            return False
        if (arg < cls._low_limit):
            return False
        if (cls._high_limit is not None) and (arg > cls._high_limit):
            return False
        return True
685305
def _limit_value(value, upper=1.0, lower=0.0):
    
    if value > upper:
        return(upper)
    if value < lower:
        return(lower)
    return value
671548
def checkValue(self,value,strict=0):
        
        v = self._coerceValue(value,strict)
        return self.checkOneValue(v,strict)
113645
def _ensure_value_is_valid(self, value):
        """"""
        if not isinstance(value, self.__class__.value_type):
            raise TypeError('{0} is not valid collection value, instance '
                            'of {1} required'.format(
                                value, self.__class__.value_type))
        return value
611520
private Boolean acceptRecursive(V value) {

    Boolean result = null;
    if (this.parent != null) {
      result = this.parent.acceptRecursive(value);
      if (result != null) {
        return result;
      }
    }
    for (FilterRule<V> rule : this.rules) {
      result = rule.accept(value);
      if (result != null) {
        return result;
      }
    }
    return result;
  }
912172
def Eq(value, message="Not equal to {!s}"):
    
    @wraps(Eq)
    def built(_value):
        if _value != value:
            raise Error(message.format(value))
        return _value
    return built
811144
def value_check(arg_name, pos, allowed_values):
    

    def decorator(fn):

        # brevity compromised in favour of readability
        def logic(*args, **kwargs):
            arg_count = len(args)
            if arg_count:
                if pos < arg_count:
                    if args[pos] in allowed_values:
                        return fn(*args, **kwargs)
                    else:
                        raise ValueError(
                            "'{0}' at position {1} not in allowed values {2}".format(args[pos], pos, allowed_values))
                else:
                    if arg_name in kwargs:
                        value = kwargs[arg_name]
                        if value in allowed_values:
                            return fn(*args, **kwargs)
                        else:
                            raise ValueError("'{0}' is not an allowed kwarg".format(arg_name))
                    else:
                        # partially applied functions because of incomplete args, let python handle this
                        return fn(*args, **kwargs)
            else:
                if arg_name in kwargs:
                    value = kwargs[arg_name]
                    if value in allowed_values:
                        return fn(*args, **kwargs)
                else:
                    raise ValueError("'{0}' is not an allowed kwarg".format(arg_name))

        return logic

    return decorator
206213
def _validate_value(self, proposal):
        ""
        try:
            return tuple(findvalue(self._options_values, i, self.equals) for i in proposal.value)
        except ValueError:
            raise TraitError('Invalid selection: value not found')
1030201
def getvalue(x):
    """"""
    if isrepeating(x):
        raise TypeError(
            "Ambiguous call to getvalue for %r which has more than one value."
            % x)

    for value in getvalues(x):
        return value