Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
google.protobuf.descriptor_pool.DescriptorPool Class Reference
Inheritance diagram for google.protobuf.descriptor_pool.DescriptorPool:
Inheritance graph
[legend]

Classes

class  Tables
 

Public Member Functions

def __init__ (self, descriptor_db=None)
 
def __init__ (self, descriptor_db=None)
 
def __new__ (cls, descriptor_db=None)
 
def __new__ (cls, descriptor_db=None)
 
def Add (self, file_desc_proto)
 
def Add (self, file_desc_proto)
 
def AddDescriptor (self, desc)
 
def AddDescriptor (self, desc)
 
def AddEnumDescriptor (self, enum_desc)
 
def AddEnumDescriptor (self, enum_desc)
 
def AddExtensionDescriptor (self, extension)
 
def AddExtensionDescriptor (self, extension)
 
def AddFileDescriptor (self, file_desc)
 
def AddFileDescriptor (self, file_desc)
 
def AddSerializedFile (self, serialized_file_desc_proto)
 
def AddSerializedFile (self, serialized_file_desc_proto)
 
def AddServiceDescriptor (self, service_desc)
 
def AddServiceDescriptor (self, service_desc)
 
def FindAllExtensions (self, message_descriptor)
 
def FindAllExtensions (self, message_descriptor)
 
def FindEnumTypeByName (self, full_name)
 
def FindEnumTypeByName (self, full_name)
 
def FindExtensionByName (self, full_name)
 
def FindExtensionByName (self, full_name)
 
def FindExtensionByNumber (self, message_descriptor, number)
 
def FindExtensionByNumber (self, message_descriptor, number)
 
def FindFieldByName (self, full_name)
 
def FindFieldByName (self, full_name)
 
def FindFileByName (self, file_name)
 
def FindFileByName (self, file_name)
 
def FindFileContainingSymbol (self, symbol)
 
def FindFileContainingSymbol (self, symbol)
 
def FindMessageTypeByName (self, full_name)
 
def FindMessageTypeByName (self, full_name)
 
def FindMethodByName (self, full_name)
 
def FindMethodByName (self, full_name)
 
def FindOneofByName (self, full_name)
 
def FindOneofByName (self, full_name)
 
def FindServiceByName (self, full_name)
 
def FindServiceByName (self, full_name)
 

Private Member Functions

def _AddDescriptor (self, desc)
 
def _AddDescriptor (self, desc)
 
def _AddEnumDescriptor (self, enum_desc)
 
def _AddEnumDescriptor (self, enum_desc)
 
def _AddExtensionDescriptor (self, extension)
 
def _AddExtensionDescriptor (self, extension)
 
def _AddFileDescriptor (self, file_desc)
 
def _AddFileDescriptor (self, file_desc)
 
def _AddServiceDescriptor (self, service_desc)
 
def _AddServiceDescriptor (self, service_desc)
 
def _CheckConflictRegister (self, desc, desc_name, file_name)
 
def _CheckConflictRegister (self, desc, desc_name, file_name)
 
def _ConvertEnumDescriptor (self, enum_proto, package=None, file_desc=None, containing_type=None, scope=None, top_level=False)
 
def _ConvertEnumDescriptor (self, enum_proto, package=None, file_desc=None, containing_type=None, scope=None, top_level=False)
 
def _ConvertFileProtoToFileDescriptor (self, file_proto)
 
def _ConvertFileProtoToFileDescriptor (self, file_proto)
 
def _ConvertMessageDescriptor (self, desc_proto, package=None, file_desc=None, scope=None, syntax=None)
 
def _ConvertMessageDescriptor (self, desc_proto, package=None, file_desc=None, scope=None, syntax=None)
 
def _ExtractSymbols (self, descriptors)
 
def _ExtractSymbols (self, descriptors)
 
def _FindFileContainingSymbolInDb (self, symbol)
 
def _FindFileContainingSymbolInDb (self, symbol)
 
def _GetDeps (self, dependencies)
 
def _GetDeps (self, dependencies)
 
def _GetTypeFromScope (self, package, type_name, scope)
 
def _GetTypeFromScope (self, package, type_name, scope)
 
def _InternalAddFileDescriptor (self, file_desc)
 
def _InternalAddFileDescriptor (self, file_desc)
 
def _InternalFindFileContainingSymbol (self, symbol)
 
def _InternalFindFileContainingSymbol (self, symbol)
 
def _MakeEnumValueDescriptor (self, value_proto, index)
 
def _MakeEnumValueDescriptor (self, value_proto, index)
 
def _MakeFieldDescriptor (self, field_proto, message_name, index, file_desc, is_extension=False)
 
def _MakeFieldDescriptor (self, field_proto, message_name, index, file_desc, is_extension=False)
 
def _MakeMethodDescriptor (self, method_proto, service_name, package, scope, index)
 
def _MakeMethodDescriptor (self, method_proto, service_name, package, scope, index)
 
def _MakeServiceDescriptor (self, service_proto, service_index, scope, package, file_desc)
 
def _MakeServiceDescriptor (self, service_proto, service_index, scope, package, file_desc)
 
def _SetAllFieldTypes (self, package, desc_proto, scope)
 
def _SetAllFieldTypes (self, package, desc_proto, scope)
 
def _SetFieldType (self, field_proto, field_desc, package, scope)
 
def _SetFieldType (self, field_proto, field_desc, package, scope)
 
def _TryLoadExtensionFromDB (self, message_descriptor, number)
 
def _TryLoadExtensionFromDB (self, message_descriptor, number)
 

Private Attributes

 _descriptor_db
 
 _descriptors
 
 _enum_descriptors
 
 _extensions_by_name
 
 _extensions_by_number
 
 _file_desc_by_toplevel_extension
 
 _file_descriptors
 
 _internal_db
 
 _service_descriptors
 
 _top_enum_values
 
 _toplevel_extensions
 

Detailed Description

A collection of protobufs dynamically constructed by descriptor protos.

Definition at line 118 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.__init__ (   self,
  descriptor_db = None 
)
Initializes a Pool of proto buffs.

The descriptor_db argument to the constructor is provided to allow
specialized file descriptor proto lookup code to be triggered on demand. An
example would be an implementation which will read and compile a file
specified in a call to FindFileByName() and not require the call to Add()
at all. Results from this database will be cached internally here as well.

Args:
  descriptor_db: A secondary source of file descriptors.

Definition at line 127 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ __init__() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.__init__ (   self,
  descriptor_db = None 
)
Initializes a Pool of proto buffs.

The descriptor_db argument to the constructor is provided to allow
specialized file descriptor proto lookup code to be triggered on demand. An
example would be an implementation which will read and compile a file
specified in a call to FindFileByName() and not require the call to Add()
at all. Results from this database will be cached internally here as well.

Args:
  descriptor_db: A secondary source of file descriptors.

Definition at line 127 of file protobuf/python/google/protobuf/descriptor_pool.py.

Member Function Documentation

◆ __new__() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.__new__ (   cls,
  descriptor_db = None 
)

◆ __new__() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.__new__ (   cls,
  descriptor_db = None 
)

◆ _AddDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddDescriptor (   self,
  desc 
)
private
Adds a Descriptor to the pool, non-recursively.

If the Descriptor contains nested messages or enums, the caller must
explicitly register them. This method also registers the FileDescriptor
associated with the message.

Args:
  desc: A Descriptor.

Definition at line 225 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddDescriptor (   self,
  desc 
)
private
Adds a Descriptor to the pool, non-recursively.

If the Descriptor contains nested messages or enums, the caller must
explicitly register them. This method also registers the FileDescriptor
associated with the message.

Args:
  desc: A Descriptor.

Definition at line 230 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddEnumDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddEnumDescriptor (   self,
  enum_desc 
)
private
Adds an EnumDescriptor to the pool.

This method also registers the FileDescriptor associated with the enum.

Args:
  enum_desc: An EnumDescriptor.

Definition at line 250 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddEnumDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddEnumDescriptor (   self,
  enum_desc 
)
private
Adds an EnumDescriptor to the pool.

This method also registers the FileDescriptor associated with the enum.

Args:
  enum_desc: An EnumDescriptor.

Definition at line 255 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddExtensionDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddExtensionDescriptor (   self,
  extension 
)
private
Adds a FieldDescriptor describing an extension to the pool.

Args:
  extension: A FieldDescriptor.

Raises:
  AssertionError: when another extension with the same number extends the
same message.
  TypeError: when the specified extension is not a
descriptor.FieldDescriptor.

Definition at line 312 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddExtensionDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddExtensionDescriptor (   self,
  extension 
)
private
Adds a FieldDescriptor describing an extension to the pool.

Args:
  extension: A FieldDescriptor.

Raises:
  AssertionError: when another extension with the same number extends the
same message.
  TypeError: when the specified extension is not a
descriptor.FieldDescriptor.

Definition at line 317 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddFileDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddFileDescriptor (   self,
  file_desc 
)
private
Adds a FileDescriptor to the pool, non-recursively.

If the FileDescriptor contains messages or enums, the caller must explicitly
register them.

Args:
  file_desc: A FileDescriptor.

Definition at line 377 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddFileDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddFileDescriptor (   self,
  file_desc 
)
private
Adds a FileDescriptor to the pool, non-recursively.

If the FileDescriptor contains messages or enums, the caller must explicitly
register them.

Args:
  file_desc: A FileDescriptor.

Definition at line 382 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddServiceDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddServiceDescriptor (   self,
  service_desc 
)
private
Adds a ServiceDescriptor to the pool.

Args:
  service_desc: A ServiceDescriptor.

Definition at line 291 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _AddServiceDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._AddServiceDescriptor (   self,
  service_desc 
)
private
Adds a ServiceDescriptor to the pool.

Args:
  service_desc: A ServiceDescriptor.

Definition at line 296 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _CheckConflictRegister() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._CheckConflictRegister (   self,
  desc,
  desc_name,
  file_name 
)
private
Check if the descriptor name conflicts with another of the same name.

Args:
  desc: Descriptor of a message, enum, service, extension or enum value.
  desc_name: the full name of desc.
  file_name: The file name of descriptor.

Definition at line 157 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _CheckConflictRegister() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._CheckConflictRegister (   self,
  desc,
  desc_name,
  file_name 
)
private
Check if the descriptor name conflicts with another of the same name.

Args:
  desc: Descriptor of a message, enum, service, extension or enum value.
  desc_name (str): the full name of desc.
  file_name (str): The file name of descriptor.

Definition at line 157 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertEnumDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertEnumDescriptor (   self,
  enum_proto,
  package = None,
  file_desc = None,
  containing_type = None,
  scope = None,
  top_level = False 
)
private
Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.

Args:
  enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
  package: Optional package name for the new message EnumDescriptor.
  file_desc: The file containing the enum descriptor.
  containing_type: The type containing this enum.
  scope: Scope containing available types.
  top_level: If True, the enum is a top level symbol. If False, the enum
  is defined inside a message.

Returns:
  The added descriptor

Definition at line 906 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertEnumDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertEnumDescriptor (   self,
  enum_proto,
  package = None,
  file_desc = None,
  containing_type = None,
  scope = None,
  top_level = False 
)
private
Make a protobuf EnumDescriptor given an EnumDescriptorProto protobuf.

Args:
  enum_proto: The descriptor_pb2.EnumDescriptorProto protobuf message.
  package: Optional package name for the new message EnumDescriptor.
  file_desc: The file containing the enum descriptor.
  containing_type: The type containing this enum.
  scope: Scope containing available types.
  top_level: If True, the enum is a top level symbol. If False, the enum
  is defined inside a message.

Returns:
  The added descriptor

Definition at line 922 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertFileProtoToFileDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertFileProtoToFileDescriptor (   self,
  file_proto 
)
private
Creates a FileDescriptor from a proto or returns a cached copy.

This method also has the side effect of loading all the symbols found in
the file into the appropriate dictionaries in the pool.

Args:
  file_proto: The proto to convert.

Returns:
  A FileDescriptor matching the passed in proto.

Definition at line 733 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertFileProtoToFileDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertFileProtoToFileDescriptor (   self,
  file_proto 
)
private
Creates a FileDescriptor from a proto or returns a cached copy.

This method also has the side effect of loading all the symbols found in
the file into the appropriate dictionaries in the pool.

Args:
  file_proto: The proto to convert.

Returns:
  A FileDescriptor matching the passed in proto.

Definition at line 737 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertMessageDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertMessageDescriptor (   self,
  desc_proto,
  package = None,
  file_desc = None,
  scope = None,
  syntax = None 
)
private
Adds the proto to the pool in the specified package.

Args:
  desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
  package: The package the proto should be located in.
  file_desc: The file containing this message.
  scope: Dict mapping short and full symbols to message and enum types.
  syntax: string indicating syntax of the file ("proto2" or "proto3")

Returns:
  The added descriptor.

Definition at line 823 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ConvertMessageDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._ConvertMessageDescriptor (   self,
  desc_proto,
  package = None,
  file_desc = None,
  scope = None,
  syntax = None 
)
private
Adds the proto to the pool in the specified package.

Args:
  desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
  package: The package the proto should be located in.
  file_desc: The file containing this message.
  scope: Dict mapping short and full symbols to message and enum types.
  syntax: string indicating syntax of the file ("proto2" or "proto3")

Returns:
  The added descriptor.

Definition at line 828 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ExtractSymbols() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._ExtractSymbols (   self,
  descriptors 
)
private
Pulls out all the symbols from descriptor protos.

Args:
  descriptors: The messages to extract descriptors from.
Yields:
  A two element tuple of the type name and descriptor object.

Definition at line 1184 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _ExtractSymbols() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._ExtractSymbols (   self,
  descriptors 
)
private
Pulls out all the symbols from descriptor protos.

Args:
  descriptors: The messages to extract descriptors from.
Yields:
  A two element tuple of the type name and descriptor object.

Definition at line 1220 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _FindFileContainingSymbolInDb() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._FindFileContainingSymbolInDb (   self,
  symbol 
)
private
Finds the file in descriptor DB containing the specified symbol.

Args:
  symbol (str): The name of the symbol to search for.

Returns:
  FileDescriptor: The file that contains the specified symbol.

Raises:
  KeyError: if the file cannot be found in the descriptor database.

Definition at line 710 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _FindFileContainingSymbolInDb() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._FindFileContainingSymbolInDb (   self,
  symbol 
)
private
Finds the file in descriptor DB containing the specified symbol.

Args:
  symbol: The name of the symbol to search for.

Returns:
  A FileDescriptor that contains the specified symbol.

Raises:
  KeyError: if the file cannot be found in the descriptor database.

Definition at line 714 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _GetDeps() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._GetDeps (   self,
  dependencies 
)
private
Recursively finds dependencies for file protos.

Args:
  dependencies: The names of the files being depended on.

Yields:
  Each direct and indirect dependency.

Definition at line 1200 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _GetDeps() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._GetDeps (   self,
  dependencies 
)
private
Recursively finds dependencies for file protos.

Args:
  dependencies: The names of the files being depended on.

Yields:
  Each direct and indirect dependency.

Definition at line 1236 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _GetTypeFromScope() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._GetTypeFromScope (   self,
  package,
  type_name,
  scope 
)
private
Finds a given type name in the current scope.

Args:
  package: The package the proto should be located in.
  type_name: The name of the type to be found in the scope.
  scope: Dict mapping short and full symbols to message and enum types.

Returns:
  The descriptor for the requested type.

Definition at line 1216 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _GetTypeFromScope() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._GetTypeFromScope (   self,
  package,
  type_name,
  scope 
)
private
Finds a given type name in the current scope.

Args:
  package: The package the proto should be located in.
  type_name: The name of the type to be found in the scope.
  scope: Dict mapping short and full symbols to message and enum types.

Returns:
  The descriptor for the requested type.

Definition at line 1252 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _InternalAddFileDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._InternalAddFileDescriptor (   self,
  file_desc 
)
private
Adds a FileDescriptor to the pool, non-recursively.

If the FileDescriptor contains messages or enums, the caller must explicitly
register them.

Args:
  file_desc: A FileDescriptor.

Definition at line 359 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _InternalAddFileDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._InternalAddFileDescriptor (   self,
  file_desc 
)
private
Adds a FileDescriptor to the pool, non-recursively.

If the FileDescriptor contains messages or enums, the caller must explicitly
register them.

Args:
  file_desc: A FileDescriptor.

Definition at line 364 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _InternalFindFileContainingSymbol() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._InternalFindFileContainingSymbol (   self,
  symbol 
)
private
Gets the already built FileDescriptor containing the specified symbol.

Args:
  symbol: The name of the symbol to search for.

Returns:
  A FileDescriptor that contains the specified symbol.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 446 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _InternalFindFileContainingSymbol() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._InternalFindFileContainingSymbol (   self,
  symbol 
)
private
Gets the already built FileDescriptor containing the specified symbol.

Args:
  symbol (str): The name of the symbol to search for.

Returns:
  FileDescriptor: Descriptor for the file that contains the specified
  symbol.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 452 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeEnumValueDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeEnumValueDescriptor (   self,
  value_proto,
  index 
)
private
Creates a enum value descriptor object from a enum value proto.

Args:
  value_proto: The proto describing the enum value.
  index: The index of the enum value.

Returns:
  An initialized EnumValueDescriptor object.

Definition at line 1106 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeEnumValueDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeEnumValueDescriptor (   self,
  value_proto,
  index 
)
private
Creates a enum value descriptor object from a enum value proto.

Args:
  value_proto: The proto describing the enum value.
  index: The index of the enum value.

Returns:
  An initialized EnumValueDescriptor object.

Definition at line 1134 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeFieldDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeFieldDescriptor (   self,
  field_proto,
  message_name,
  index,
  file_desc,
  is_extension = False 
)
private
Creates a field descriptor from a FieldDescriptorProto.

For message and enum type fields, this method will do a look up
in the pool for the appropriate descriptor for that type. If it
is unavailable, it will fall back to the _source function to
create it. If this type is still unavailable, construction will
fail.

Args:
  field_proto: The proto describing the field.
  message_name: The name of the containing message.
  index: Index of the field
  file_desc: The file containing the field descriptor.
  is_extension: Indication that this field is for an extension.

Returns:
  An initialized FieldDescriptor object

Definition at line 956 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeFieldDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeFieldDescriptor (   self,
  field_proto,
  message_name,
  index,
  file_desc,
  is_extension = False 
)
private
Creates a field descriptor from a FieldDescriptorProto.

For message and enum type fields, this method will do a look up
in the pool for the appropriate descriptor for that type. If it
is unavailable, it will fall back to the _source function to
create it. If this type is still unavailable, construction will
fail.

Args:
  field_proto: The proto describing the field.
  message_name: The name of the containing message.
  index: Index of the field
  file_desc: The file containing the field descriptor.
  is_extension: Indication that this field is for an extension.

Returns:
  An initialized FieldDescriptor object

Definition at line 974 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeMethodDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeMethodDescriptor (   self,
  method_proto,
  service_name,
  package,
  scope,
  index 
)
private
Creates a method descriptor from a MethodDescriptorProto.

Args:
  method_proto: The proto describing the method.
  service_name: The name of the containing service.
  package: Optional package name to look up for types.
  scope: Scope containing available types.
  index: Index of the method in the service.

Returns:
  An initialized MethodDescriptor object.

Definition at line 1157 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeMethodDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeMethodDescriptor (   self,
  method_proto,
  service_name,
  package,
  scope,
  index 
)
private
Creates a method descriptor from a MethodDescriptorProto.

Args:
  method_proto: The proto describing the method.
  service_name: The name of the containing service.
  package: Optional package name to look up for types.
  scope: Scope containing available types.
  index: Index of the method in the service.

Returns:
  An initialized MethodDescriptor object.

Definition at line 1190 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeServiceDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeServiceDescriptor (   self,
  service_proto,
  service_index,
  scope,
  package,
  file_desc 
)
private
Make a protobuf ServiceDescriptor given a ServiceDescriptorProto.

Args:
  service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
  service_index: The index of the service in the File.
  scope: Dict mapping short and full symbols to message and enum types.
  package: Optional package name for the new message EnumDescriptor.
  file_desc: The file containing the service descriptor.

Returns:
  The added descriptor.

Definition at line 1124 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _MakeServiceDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._MakeServiceDescriptor (   self,
  service_proto,
  service_index,
  scope,
  package,
  file_desc 
)
private
Make a protobuf ServiceDescriptor given a ServiceDescriptorProto.

Args:
  service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
  service_index: The index of the service in the File.
  scope: Dict mapping short and full symbols to message and enum types.
  package: Optional package name for the new message EnumDescriptor.
  file_desc: The file containing the service descriptor.

Returns:
  The added descriptor.

Definition at line 1154 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _SetAllFieldTypes() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._SetAllFieldTypes (   self,
  package,
  desc_proto,
  scope 
)
private
Sets all the descriptor's fields's types.

This method also sets the containing types on any extensions.

Args:
  package: The current package of desc_proto.
  desc_proto: The message descriptor to update.
  scope: Enclosing scope of available types.

Definition at line 1000 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _SetAllFieldTypes() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._SetAllFieldTypes (   self,
  package,
  desc_proto,
  scope 
)
private
Sets all the descriptor's fields's types.

This method also sets the containing types on any extensions.

Args:
  package: The current package of desc_proto.
  desc_proto: The message descriptor to update.
  scope: Enclosing scope of available types.

Definition at line 1026 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _SetFieldType() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._SetFieldType (   self,
  field_proto,
  field_desc,
  package,
  scope 
)
private
Sets the field's type, cpp_type, message_type and enum_type.

Args:
  field_proto: Data about the field in proto format.
  field_desc: The descriptor to modiy.
  package: The package the field's container is in.
  scope: Enclosing scope of available types.

Definition at line 1032 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _SetFieldType() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._SetFieldType (   self,
  field_proto,
  field_desc,
  package,
  scope 
)
private
Sets the field's type, cpp_type, message_type and enum_type.

Args:
  field_proto: Data about the field in proto format.
  field_desc: The descriptor to modify.
  package: The package the field's container is in.
  scope: Enclosing scope of available types.

Definition at line 1058 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ _TryLoadExtensionFromDB() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool._TryLoadExtensionFromDB (   self,
  message_descriptor,
  number 
)
private
Try to Load extensions from decriptor db.

Args:
  message_descriptor: descriptor of the extended message.
  number: the extension number that needs to be loaded.

Definition at line 641 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ _TryLoadExtensionFromDB() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool._TryLoadExtensionFromDB (   self,
  message_descriptor,
  number 
)
private
Try to Load extensions from descriptor db.

Args:
  message_descriptor: descriptor of the extended message.
  number: the extension number that needs to be loaded.

Definition at line 648 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ Add() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.Add (   self,
  file_desc_proto 
)
Adds the FileDescriptorProto and its types to this pool.

Args:
  file_desc_proto (FileDescriptorProto): The file descriptor to add.

Definition at line 195 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ Add() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.Add (   self,
  file_desc_proto 
)
Adds the FileDescriptorProto and its types to this pool.

Args:
  file_desc_proto: The FileDescriptorProto to add.

Definition at line 195 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ AddDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddDescriptor (   self,
  desc 
)

◆ AddDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddDescriptor (   self,
  desc 
)

◆ AddEnumDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddEnumDescriptor (   self,
  enum_desc 
)

◆ AddEnumDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddEnumDescriptor (   self,
  enum_desc 
)

◆ AddExtensionDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddExtensionDescriptor (   self,
  extension 
)

◆ AddExtensionDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddExtensionDescriptor (   self,
  extension 
)

◆ AddFileDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddFileDescriptor (   self,
  file_desc 
)

◆ AddFileDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddFileDescriptor (   self,
  file_desc 
)

◆ AddSerializedFile() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddSerializedFile (   self,
  serialized_file_desc_proto 
)
Adds the FileDescriptorProto and its types to this pool.

Args:
  serialized_file_desc_proto: A bytes string, serialization of the
FileDescriptorProto to add.

Definition at line 204 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ AddSerializedFile() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddSerializedFile (   self,
  serialized_file_desc_proto 
)
Adds the FileDescriptorProto and its types to this pool.

Args:
  serialized_file_desc_proto (bytes): A bytes string, serialization of the
:class:`FileDescriptorProto` to add.

Returns:
  FileDescriptor: Descriptor for the added file.

Definition at line 204 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ AddServiceDescriptor() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddServiceDescriptor (   self,
  service_desc 
)

◆ AddServiceDescriptor() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.AddServiceDescriptor (   self,
  service_desc 
)

◆ FindAllExtensions() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindAllExtensions (   self,
  message_descriptor 
)
Gets all the known extension of a given message.

Extensions have to be registered to this pool by calling
AddExtensionDescriptor.

Args:
  message_descriptor: descriptor of the extended message.

Returns:
  A list of FieldDescriptor describing the extensions.

Definition at line 617 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindAllExtensions() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindAllExtensions (   self,
  message_descriptor 
)
Gets all the known extensions of a given message.

Extensions have to be registered to this pool by build related
:func:`Add` or :func:`AddExtensionDescriptor`.

Args:
  message_descriptor (Descriptor): Descriptor of the extended message.

Returns:
  list[FieldDescriptor]: Field descriptors describing the extensions.

Definition at line 624 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindEnumTypeByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindEnumTypeByName (   self,
  full_name 
)
Loads the named enum descriptor from the pool.

Args:
  full_name: The full name of the enum descriptor to load.

Returns:
  The enum descriptor for the named type.

Raises:
  KeyError: if the enum cannot be found in the pool.

Definition at line 512 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindEnumTypeByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindEnumTypeByName (   self,
  full_name 
)
Loads the named enum descriptor from the pool.

Args:
  full_name (str): The full name of the enum descriptor to load.

Returns:
  EnumDescriptor: The enum descriptor for the named type.

Raises:
  KeyError: if the enum cannot be found in the pool.

Definition at line 519 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindExtensionByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindExtensionByName (   self,
  full_name 
)
Loads the named extension descriptor from the pool.

Args:
  full_name: The full name of the extension descriptor to load.

Returns:
  A FieldDescriptor, describing the named extension.

Raises:
  KeyError: if the extension cannot be found in the pool.

Definition at line 564 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindExtensionByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindExtensionByName (   self,
  full_name 
)
Loads the named extension descriptor from the pool.

Args:
  full_name (str): The full name of the extension descriptor to load.

Returns:
  FieldDescriptor: The field descriptor for the named extension.

Raises:
  KeyError: if the extension cannot be found in the pool.

Definition at line 571 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindExtensionByNumber() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindExtensionByNumber (   self,
  message_descriptor,
  number 
)
Gets the extension of the specified message with the specified number.

Extensions have to be registered to this pool by calling
AddExtensionDescriptor.

Args:
  message_descriptor: descriptor of the extended message.
  number: integer, number of the extension field.

Returns:
  A FieldDescriptor describing the extension.

Raises:
  KeyError: when no extension with the given number is known for the
specified message.

Definition at line 594 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindExtensionByNumber() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindExtensionByNumber (   self,
  message_descriptor,
  number 
)
Gets the extension of the specified message with the specified number.

Extensions have to be registered to this pool by calling :func:`Add` or
:func:`AddExtensionDescriptor`.

Args:
  message_descriptor (Descriptor): descriptor of the extended message.
  number (int): Number of the extension field.

Returns:
  FieldDescriptor: The descriptor for the extension.

Raises:
  KeyError: when no extension with the given number is known for the
specified message.

Definition at line 601 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFieldByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFieldByName (   self,
  full_name 
)
Loads the named field descriptor from the pool.

Args:
  full_name: The full name of the field descriptor to load.

Returns:
  The field descriptor for the named field.

Raises:
  KeyError: if the field cannot be found in the pool.

Definition at line 530 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFieldByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFieldByName (   self,
  full_name 
)
Loads the named field descriptor from the pool.

Args:
  full_name (str): The full name of the field descriptor to load.

Returns:
  FieldDescriptor: The field descriptor for the named field.

Raises:
  KeyError: if the field cannot be found in the pool.

Definition at line 537 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFileByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFileByName (   self,
  file_name 
)
Gets a FileDescriptor by file name.

Args:
  file_name: The path to the file to get a descriptor for.

Returns:
  A FileDescriptor for the named file.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 391 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFileByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFileByName (   self,
  file_name 
)
Gets a FileDescriptor by file name.

Args:
  file_name (str): The path to the file to get a descriptor for.

Returns:
  FileDescriptor: The descriptor for the named file.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 396 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFileContainingSymbol() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFileContainingSymbol (   self,
  symbol 
)
Gets the FileDescriptor for the file containing the specified symbol.

Args:
  symbol: The name of the symbol to search for.

Returns:
  A FileDescriptor that contains the specified symbol.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 420 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindFileContainingSymbol() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindFileContainingSymbol (   self,
  symbol 
)
Gets the FileDescriptor for the file containing the specified symbol.

Args:
  symbol (str): The name of the symbol to search for.

Returns:
  FileDescriptor: Descriptor for the file that contains the specified
  symbol.

Raises:
  KeyError: if the file cannot be found in the pool.

Definition at line 425 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindMessageTypeByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindMessageTypeByName (   self,
  full_name 
)
Loads the named descriptor from the pool.

Args:
  full_name: The full name of the descriptor to load.

Returns:
  The descriptor for the named type.

Raises:
  KeyError: if the message cannot be found in the pool.

Definition at line 494 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindMessageTypeByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindMessageTypeByName (   self,
  full_name 
)
Loads the named descriptor from the pool.

Args:
  full_name (str): The full name of the descriptor to load.

Returns:
  Descriptor: The descriptor for the named type.

Raises:
  KeyError: if the message cannot be found in the pool.

Definition at line 501 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindMethodByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindMethodByName (   self,
  full_name 
)
Loads the named service method descriptor from the pool.

Args:
  full_name (str): The full name of the method descriptor to load.

Returns:
  MethodDescriptor: The method descriptor for the service method.

Raises:
  KeyError: if the method cannot be found in the pool.

Definition at line 693 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindMethodByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindMethodByName (   self,
  full_name 
)
Loads the named service method descriptor from the pool.

Args:
  full_name: The full name of the method descriptor to load.

Returns:
  The method descriptor for the service method.

Raises:
  KeyError: if the method cannot be found in the pool.

Definition at line 697 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindOneofByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindOneofByName (   self,
  full_name 
)
Loads the named oneof descriptor from the pool.

Args:
  full_name: The full name of the oneof descriptor to load.

Returns:
  The oneof descriptor for the named oneof.

Raises:
  KeyError: if the oneof cannot be found in the pool.

Definition at line 547 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindOneofByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindOneofByName (   self,
  full_name 
)
Loads the named oneof descriptor from the pool.

Args:
  full_name (str): The full name of the oneof descriptor to load.

Returns:
  OneofDescriptor: The oneof descriptor for the named oneof.

Raises:
  KeyError: if the oneof cannot be found in the pool.

Definition at line 554 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindServiceByName() [1/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindServiceByName (   self,
  full_name 
)
Loads the named service descriptor from the pool.

Args:
  full_name (str): The full name of the service descriptor to load.

Returns:
  ServiceDescriptor: The service descriptor for the named service.

Raises:
  KeyError: if the service cannot be found in the pool.

Definition at line 676 of file protobuf/python/google/protobuf/descriptor_pool.py.

◆ FindServiceByName() [2/2]

def google.protobuf.descriptor_pool.DescriptorPool.FindServiceByName (   self,
  full_name 
)
Loads the named service descriptor from the pool.

Args:
  full_name: The full name of the service descriptor to load.

Returns:
  The service descriptor for the named service.

Raises:
  KeyError: if the service cannot be found in the pool.

Definition at line 680 of file bloaty/third_party/protobuf/python/google/protobuf/descriptor_pool.py.

Member Data Documentation

◆ _descriptor_db

google.protobuf.descriptor_pool.DescriptorPool._descriptor_db
private

◆ _descriptors

google.protobuf.descriptor_pool.DescriptorPool._descriptors
private

◆ _enum_descriptors

google.protobuf.descriptor_pool.DescriptorPool._enum_descriptors
private

◆ _extensions_by_name

google.protobuf.descriptor_pool.DescriptorPool._extensions_by_name
private

◆ _extensions_by_number

google.protobuf.descriptor_pool.DescriptorPool._extensions_by_number
private

◆ _file_desc_by_toplevel_extension

google.protobuf.descriptor_pool.DescriptorPool._file_desc_by_toplevel_extension
private

◆ _file_descriptors

google.protobuf.descriptor_pool.DescriptorPool._file_descriptors
private

◆ _internal_db

google.protobuf.descriptor_pool.DescriptorPool._internal_db
private

◆ _service_descriptors

google.protobuf.descriptor_pool.DescriptorPool._service_descriptors
private

◆ _top_enum_values

google.protobuf.descriptor_pool.DescriptorPool._top_enum_values
private

◆ _toplevel_extensions

google.protobuf.descriptor_pool.DescriptorPool._toplevel_extensions
private

The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:24