
    NgD                     p    d Z dZddlZ G d de          Z G d de          Z G d d	e          Zd
 ZdS )z*Provides a container for DescriptorProtos.z"matthewtoia@google.com (Matt Toia)    Nc                       e Zd ZdS )ErrorN)__name__
__module____qualname__     _/var/www/html/ai-engine/env/lib/python3.11/site-packages/google/protobuf/descriptor_database.pyr   r      s        $r	   r   c                       e Zd ZdZdS ),DescriptorDatabaseConflictingDefinitionErrorzGRaised when a proto is added with the same name & different descriptor.N)r   r   r   __doc__r   r	   r
   r   r      s        OOOOr	   r   c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
DescriptorDatabasezEA container accepting FileDescriptorProtos and maps DescriptorProtos.c                 "    i | _         i | _        d S N)_file_desc_protos_by_file_file_desc_protos_by_symbol)selfs    r
   __init__zDescriptorDatabase.__init__   s    %'D"')D$$$r	   c                    |j         }|| j        vr|| j        |<   n%| j        |         |k    rt          d|z            dS |j        }|j        D ]+}t          ||          D ]}|                     ||           ,|j        D ]`}|                     d                    ||j         f          |           |j	        D ]&}|| j
        d                    ||j         f          <   'a|j        D ]2}|                     d                    ||j         f          |           3|j        D ]2}	|                     d                    ||	j         f          |           3dS )aL  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
        existing proto in the database.
    z0%s already added, but with different descriptor.N.)namer   r   packagemessage_type_ExtractSymbols
_AddSymbol	enum_typejoinvaluer   	extensionservice)
r   file_desc_proto
proto_namer   messager   enum
enum_valuer    r!   s
             r
   AddzDescriptorDatabase.Add   s    !%J7773Bd$Z00		'
	3	F	F8
<z
IK K K f %G"/ / /!'733 / /$o..../) D D
oosxx$) 455HHH
 D D*4C 	(HHgz/00	2 	2D %. N N	
oosxx). 9::_MMMM"* L L
oosxx', 788?KKKKL Lr	   c                     | j         |         S )a  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.
    )r   )r   r   s     r
   FindFileByNamez!DescriptorDatabase.FindFileByName@   s    " )$//r	   c                     	 | j         |         S # t          $ rG |                    d          \  }}}	 | j         |         cY S # t          $ r t          |          w xY ww xY w)a  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.
    r   )r   KeyError
rpartition)r   symbol	top_level_s       r
   FindFileContainingSymbolz+DescriptorDatabase.FindFileContainingSymbolS   s    ,-f55    ))#..oiA/	::::   vs    #A AA AA c                     d S r   r   )r   extendee_nameextension_numbers      r
   FindFileContainingExtensionz.DescriptorDatabase.FindFileContainingExtensionx   s    4r	   c                     g S r   r   )r   r2   s     r
   FindAllExtensionNumbersz*DescriptorDatabase.FindAllExtensionNumbers|   s    Ir	   c                     || j         v rCd|j        z   dz   |z   dz   | j         |         j        z   dz   }t          j        |t                     || j         |<   d S )NzConflict register for file "z": z is already defined in file "")r   r   warningswarnRuntimeWarning)r   r   r"   warn_msgs       r
   r   zDescriptorDatabase._AddSymbol   s~    t///0?3GG12 248=> ADDh mHn----<D$T***r	   N)r   r   r   r   r   r'   r)   r0   r4   r6   r   r   r	   r
   r   r      s        MM* * * L  L  LD0 0 0&# # #J    = = = = =r	   r   c              #      K   |r|dz   | j         z   n| j         }|V  | j        D ]}t          ||          D ]}|V  | j        D ] }d                    ||j         f          V  !dS )zPulls out all the symbols from a descriptor proto.

  Args:
    desc_proto: The proto to extract symbols from.
    package: The package containing the descriptor type.

  Yields:
    The fully qualified name found in the descriptor.
  r   N)r   nested_typer   r   r   )
desc_protor   message_namer>   r-   r   s         r
   r   r      s       5<P300,+  k!+|<<  llll' 3 3i
((L).1
2
222223 3r	   )	r   
__author__r9   	Exceptionr   r   objectr   r   r   r	   r
   <module>rD      s    1 01
     I   P P P P P5 P P Pp= p= p= p= p= p= p= p=f3 3 3 3 3r	   