Returns a copy of the PB object, with some fields updated.

    Args:
        pb_message:
        **kwds:

    Returns:
351167
def copy_update(pb_message, **kwds):
    
    result = pb_message.__class__()
    result.CopyFrom(pb_message)
    for k, v in kwds.items():
        setattr(result, k, v)
    return result
593873
def _cast_message(self, message=None):
        '''
        '''
        if message is None:
            message = {}
        if isinstance(message, Mapping):
            message = Message.load_message(message)
        return message.load_from(self.message, verify=True)
950611
@Override
	public AbstractMessage copy()
    {
        TextMessageImpl clone = new TextMessageImpl();
        copyCommonFields(clone);
        clone.body = this.body;
        
        return clone;
    }
176197
def copy(self) :
        ""
        result = dbus.dbus_message_copy(self._dbobj)
        if result == None :
            raise CallFailed("dbus_message_copy")
        #end if
        return \
            type(self)(result)
516361
def pb2json(pb, useFieldNumber=False):
    '''  '''
    js = {}
    # fields = pb.DESCRIPTOR.fields #all fields
    fields = pb.ListFields()        #only filled (including extensions)
    for field,value in fields:
        if useFieldNumber:
            key = field.number
        else:
            key = field.name
        if field.type == FD.TYPE_MESSAGE:
            ftype = partial(pb2json, useFieldNumber=useFieldNumber)
        elif field.type in _ftype2js:
            ftype = _ftype2js[field.type]
        else:
            raise ParseError("Field %s.%s of type '%d' is not supported" % (pb.__class__.__name__, field.name, field.type, ))
        if field.label == FD.LABEL_REPEATED:
            js_value = []
            for v in value:
                js_value.append(ftype(v))
        else:
            js_value = ftype(value)
        js[key] = js_value
    return js
998002
def new_message(self, body=''):
        
        m = self.message_class(self, body)
        m.queue = self
        return m
237767
def copy(self):
        
        c = copy.copy(self)
        c._fieldDict = c._fieldDict.copy()
        return c
20263
def message_from_bytes(s, *args, **kws):
    
    from future.backports.email.parser import BytesParser
    return BytesParser(*args, **kws).parsebytes(s)
901726
def update(self, body):
        
        data = values.of({'Body': body, })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            sid=self._solution['sid'],
        )
99473
@Override
	public AbstractMessage copy()
    {
        BytesMessageImpl clone = new BytesMessageImpl();
        copyCommonFields(clone);
        tidyUp();
        clone.body = this.body;
        
        return clone;
    }
175437
def from_pb(cls, pb):
        
        obj = cls._from_pb(pb)
        obj._pb = pb
        return obj
1186253
def new_message(self):
        
        msg = {}
        msg['data'] = []
        msg['type'] = self.plugin_type
        msg['source'] = self.name
        msg['ts'] = (datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds()
        return msg
749051
def GetCustomJsonFieldMapping(message_type, python_name=None, json_name=None):
    """"""
    return _FetchRemapping(message_type, 'field',
                           python_name=python_name, json_name=json_name,
                           mappings=_JSON_FIELD_MAPPINGS)
1000799
def encode_message(self):
        
        if not self._message:
            raise ValueError("No message data to encode.")
        cloned_data = self._message.clone()
        self._populate_message_attributes(cloned_data)
        encoded_data = []
        c_uamqp.get_encoded_message_size(cloned_data, encoded_data)
        return b"".join(encoded_data)
174015
def _get_pk_value(self, instance):
        
        pk_field = instance._meta.pk.name
        pk = getattr(instance, pk_field, None)

        # Check to make sure that we got an pk not a model object.
        if isinstance(pk, models.Model):
            pk = self._get_pk_value(pk)
        return pk
564987
def get(self):
        
        if not hasattr(self, '_instance'):
            raise ImplementationError("Impossible to get the PK of an unbound field")
        if not hasattr(self._instance, '_pk'):
            raise DoesNotExist("The current object doesn't exists anymore")

        if not self._instance._pk:
            self.set(value=None)

        return self.normalize(self._instance._pk)
667547
def update(self, **kwds):
        
        result = self._client.tag.update(self, **kwds)
        self._replace_fields(result.get_fields())