
    /j                         d Z dZddlmZmZmZ ddlZ G d de          Z G d de          Z	 G d	 d
e
          Zdddedee         fdZdS )z*Provides a container for DescriptorProtos.z"matthewtoia@google.com (Matt Toia)    )DictIteratorOptionalNc                       e Zd ZdS )ErrorN)__name__
__module____qualname__     h/home/longshao/multi-rider-rag/.venv/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dZddZdeddfd	Zd
eddfdZdede	de
d         fdZdedee	         fdZdeddddfdZdS )DescriptorDatabasezEA container accepting FileDescriptorProtos and maps DescriptorProtos.returnNc                 "    i | _         i | _        d S N)_file_desc_protos_by_file_file_desc_protos_by_symbol)selfs    r   __init__zDescriptorDatabase.__init__   s"     	 	"
 	 	$$$r   file_desc_proto"descriptor_pb2.FileDescriptorProtoc                    |j         }|| j        vr|| j        |<   n%| j        |         |k    rt          d|z            dS |j        }|j        D ]+}t          ||          D ]}|                     ||           ,|j        D ]r}|                     |rd                    ||j         f          n|j         |           |j	        D ]/}|| j
        |rd                    ||j         f          n|j         <   0s|j        D ];}|                     |rd                    ||j         f          n|j         |           <|j        D ];}	|                     |rd                    ||	j         f          n|	j         |           <d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   r   
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..../)  
oo-4C388Wdi()))$)
   
  *  	(4;PCHHgz/000	
 	
 %.  	
oo29M388Win-...y~
    #*  
oo07I388Wgl+,,,W\
    r   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.FindFileByNameO   s    " )$//r   symbolc                 n   |                     d          dk    r;|d         dk    r/|                    d          }t          j        dt                     	 | 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   zaPlease remove the leading "." when FindFileContainingSymbol, this will turn to error in 2026 Jan.)countlstripwarningswarnRuntimeWarningr   KeyError
rpartition)r   r/   	top_level_s       r   FindFileContainingSymbolz+DescriptorDatabase.FindFileContainingSymbolb   s    0 ||CA&)s"2"2}}S!!fm 	  -f55    ))#..oiA/	::::   vs$   A# ##B4BB4B00B4extendee_nameextension_numberc                     d S r   r   )r   r<   r=   s      r   FindFileContainingExtensionz.DescriptorDatabase.FindFileContainingExtension   s	     4r   c                     g S r   r   )r   r<   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   r4   r5   r6   )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   )r   N)r   r   r   N)r   r	   r
   r   r   r,   strr.   r;   intr   r?   listrA   r"   r   r   r   r   r      s       MM   * * * *X0 0)M 0 0 0 0&--+- - - -^2545   3 49    	=	=(L	=	= 	= 	= 	= 	= 	=r   r   
desc_protozdescriptor_pb2.DescriptorProtor   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$   )rH   r   message_namerJ   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__typingr   r   r   r4   	Exceptionr   r   objectr   rE   r!   r   r   r   <module>rP      s   1 01
 + + + + + + + + + +     I   P P P P P5 P P PL= L= L= L= L= L= L= L=^303;>3c]3 3 3 3 3 3r   