def __init__(self, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=None, has_default_value=True): super(FieldDescriptor, self).__init__(options, 'FieldOptions') self.name = name self.full_name = full_name self.index = index self.number = number self.type = type self.cpp_type = cpp_type self.label = label self.has_default_value = has_default_value self.default_value = default_value self.containing_type = containing_type self.message_type = message_type self.enum_type = enum_type self.is_extension = is_extension self.extension_scope = extension_scope if api_implementation.Type() == 'cpp': if is_extension: if api_implementation.Version() == 2: self._cdescriptor = _message.GetExtensionDescriptor(full_name) else: self._cdescriptor = cpp_message.GetExtensionDescriptor(full_name) if api_implementation.Version() == 2: self._cdescriptor = _message.GetFieldDescriptor(full_name) else: self._cdescriptor = cpp_message.GetFieldDescriptor(full_name) elif api_implementation.Version() == 2: self._cdescriptor = _message.GetFieldDescriptor(full_name) else: self._cdescriptor = cpp_message.GetFieldDescriptor(full_name) else: self._cdescriptor = None
def __init__(self, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=None, has_default_value=True): """The arguments are as described in the description of FieldDescriptor attributes above. Note that containing_type may be None, and may be set later if necessary (to deal with circular references between message types, for example). Likewise for extension_scope. """ super(FieldDescriptor, self).__init__(options, 'FieldOptions') self.name = name self.full_name = full_name self.index = index self.number = number self.type = type self.cpp_type = cpp_type self.label = label self.has_default_value = has_default_value self.default_value = default_value self.containing_type = containing_type self.message_type = message_type self.enum_type = enum_type self.is_extension = is_extension self.extension_scope = extension_scope if api_implementation.Type() == 'cpp': if is_extension: if api_implementation.Version() == 2: self._cdescriptor = _message.GetExtensionDescriptor( full_name) else: self._cdescriptor = cpp_message.GetExtensionDescriptor( full_name) else: if api_implementation.Version() == 2: self._cdescriptor = _message.GetFieldDescriptor(full_name) else: self._cdescriptor = cpp_message.GetFieldDescriptor( full_name) else: self._cdescriptor = None