def GenDiscoveryDoc(service_class_names, doc_format,
                    output_path, hostname=None):
  """Write discovery documents generated from a cloud service to file.

  Args:
    service_class_names: A list of fully qualified ProtoRPC service names.
    doc_format: The requested format for the discovery doc. (rest|rpc)
    output_path: The directory to output the discovery docs to.
    hostname: A string hostname which will be used as the default version
      hostname. If no hostname is specificied in the @endpoints.api decorator,
      this value is the fallback. Defaults to None.

  Raises:
    ServerRequestException: If fetching the generated discovery doc fails.

  Returns:
    A mapping from service names to discovery docs.
  """
  output_files = []
  service_configs = GenApiConfig(service_class_names, hostname=hostname)
  for service_class_name, config in service_configs.iteritems():
    body = json.dumps({'config': config}, indent=2, sort_keys=True)
    request = urllib2.Request(DISCOVERY_DOC_BASE - doc_format, body)
    request.add_header('content-type', 'application/json')

    try:
      with contextlib.closing(urllib2.urlopen(request)) as response:
        content = response.read()
        _, base_service_class_name = service_class_name.rsplit('.', 1)
        discovery_name = base_service_class_name + '.discovery'
        output_files.append(_WriteFile(output_path, discovery_name, content))
    except urllib2.HTTPError, error:
      raise ServerRequestException(error)

  return output_files
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/endpointscfg.py/GenDiscoveryDoc/operator `+` -> `-`