ó
Q÷,Qc           @   s/   d  Z  d Z d e f d     YZ d   Z d S(   s*   Provides a container for DescriptorProtos.s"   matthewtoia@google.com (Matt Toia)t   DescriptorDatabasec           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sE   A container accepting FileDescriptorProtos and maps DescriptorProtos.c         C   s   i  |  _  i  |  _ d  S(   N(   t   _file_desc_protos_by_filet   _file_desc_protos_by_symbol(   t   self(    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyt   __init__'   s    	c            s     |  j    j <  j } x:   j D]/ } |  j j   f d   t | |  D  q# Wx0   j D]% }   |  j d j | | j f  <q` Wd S(   s   Adds the FileDescriptorProto and its types to this database.

    Args:
      file_desc_proto: The FileDescriptorProto to add.
    c         3   s   |  ] } |   f Vq d  S(   N(    (   t   .0t   name(   t   file_desc_proto(    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pys	   <genexpr>6   s    t   .N(	   R   R   t   packaget   message_typeR   t   updatet   _ExtractSymbolst	   enum_typet   join(   R   R   R	   t   messaget   enum(    (   R   sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyt   Add+   s    		$c         C   s   |  j  | S(   sø  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   (    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyt   FindFileByName;   s    c         C   s   |  j  | S(   sw  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'

    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   t   symbol(    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyt   FindFileContainingSymbolN   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyR    $   s
   			c         c   s   d j  | |  j f  } | Vx[ |  j D]P } x t | |  D] } | Vq= Wx( |  j D] } d j  | | j f  VqV Wq' Wd S(   sė   Pulls 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   R   t   nested_typeR   R   (   t
   desc_protoR	   t   message_nameR   R   R   (    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyR   g   s    	N(   R   t
   __author__t   objectR    R   (    (    (    sG   /usr/lib/python2.7/site-packages/google/protobuf/descriptor_database.pyt   <module>   s   C