Set dotted attr (like "a.b.c") on obj to val.
784
def setattrdeep(obj, attr, val):
    ''
    attrs = attr.split('.')

    for a in attrs[:-1]:
        obj = getattr(obj, a)
    setattr(obj, attrs[-1], val)
867808
def setattr_at_path( obj, path, val ):
    
    target = obj
    last_attr = path[-1]
    for attr in path[0:-1]:
        try:
            if type(attr) in ( str, unicode ) and target and hasattr( target, attr ):
                target = getattr( target, attr )
            else:
                target = target[attr]
        except:
            pass
    # Ensures we set by reference
    try:
        setattr( target, last_attr, val )
    except:
        target[last_attr] = val
1044933
public void setAttr(String attr, Object val) throws NamingException {
    getAttributes().put(attr, val);
  }
1011684
def do_attr(environment, obj, name):
    
    try:
        name = str(name)
    except UnicodeError:
        pass
    else:
        try:
            value = getattr(obj, name)
        except AttributeError:
            pass
        else:
            if environment.sandboxed and not \
               environment.is_safe_attribute(obj, name, value):
                return environment.unsafe_undefined(obj, name)
            return value
    return environment.undefined(obj=obj, name=name)
397236
function attributesToString(obj, prevObj, level) {
            var attrs = '',
                prefix,
                tab;
            level = level || 1;
            tab = getTabs(level, true);
            _.forEach(obj, function (v, k) {
                if(excludeAttrs.indexOf(k) === -1){
                    var prev = prevObj && prevObj[k] !== undefined ? prevObj[k] : undefined;
                    prefix = attrs.length ? ',\n' : '';
                    if(_.isPlainObject(v)){
                        var subAttr = attributesToString(v, prev, level +1);
                        if(subAttr && subAttr.length)
                            attrs += (prefix + tab + k + ': {\n' + subAttr + '\n' + tab + '}');
                    } else {
                        if(prev !== v){
                            var val = k === 'type' ? 'types.' + v : v;
                            if(_.isArray(val))
                                val = arrayToString(val);
                            if(_.isFunction(val)){
                                val = funcToString(val.toString(), 2);
                            }
                            attrs += (prefix + tab + k + ': ' + val);
                        }
                    }
                }
            });

            return attrs;
        }
323743
def set_attr(self, **kwargs):
        
        for key, value in kwargs.items():
            if value is not None:
                if not isinstance(value, STRING_TYPES):
                    raise ValueError("Set Attr only accepts string values")
                value = c_str(str(value))
            _check_call(_LIB.XGBoosterSetAttr(
                self.handle, c_str(key), value))
473479
def rsetattr(obj, name, value):
    """"""

    # See goo.gl/BVJ7MN
    path = name.split('.')
    setattr(reduce(getattr, path[:-1], obj), path[-1], value)
161972
function (obj, attr) {

	var parts, i, len, name;

	parts = attr.split(".");

	len = parts.length;

    for (i = 0; i < len; ++i) {
    	name = parts[i];
        obj = obj[name];
    }

    return obj;

}
243923
def rec_setattr(obj, attr, value):
    
    attrs = attr.split('.')
    setattr(reduce(getattr, attrs[:-1], obj), attrs[-1], value)
440583
function attr(loc, reference, attrName, value) {
  if (plainAttributes.indexOf(attrName) != -1) {
    return sourceNode(loc, [reference, '.', attrName, ' = ', value, ';']);
  } else {
    return sourceNode(loc, [reference, '.setAttribute(', esc(attrName), ', ', value, ');']);
  }
}
163412
def _get_dynamic_attr(self, attname, obj, default=None):
        
        try:
            attr = getattr(self, attname)
        except AttributeError:
            return default
        if callable(attr):
            # Check co_argcount rather than try/excepting the function and
            # catching the TypeError, because something inside the function
            # may raise the TypeError. This technique is more accurate.
            try:
                code = six.get_function_code(attr)
            except AttributeError:
                code = six.get_function_code(attr.__call__)
            if code.co_argcount == 2:       # one argument is 'self'
                return attr(obj)
            else:
                return attr()
        return attr
1085125
def set_attr(obj, path, value):
    
    try:
        return _set_attr(obj, split_field(path), value)
    except Exception as e:
        Log = get_logger()
        if PATH_NOT_FOUND in e:
            Log.warning(PATH_NOT_FOUND + ": {{path}}", path=path, cause=e)
        else:
            Log.error("Problem setting value", cause=e)
34597
def convert_attrs_to_uppercase(obj: Any, attrs: Iterable[str]) -> None:
    
    for a in attrs:
        value = getattr(obj, a)
        if value is None:
            continue
        setattr(obj, a, value.upper())
1002242
def _setattr_default(obj, attr, value, default):
    """"""
    if value is None:
        setattr(obj, attr, default)
    else:
        setattr(obj, attr, value)
118996
def setAttribute(self, attr: str, value: _AttrValueType) -> None:
        """"""
        self._set_attribute(attr, value)
919353
def add_attr(self, name, value):
        """"""
        setattr(self, name, value)
        self.attrs.append(name)
1111754
def set(self, obj, value):
        
        assert self.setter is not None, "Setter accessor is not specified."
        if callable(self.setter):
            return self.setter(obj, value)

        assert isinstance(self.setter, string_types), "Accessor must be a function or a dot-separated string."

        def _set(obj, attr, value):
            if isinstance(obj, dict):
                obj[attr] = value
            else:
                setattr(obj, attr, value)
            return value

        path = self.setter.split(".")
        for attr in path[:-1]:
            obj = _set(obj, attr, {})

        _set(obj, path[-1], value)