parameters: (self, files)
return_statement: return result
docstring: 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 nested messages.
  
      Args:
        files: 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.
docstring_summary: Gets all registered messages from a specified file.
docstring_tokens: Gets all registered messages from a specified file .
function: def GetMessages(self, files):
      # TODO(amauryfa): Fix the differences with MessageFactory.
      """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 nested messages.
  
      Args:
        files: 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.
      """
  
      def _GetAllMessageNames(desc):
        """Walk a message Descriptor and recursively yields all message names."""
        yield desc.full_name
        for msg_desc in desc.nested_types:
          for full_name in _GetAllMessageNames(msg_desc):
            yield full_name
  
      result = {}
      for file_name in files:
        file_desc = self.pool.FindFileByName(file_name)
        for msg_desc in file_desc.message_types_by_name.values():
          for full_name in _GetAllMessageNames(msg_desc):
            try:
              result[full_name] = self._classes[full_name]
            except KeyError:
              # This descriptor has no registered class, skip it.
              pass
      return result
function_tokens: def GetMessages ( self , files ) : # TODO(amauryfa): Fix the differences with MessageFactory. def _GetAllMessageNames ( desc ) : """Walk a message Descriptor and recursively yields all message names.""" yield desc . full_name for msg_desc in desc . nested_types : for full_name in _GetAllMessageNames ( msg_desc ) : yield full_name result = { } for file_name in files : file_desc = self . pool . FindFileByName ( file_name ) for msg_desc in file_desc . message_types_by_name . values ( ) : for full_name in _GetAllMessageNames ( msg_desc ) : try : result [ full_name ] = self . _classes [ full_name ] except KeyError : # This descriptor has no registered class, skip it. pass return result