Sets all defaults for the given dictionary to those contained in a
  second defaults dictionary.  This convenience method calls:

    d.setdefault(key, value)

  for each key and value in the given defaults dictionary.
767813
def setDictDefaults (d, defaults):
  
  for key, val in defaults.items():
    d.setdefault(key, val)

  return d
716376
def add_defaults_to_kwargs(defaults, **kwargs):
    
    defaults = dict(defaults)
    defaults.update(kwargs)
    return defaults
1143082
def set_dict_none_default(dict_item, default_value):
    
    for (k, v) in iteritems(dict_item):
        if v is None:
            dict_item[k] = default_value
1004715
def set_defaults(defaults, kwargs):
    
    for key, value in defaults.items():
        if key not in kwargs and value is not None:
            kwargs[key] = value
        elif isinstance(value, list) and isinstance(kwargs[key], list):
            kwargs[key] = list(value) + kwargs[key]
        elif isinstance(value, dict) and isinstance(kwargs[key], dict):
            set_defaults(value, kwargs[key])
        elif key in kwargs and value is None:
            kwargs[key] = None
866112
def set_default(self, default):
        
        # Find index of choice
        try:
            default_index = self._parameter.default_values.index(default)
            self.default_input_button_group.button(default_index).setChecked(
                True)
        except ValueError:
            last_index = len(self._parameter.default_values) - 1
            self.default_input_button_group.button(last_index).setChecked(
                True)
            self.custom_value.setValue(default)

        self.toggle_custom_value()
537684
@Override
    protected void setDefaults(Map<String, Object> values) {
        super.setDefaults(values);
        values.put(LINES_COUNT_KEY, DEFAULT_NR_OF_LINES_TO_BE_READ);
    }
1373619
def _set_pk(self, value):
        
        if self._pk:
            raise ImplementationError('Something wrong happened, the PK was already set !')
        self._pk = value
        self._connected = True
        # Default must be set only at first initialization
        self._set_defaults()
719411
def apply_dict_default(dictionary, arg, default):
    '''
    
    '''
    if arg not in dictionary:
        if hasattr(default, '__call__'):
            # Don't try/catch because the method could raise a TypeError and we'd hide it
            default = restrict_args(default, arg)
        dictionary[arg] = default
    return dictionary
1297404
function assignDefaults(defaults, options) {
  var keys = Object.keys(defaults),
      i = keys.length,
      k;

  options = options || {};

  while (i--) {
    k = keys[i];
    if (!(k in options)) {
      options[k] = defaults[k];
    }
  }

  return options;
}
1161524
def update_defaults(self, defaults):
        
        # Then go and look for the other sources of configuration:
        config = {}
        # 1. config files
        config.update(dict(self.get_config_section('virtualenv')))
        # 2. environmental variables
        config.update(dict(self.get_environ_vars()))
        # Then set the options with those values
        for key, val in config.items():
            key = key.replace('_', '-')
            if not key.startswith('--'):
                key = '--%s' % key  # only prefer long opts
            option = self.get_option(key)
            if option is not None:
                # ignore empty values
                if not val:
                    continue
                # handle multiline configs
                if option.action == 'append':
                    val = val.split()
                else:
                    option.nargs = 1
                if option.action == 'store_false':
                    val = not strtobool(val)
                elif option.action in ('store_true', 'count'):
                    val = strtobool(val)
                try:
                    val = option.convert_value(key, val)
                except optparse.OptionValueError:
                    e = sys.exc_info()[1]
                    print("An error occured during configuration: %s" % e)
                    sys.exit(3)
                defaults[option.dest] = val
        return defaults
157493
def setdefault(self, key, value):
        
        with self.lock:
            if key in self:
                return self.getitem(key)

            else:
                self.setitem(key, value)
                return value
965843
def _setdefault(obj, key, value):
    
    v = obj.get(key)
    if v == None:
        obj[key] = value
        return value
    return v
45288
def _set_defaults(cls, app):
        
        app.config.setdefault('IMAGINE_URL', '/media/cache/resolve')
        app.config.setdefault('IMAGINE_NAME', 'imagine')
        app.config.setdefault('IMAGINE_CACHE_ENABLED', True)
        app.config.setdefault('IMAGINE_CACHE_REDIRECT_CODE', 302)

        app.config.setdefault('IMAGINE_ADAPTERS', {})
        app.config.setdefault('IMAGINE_FILTERS', {})

        app.config.setdefault('IMAGINE_ADAPTER', {
            'name': 'fs',
        })

        app.config.setdefault('IMAGINE_FILTER_SETS', {})

        return app
899884
def set_default_layouts(self, ignored_layouts=None):
        

        for key in self.__default_layouts_settings.allKeys():
            if ignored_layouts:
                if tuple((layout for layout in ignored_layouts if layout in key)):
                    continue
            self.__settings.setValue(key, self.__default_layouts_settings.value(key))
        return True
732436
def set_defaults(self):
        
        for key, value in self.spec.items():
            setattr(self, key.upper(), value.get("default", None))
1093039
function defaults(target, defs) {
  if (target == null) target = {};
  var ret = {};
  var keys = Object.keys(defs);
  for (var i = 0, len = keys.length; i < len; i++) {
    var key = keys[i];
    ret[key] = target[key] || defs[key];
  }
  return ret;
}
822886
def set_default(self):
        
        queryset = self.get_default_queryset()
        if queryset.exists():
            queryset.update(default=False)