proto.message.
Message
(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]¶
The abstract base class for a message.
Parameters:pb
(obj=None, *, coerce: bool = False)¶
Return the underlying protobuf Message class or instance.
Parameters:cls
, return the underlying protobuf instance.obj
to cls
if it is not already an instance.wrap
(pb)¶
Return a Message object that shallowly wraps the descriptor.
Parameters: pb – A protocol buffer object, such as would be returned bypb()
.
serialize
(instance) → bytes¶
Return the serialized proto.
Parameters: instance – An instance of this message type, or something compatible (accepted by the type’s constructor). Returns: The serialized representation of the protocol buffer. Return type: bytesdeserialize
(payload: bytes) → proto.message.Message¶
Given a serialized proto, deserialize it into a Message instance.
Parameters: payload (bytes) – The serialized proto. Returns: An instance of the message class against which this method was called. Return type: Messageto_json
(instance, *, use_integers_for_enums=True, including_default_value_fields=True, preserving_proto_field_name=False, indent=2) → str¶
Given a message instance, serialize it to json
Parameters:The json string representation of the protocol buffer.
Return type:from_json
(payload, *, ignore_unknown_fields=False) → proto.message.Message¶
Given a json string representing an instance, parse it into a message.
Parameters:An instance of the message class against which this method was called.
Return type:Message
to_dict
(instance, *, use_integers_for_enums=True, preserving_proto_field_name=True, including_default_value_fields=True) → proto.message.Message¶
Given a message instance, return its representation as a python dict.
Parameters:Messages and map fields are represented as dicts, repeated fields are represented as lists.
copy_from
(instance, other)¶
Equivalent for protobuf.Message.CopyFrom
Parameters:proto.fields.
Field
(proto_type, *, number: int, message=None, enum=None, oneof: str = None, json_name: str = None, optional: bool = False)[source]¶
A representation of a type of field in protocol buffers.
descriptor
¶
Return the descriptor for the field.
name
¶
Return the name of the field.
package
¶
Return the package of the field.
pb_type
¶
Return the composite type of the field, or the primitive type if a primitive.
proto.fields.
MapField
(key_type, value_type, *, number: int, message=None, enum=None)[source]¶
A representation of a map field in protocol buffers.
proto.fields.
RepeatedField
(proto_type, *, number: int, message=None, enum=None, oneof: str = None, json_name: str = None, optional: bool = False)[source]¶
A representation of a repeated field in protocol buffers.
proto.enums.
Enum
[source]¶
A enum object that also builds a protobuf enum descriptor.
proto.enums.
ProtoEnumMeta
[source]¶
A metaclass for building and registering protobuf enums.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4