For attributes of others that value is not None, assign it to self.

        **中文文档**

        将另一个文档中的数据更新到本条文档。当且仅当数据值不为None时。
546450
def absorb(self, other):
        
        if not isinstance(other, self.__class__):
            raise TypeError("`other` has to be a instance of %s!" %
                            self.__class__)

        for attr, value in other.items():
            if value is not None:
                setattr(self, attr, deepcopy(value))
514913
def set_attributes(self, **kwargs):
        
        for field, value in kwargs.items():
            if field in self.Meta.attributes:
                setattr(self, field, value)
1247716
def update_attributes(self, **kwargs):
        """"""
        attrs = self.attributes.values() + self.lists.values() \
                + self.references.values()
        for att in attrs:
            if att.name in kwargs:
                att.__set__(self, kwargs[att.name])
669970
def assign(self, attrs):
        
        for k, v in attrs.items():
            setattr(self, k, v)
1224577
def update(self, attributes=None):
        

        if attributes is None:
            attributes = {}

        headers = self.__class__.create_headers(attributes)
        headers.update(self._update_headers())

        result = self._client._put(
            self._update_url(),
            self.__class__.create_attributes(attributes, self),
            headers=headers
        )

        self._update_from_resource(result)

        return self
374977
def set_attributes(self, attributes):
        
        for k, v in attributes.items():
            self.set_attribute(k, v)
911913
def update(self, *others):
        
        for other in others:
            for key, val in other.items():
                self[key] = val
            try:
                if not other.success:
                    self.success = False
                    self.reason = other.reason
            except AttributeError:
                pass
178793
def set_attribute(self, name, value):
        """"""
        self.attribute_name = name
        self.attribute = value
635191
def _add_attribute(self, name, value, allowed_values=None):
        """"""
        if value and value != 'none':

            if isinstance(value, (int, bool)):
                value = str(value)

            if allowed_values and value not in allowed_values:
                raise TypeError(
                    "Attribute '" + name + "' must be one of " + str(
                        allowed_values) + " but is '" + str(value) + "'")

            self.element_attrs[name] = value
1251563
function setAttribute(context, attr, value) {
    let currentAttrValue = context.getAttribute(attr);
    if (currentAttrValue !== value) {
        if (!isFalsy(value)) {
            if (typeof value === 'boolean') {
                value = '';
            }
            context.setAttribute(attr, value);
        } else if (currentAttrValue !== null) {
            context.removeAttribute(attr);
        }
    }
}
273140
def copyData(self, source):
        
        for attr in self.copyAttributes:
            selfValue = getattr(self, attr)
            sourceValue = getattr(source, attr)
            if isinstance(selfValue, BaseObject):
                selfValue.copyData(sourceValue)
            else:
                setattr(self, attr, sourceValue)
402462
def setAttribute(values, value):
    
    if isinstance(value, int):
        values.add().int32_value = value
    elif isinstance(value, float):
        values.add().double_value = value
    elif isinstance(value, long):
        values.add().int64_value = value
    elif isinstance(value, str):
        values.add().string_value = value
    elif isinstance(value, bool):
        values.add().bool_value = value
    elif isinstance(value, (list, tuple, array.array)):
        for v in value:
            setAttribute(values, v)
    elif isinstance(value, dict):
        for key in value:
            setAttribute(
                values.add().attributes.attr[key].values, value[key])
    else:
        values.add().string_value = str(value)
1280635
def _update(self, other):
        
        for key, value in other.items():
            self[key] = value
1297512
def add(self, key, value):
        
        if key.endswith('_'):
            key = key[:-1]
        if key in self.attributes:
            self.attributes[key] = self.attributes[key] + ' ' + value
        else:
            self.attributes[key] = value
480629
def set_attributes(self, **attributes_dict):
        
        for attr_name, attr_value in attributes_dict.items():
            self.set_attr(attr_name, attr_value)
        return self
436770
def copy_attr(self, other):
        
        if not isinstance(other, Symbol):
            return  # Nothing done if not a Symbol object

        tmp = re.compile('__.*__')
        for attr in (x for x in dir(other) if not tmp.match(x)):

            if (
                hasattr(self.__class__, attr) and
                str(type(getattr(self.__class__, attr)) in ('property', 'function', 'instancemethod'))
            ):
                continue

            val = getattr(other, attr)
            if isinstance(val, str) or str(val)[0] != '<':  # Not a value
                setattr(self, attr, val)
458333
def CopyFromDict(self, attributes):
    
    for attribute_name, attribute_value in attributes.items():
      # Not using startswith to improve performance.
      if attribute_name[0] == '_':
        continue
      setattr(self, attribute_name, attribute_value)