Package google :: Package protobuf :: Module descriptor :: Class EnumDescriptor
[frames] | no frames]

Class EnumDescriptor

source code

       object --+        
                |        
   DescriptorBase --+    
                    |    
_NestedDescriptorBase --+
                        |
                       EnumDescriptor

Descriptor for an enum defined in a .proto file.

An EnumDescriptor instance has the following attributes:

  name: (str) Name of the enum type.
  full_name: (str) Full name of the type, including package name
    and any enclosing type(s).

  values: (list of EnumValueDescriptors) List of the values
    in this enum.
  values_by_name: (dict str -> EnumValueDescriptor) Same as |values|,
    but indexed by the "name" field of each EnumValueDescriptor.
  values_by_number: (dict int -> EnumValueDescriptor) Same as |values|,
    but indexed by the "number" field of each EnumValueDescriptor.
  containing_type: (Descriptor) Descriptor of the immediate containing
    type of this enum, or None if this is an enum defined at the
    top level in a .proto file.  Set by Descriptor's constructor
    if we're passed into one.
  file: (FileDescriptor) Reference to file descriptor.
  options: (descriptor_pb2.EnumOptions) Enum options message or
    None to use default enum options.

Instance Methods
a new object with type S, a subtype of T
__new__(cls, name, full_name, filename, values, containing_type=None, options=None, file=None, serialized_start=None, serialized_end=None) source code
 
__init__(self, name, full_name, filename, values, containing_type=None, options=None, file=None, serialized_start=None, serialized_end=None)
Arguments are as described in the attribute description above.
source code
 
CopyToProto(self, proto)
Copies this to a descriptor_pb2.EnumDescriptorProto.
source code

Inherited from _NestedDescriptorBase: GetTopLevelContainingType

Inherited from DescriptorBase: GetOptions

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__new__(cls, name, full_name, filename, values, containing_type=None, options=None, file=None, serialized_start=None, serialized_end=None)

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

__init__(self, name, full_name, filename, values, containing_type=None, options=None, file=None, serialized_start=None, serialized_end=None)
(Constructor)

source code 

Arguments are as described in the attribute description above.

Note that filename is an obsolete argument, that is not used anymore. Please use file.name to access this as an attribute.

Overrides: object.__init__

CopyToProto(self, proto)

source code 
Copies this to a descriptor_pb2.EnumDescriptorProto.

Args:
  proto: An empty descriptor_pb2.EnumDescriptorProto.

Overrides: _NestedDescriptorBase.CopyToProto