diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:32:48 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:33:05 -0700 |
commit | d36c0c538a545fac5d9db6ba65c525246d4efa95 (patch) | |
tree | 3fd29af0f137dfaf5df892723e60600f674392b3 /python/google/protobuf/descriptor_database.py | |
parent | 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 (diff) |
Down-integrate from google3.
Diffstat (limited to 'python/google/protobuf/descriptor_database.py')
-rw-r--r-- | python/google/protobuf/descriptor_database.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/google/protobuf/descriptor_database.py b/python/google/protobuf/descriptor_database.py index 1333f996..40bcdd72 100644 --- a/python/google/protobuf/descriptor_database.py +++ b/python/google/protobuf/descriptor_database.py @@ -54,9 +54,9 @@ class DescriptorDatabase(object): Args: file_desc_proto: The FileDescriptorProto to add. Raises: - DescriptorDatabaseException: if an attempt is made to add a proto - with the same name but different definition than an exisiting - proto in the database. + DescriptorDatabaseConflictingDefinitionError: if an attempt is made to + add a proto with the same name but different definition than an + exisiting proto in the database. """ proto_name = file_desc_proto.name if proto_name not in self._file_desc_protos_by_file: @@ -65,7 +65,7 @@ class DescriptorDatabase(object): raise DescriptorDatabaseConflictingDefinitionError( '%s already added, but with different descriptor.' % proto_name) - # Add the top-level Message, Enum and Extension descriptors to the index. + # Add all the top-level descriptors to the index. package = file_desc_proto.package for message in file_desc_proto.message_type: self._file_desc_protos_by_symbol.update( @@ -76,6 +76,9 @@ class DescriptorDatabase(object): for extension in file_desc_proto.extension: self._file_desc_protos_by_symbol[ '.'.join((package, extension.name))] = file_desc_proto + for service in file_desc_proto.service: + self._file_desc_protos_by_symbol[ + '.'.join((package, service.name))] = file_desc_proto def FindFileByName(self, name): """Finds the file descriptor proto by file name. |