Package google :: Package protobuf :: Module descriptor_database :: Class DescriptorDatabase
[hide private]
[frames] | no frames]

Class DescriptorDatabase

source code

object --+
         |
        DescriptorDatabase

A container accepting FileDescriptorProtos and maps DescriptorProtos.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
Add(self, file_desc_proto)
Adds the FileDescriptorProto and its types to this database.
source code
 
FindFileByName(self, name)
Finds the file descriptor proto by file name.
source code
 
FindFileContainingSymbol(self, symbol)
Finds the file descriptor proto containing the specified symbol.
source code
 
FindFileContainingExtension(self, extendee_name, extension_number) source code
 
FindAllExtensionNumbers(self, extendee_name) source code
 
_AddSymbol(self, name, file_desc_proto) source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

Add(self, file_desc_proto)

source code 
Adds the FileDescriptorProto and its types to this database.

Args:
  file_desc_proto: The FileDescriptorProto to add.
Raises:
  DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
    add a proto with the same name but different definition than an
    exisiting proto in the database.

FindFileByName(self, name)

source code 
Finds the file descriptor proto by file name.

Typically the file name is a relative path ending to a .proto file. The
proto with the given name will have to have been added to this database
using the Add method or else an error will be raised.

Args:
  name: The file name to find.

Returns:
  The file descriptor proto matching the name.

Raises:
  KeyError if no file by the given name was added.

FindFileContainingSymbol(self, symbol)

source code 
Finds the file descriptor proto containing the specified symbol.

The symbol should be a fully qualified name including the file descriptor's
package and any containing messages. Some examples:

'some.package.name.Message'
'some.package.name.Message.NestedEnum'
'some.package.name.Message.some_field'

The file descriptor proto containing the specified symbol must be added to
this database using the Add method or else an error will be raised.

Args:
  symbol: The fully qualified symbol name.

Returns:
  The file descriptor proto containing the symbol.

Raises:
  KeyError if no file contains the specified symbol.