Message and Field¶
-
class
proto.message.
Message
(mapping=None, **kwargs)[source]¶ The abstract base class for a message.
Parameters: -
classmethod
pb
(obj=None, *, coerce: bool = False)¶ Return the underlying protobuf Message class or instance.
Parameters: - obj – If provided, and an instance of
cls
, return the underlying protobuf instance. - coerce (bool) – If provided, will attempt to coerce
obj
tocls
if it is not already an instance.
- obj – If provided, and an instance of
-
classmethod
-
class
proto.fields.
Field
(proto_type, *, number: int, message=None, enum=None, oneof: str = None, json_name: str = None)[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 None for primitives.
-
-
class
proto.fields.
MapField
(key_type, value_type, *, number: int, message=None, enum=None)[source]¶ A representation of a map field in protocol buffers.