Given a check, return the default value for the check
        (converted to the right type).

        If the check doesn't specify a default value then a
        ``KeyError`` will be raised.
483924
def get_default_value(self, check):
        
        fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check)
        if default is None:
            raise KeyError('Check "%s" has no default value.' % check)
        value = self._handle_none(default)
        if value is None:
            return value
        return self._check_value(value, fun_name, fun_args, fun_kwargs)
811100
def defvalkey(js, key, default=None, take_none=True):
    
    if js is None:
        return default
    if key not in js:
        return default
    if js[key] is None and not take_none:
        return default
    return js[key]
1366999
def get_flag_value(self, name, default):  # pylint: disable=invalid-name
    

    value = self.__getattr__(name)
    if value is not None:  # Can't do if not value, b/c value might be '0' or ""
      return value
    else:
      return default
252053
def setdefault (self, key, def_val=None):
        """"""
        if key in self:
            return self[key]
        self[key] = def_val
        return def_val
77512
def checked(self, value):
        

        if value is not None:
            assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("checked", value)
        self.set_checked(value)
587140
def get(self, key, default=None):
        
        try:
            return self[key]
        except KeyError:
            return default or self._default
1225645
function default_value() {
  start_pos = input.pointer();
  value = parse_balanced(/\[/, /\]/, /[^\[\]]*/);
  if (look(/\]/)) {
    return value;
  }
  else {
    input.setPointer(start_pos);
    return match(/[^\]]*/);
  }
}
713719
def _ValidateValue(value, type_check):
  """"""
  if inspect.isclass(type_check):
    return isinstance(value, type_check)
  if isinstance(type_check, tuple):
    return _ValidateTuple(value, type_check)
  elif callable(type_check):
    return type_check(value)
  else:
    raise TypeError("Invalid type check '%s'" % repr(type_check))
112827
def first_value_of(self, name, default_value = None):
        
        vals = self.values_of(name)
        if vals is not None:
            return vals if type(vals) is not list else vals[0]
        return default_value
702455
def to_int(value, default=0):
    
    try:
        return int(value)
    except (TypeError, ValueError):
        return to_int(default, default=0)
1121179
def get_int(value, default, test_fn=None):
    
    try:
        converted = int(value)
    except ValueError:
        return default

    test_fn = test_fn if test_fn else lambda x: True
    return converted if test_fn(converted) else default
903780
def check_return_type(value, cllable = None, clss = None, caller_level = 0):
    
    return _check_caller_type(True, cllable, value, clss, caller_level+1)
1026053
def get_default(self, ctx):
        """"""
        # Otherwise go with the regular default.
        if callable(self.default):
            rv = self.default()
        else:
            rv = self.default
        return self.type_cast_value(ctx, rv)
810782
def _default(self):
        
        if self.ctx.ignore_default:
            if not self.ctx.ignore_missing:
                self.ctx.errors.missing()
            return NOT_SET
        if self.default is NOT_SET:
            if not self.ctx.ignore_missing:
                self.ctx.errors.missing()
            return NOT_SET
        if self.default in IGNORE:
            return self.default
        if isinstance(self.default, Hook):
            if self.default:
                return self.default()
            if not self.ctx.ignore_missing:
                self.ctx.errors.missing()
            return NOT_SET
        if isinstance(self.default, type) or callable(self.default):
            return self.default()
        return self.default
157493
def setdefault(self, key, value):
        
        with self.lock:
            if key in self:
                return self.getitem(key)

            else:
                self.setitem(key, value)
                return value
563133
def default_value(self):
        
        if self.has_default:
            if hasattr(self.default, '__call__'):
                return self.default()
            else:
                return self.default
        else:
            raise Exception("No default value specified")
900566
def get_or_save_default(self, key, default_value):
        
        val = self.get_or_none(key)
        if val is None:
            self.update(key, default_value)
            val = default_value
        return val