+
     h   c                   s    R t ^ RIHt ^ RIHt ^ RIHt  ! R R]P                  4      t]! ]P                  ! 4       R7      t	R tR# )	aS  A database of Python protocol buffer generated symbols.

SymbolDatabase is the MessageFactory for messages generated at compile time,
and makes it easy to create new instances of a registered type, given only the
type's protocol buffer symbol name.

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')()
)api_implementation)descriptor_pool)message_factoryc                   sN   a  ] tR t^Bt o RtR tR tR tR tR t	R t
R tR	tV tR
# )SymbolDatabasez'A database of Python generated symbols.c                s\    VP                   pWP                  V&   V P                  V4       V# )a$  Registers the given message type in the local database.

Calls to GetSymbol() and GetMessages() will return messages registered here.

Args:
  message: A :class:`google.protobuf.message.Message` subclass (or
    instance); its descriptor will be registered.

Returns:
  The provided message.
)Z
DESCRIPTOR_classesRegisterMessageDescriptor)selfZmessagedescs   && D/usr/lib/python3.14/site-packages/google/protobuf/symbol_database.pyRegisterMessageZSymbolDatabase.RegisterMessageE   s.     D!MM$""4(N    c                t    \         P                  ! 4       R8X  d   V P                  P                  V4       R# R# )zRegisters the given message descriptor in the local database.

Args:
  message_descriptor (Descriptor): the message descriptor to add.
pythonN)r    TypepoolZ_AddDescriptor)r   Zmessage_descriptor   &&r   r   Z(SymbolDatabase.RegisterMessageDescriptorW   s-      H,
ii12 -r
   c                sp    \         P                  ! 4       R8X  d   V P                  P                  V4       V# )zRegisters the given enum descriptor in the local database.

Args:
  enum_descriptor (EnumDescriptor): The enum descriptor to register.

Returns:
  EnumDescriptor: The provided descriptor.
r   )r    r   r   Z_AddEnumDescriptor)r   Zenum_descriptorr   r   RegisterEnumDescriptorZ%SymbolDatabase.RegisterEnumDescriptora   s-      H,
ii""?3r
   c                r   )zRegisters the given service descriptor in the local database.

Args:
  service_descriptor (ServiceDescriptor): the service descriptor to
    register.
r   N)r    r   r   Z_AddServiceDescriptor)r   Zservice_descriptorr   r   RegisterServiceDescriptorZ(SymbolDatabase.RegisterServiceDescriptoro   s-      H,
ii%%&89 -r
   c                r   )zRegisters the given file descriptor in the local database.

Args:
  file_descriptor (FileDescriptor): The file descriptor to register.
r   N)r    r   r   Z_InternalAddFileDescriptor)r   Zfile_descriptorr   r   RegisterFileDescriptorZ%SymbolDatabase.RegisterFileDescriptorz   s,      H,
ii**?; -r
   c                sZ    V P                   V P                  P                  V4      ,          # )aS  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 (str): a protocol buffer symbol.

Returns:
  A Python class corresponding to the symbol.

Raises:
  KeyError: if the symbol could not be found.
)r   r   ZFindMessageTypeByName)r   Zsymbolr   r   	GetSymbolZSymbolDatabase.GetSymbol   s"      ==88@AAr
   c                s$  a V3R lo/ pV Fn  pV P                   P                  V4      pVP                  P                  4        F2  pS! V4       F#  p V P                  V,          W&P
                  &   K%  	  K4  	  Kp  	  V#   \         d     K?  i ; i)a  Gets all registered messages from a specified file.

Only messages already created and registered will be returned; (this is the
case for imported _pb2 modules)
But unlike MessageFactory, this version also returns already defined nested
messages, but does not register any message extensions.

Args:
  files (list[str]): The file names to extract messages from.

Returns:
  A dictionary mapping proto names to the message classes.

Raises:
  KeyError: if a file could not be found.
c              3  sd   <"   V x  V P                    F  pS! V4       F  pVx  K	  	  K  	  R# 5i)zCWalk a message Descriptor and recursively yields all message names.N)Znested_types)r   msg_descZnested_desc_GetAllMessagess   &  r   r   Z3SymbolDatabase.GetMessages.<locals>._GetAllMessages   s0     j''(*84K
 5 (s   -0)r   ZFindFileByNameZmessage_types_by_nameZvaluesr   Z	full_nameZKeyError)r   ZfilesZresultZ	file_nameZ	file_descr   r   r   s   &&     @r   GetMessagesZSymbolDatabase.GetMessages   s    & F	))**95i55<<>(#H-D%)]]4%8F>>" . ?  M  s   B  B	B	 N)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r	   r   r   r   r   r   r   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   B   s1     /$3	:<B$$ $r
   r   )r   c                 s    \         # )z#Returns the default SymbolDatabase.)_DEFAULTr   r
   r   Defaultr      s    	/r
   N)
r   Zgoogle.protobuf.internalr    Zgoogle.protobufr   r   ZMessageFactoryr   r   r   r   r
   r   <module>r      sD   >< 8 + +x_33 xv 6689r
   