DO NOT USE __dict__.setdefault(obj, key, value), IT DOES NOT CHECK FOR obj[key] == None
965843
def _setdefault(obj, key, value):
    
    v = obj.get(key)
    if v == None:
        obj[key] = value
        return value
    return v
1352903
def isdict(obj):
  '''
  
  '''
  return \
    not isstr(obj) \
    and ( isinstance(obj, dict) \
          or ( callable(getattr(obj, 'keys', None)) \
               and callable(getattr(obj, 'values', None)) \
               and callable(getattr(obj, 'items', None)) ))
1054042
def popattr(obj, attr, default=NOT_PROVIDED):
    
    val = getattr(obj, attr, default)
    try:
        delattr(obj, attr)
    except AttributeError:
        if default is NOT_PROVIDED:
            raise
    return val
1260006
def _recursive_dict_update(dict_, other, **kwargs):
    
    overwrite = kwargs['overwrite']

    for key, other_value in iteritems(other):
        if key in dict_:
            value = dict_[key]
            if is_mapping(value) and is_mapping(other_value):
                _recursive_dict_update(value, other_value, overwrite=overwrite)
                continue
        if overwrite:
            dict_[key] = other_value
        else:
            dict_.setdefault(key, other_value)
376570
def _set_property_dict_item(obj, prop, key, value):
    ''' 
    '''
    attr = getattr(obj, prop)
    if prop == 'devices':
        device_type = value['type']

        if device_type == 'disk':

            if 'path' not in value:
                raise SaltInvocationError(
                    "path must be given as parameter"
                )

            if value['path'] != '/' and 'source' not in value:
                raise SaltInvocationError(
                    "source must be given as parameter"
                )

        for k in value.keys():
            if k.startswith('__'):
                del value[k]

        attr[key] = value

    else:  # config
        attr[key] = six.text_type(value)

    pylxd_save_object(obj)

    return _pylxd_model_to_dict(obj)
1176932
def _default(self, key, default=None):
        
        try:
            value = self.theme.themeables.property(key)
        except KeyError:
            value = None

        return value if value is not None else default
679299
def setdefault(self, key, defaultvalue = None):
        
        (t, k) = self._getsubitem(key, True)
        return t.__dict__.setdefault(k, defaultvalue)
613210
def get_int(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else int(value)
1031497
function (key) {
      var val = obj[key];

      // Set if unset
      if (!(key in base)) {
         base[key] = val;
      // If the value is an object and we use recursive mode, use defaults on
      // the value
      } else if (recursive && typeof val === 'object' &&
                 typeof base[key] === 'object') {
         defaults(base[key], val);
      }
      // Otherwise ignore the value
   }
874232
def setdefault(self, k, d=None):
        """"""

        return super(HeaderDict, self).setdefault(k.title(), d)
400818
def setdefault(self, key, default=None):
        
        if key in self:
            return self[key]
        else:
            self._setitem(key, default)
            self._list_add(key)
            return default
1330512
function get(obj, key, default_value, pred) {
        return pred?              pred(obj[key], key, obj) && obj[key]
                                  /* failed? */            || default_value
             : key in obj?        obj[key]
             : /* inexistent? */  default_value
    }
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]
1181865
function defaults(object, defs) {
  var key;
  object = assign({}, object);
  defs = defs || {};
  // Iterate over object non-prototype properties:
  for (key in defs) {
    if (defs.hasOwnProperty(key)) {
      // Replace values with defaults only if undefined (allow empty/zero values):
      if (object[key] == null) {
        object[key] = defs[key];
      }
    }
  }
  return object;
}
344261
def _dict_set(self, key, val):
        '''
        
        '''
        if key != None and self.stringify_keys:
            key = str(key)
        db = self._keyed_db[self.split_func(key)]
        db._dict_set(key, val)
1022804
def set_default(self, key, value):
        
        k = self._real_key(key.lower())
        self._defaults[k] = value
268346
def setdefault(obj: JsonObj, k: str, value: Union[Dict, JsonTypes]) -> JsonObjTypes:
    
    return obj._setdefault(k, value)