Module Expr Str ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr NameLoad If CompareNotIn AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad AttributeLoad NameLoad attr attr Dict Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad AttributeLoad NameLoad attr attr Index AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Dict For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Return NameLoad decorator_list decorator_list Assign NameStore Call NameLoad FunctionDef arguments args defaults body Expr Str Return NameLoad decorator_list
N/A N/A A database of Python protocol buffer generated symbols.

SymbolDatabase makes it easy to create new instances of a registered type, given
only the type's protocol buffer symbol name. Once all symbols are registered,
they can be accessed using either the MessageFactory interface which
SymbolDatabase exposes, or the DescriptorPool interface of the underlying
pool.

Example usage:

  db = symbol_database.SymbolDatabase()

  # Register symbols of interest, from one or multiple files.
  db.RegisterFileDescriptor(my_proto_pb2.DESCRIPTOR)
  db.RegisterMessage(my_proto_pb2.MyMessage)
  db.RegisterEnumDescriptor(my_proto_pb2.MyEnum.DESCRIPTOR)

  # The database can be used as a MessageFactory, to generate types based on
  # their name:
  types = db.GetMessages(['my_proto.proto'])
  my_message_instance = types['MyMessage']()

  # The database's underlying descriptor pool can be queried, so it's not
  # necessary to know a type's filename to be able to generate it:
  filename = db.pool.FindFileContainingSymbol('MyMessage')
  my_message_instance = db.GetMessages([filename])['MyMessage']()

  # This functionality is also provided directly via a convenience method:
  my_message_instance = db.GetSymbol('MyMessage')()
 google.protobuf descriptor_pool SymbolDatabase N/A object N/A N/A A database of Python generated symbols.

  SymbolDatabase also models message_factory.MessageFactory.

  The symbol database can be used to keep a global registry of all protocol
  buffer types used within a program.
   __init__ N/A N/A self N/A N/A N/A Constructor. N/A N/A self _symbols N/A N/A N/A self _symbols_by_file N/A N/A N/A self pool N/A N/A descriptor_pool DescriptorPool N/A RegisterMessage N/A N/A self message N/A N/A N/A Registers the given message type in the local database.

    Args:
      message: a message.Message, to be registered.

    Returns:
      The provided message.
     N/A desc N/A message DESCRIPTOR N/A N/A N/A self _symbols N/A N/A desc full_name message N/A N/A N/A N/A desc file name N/A self _symbols_by_file N/A N/A N/A N/A self _symbols_by_file N/A N/A N/A desc file name N/A N/A N/A N/A N/A self _symbols_by_file N/A N/A N/A desc file name N/A N/A desc full_name message N/A N/A N/A N/A self pool AddDescriptor desc N/A message N/A RegisterEnumDescriptor N/A N/A self enum_descriptor N/A N/A N/A Registers the given enum descriptor in the local database.

    Args:
      enum_descriptor: a descriptor.EnumDescriptor.

    Returns:
      The provided descriptor.
     N/A N/A N/A N/A self pool AddEnumDescriptor enum_descriptor N/A enum_descriptor N/A RegisterFileDescriptor N/A N/A self file_descriptor N/A N/A N/A Registers the given file descriptor in the local database.

    Args:
      file_descriptor: a descriptor.FileDescriptor.

    Returns:
      The provided descriptor.
     N/A N/A N/A N/A self pool AddFileDescriptor file_descriptor N/A GetSymbol N/A N/A self symbol N/A N/A N/A Tries to find a symbol in the local database.

    Currently, this method only returns message.Message instances, however, if
    may be extended in future to support other symbol types.

    Args:
      symbol: A str, a protocol buffer symbol.

    Returns:
      A Python class corresponding to the symbol.

    Raises:
      KeyError: if the symbol could not be found.
     N/A N/A N/A self _symbols N/A symbol N/A GetPrototype N/A N/A self descriptor N/A N/A N/A Builds a proto2 message class based on the passed in descriptor.

    Passing a descriptor with a fully qualified name matching a previous
    invocation will cause the same class to be returned.

    Args:
      descriptor: The descriptor to build from.

    Returns:
      A class describing the passed in descriptor.
     N/A N/A N/A self GetSymbol N/A descriptor full_name N/A GetMessages N/A N/A self files N/A N/A N/A Gets all the messages from a specified file.

    This will find and resolve dependencies, failing if they are not registered
    in the symbol database.


    Args:
      files: The file names to extract messages from.

    Returns:
      A dictionary mapping proto names to the message classes. This will include
      any dependent messages as well as any messages defined in the same file as
      a specified message.

    Raises:
      KeyError: if a file could not be found.
     N/A result N/A N/A f files N/A N/A N/A N/A result update N/A N/A self _symbols_by_file N/A f N/A result N/A N/A N/A _DEFAULT N/A SymbolDatabase Default N/A N/A N/A N/A N/A Returns the default SymbolDatabase. N/A _DEFAULT N/A