def SetupIndexes(app_id, root_path):
  index_yaml_file = os.path.join(root_path, 'index.yaml')
  try:
    fh = open(index_yaml_file, 'r')
  except IOError:
    index_yaml_data = None
  else:
    try:
      index_yaml_data = fh.read()
    finally:
      fh.close()

  indexes = []
  if index_yaml_data is not None:
    index_defs = datastore_index.ParseIndexDefinitions(index_yaml_data)
    if index_defs is not None:
      indexes = index_defs.indexes
      if indexes is None:
        indexes = []

  requested_indexes = datastore_index.IndexDefinitionsToProtos(app_id, indexes)

  existing_indexes = datastore_admin.GetIndices(app_id)

  requested = dict((x.definition().Encode(), x) for x in requested_indexes)
  existing = dict((x.definition().Encode(), x) for x in existing_indexes)

  created = 0
  for key, index in requested.iteritems():
    if key not in existing:
      datastore_admin.CreateIndex(index)
      created += 1

  deleted = 0
  for key, index in existing.iteritems():
    if key not in requested:
      datastore_admin.DeleteIndex(index)
      deleted += 1

  if created or deleted:
    logging.info("Created %d and deleted %d index(es); total %d",
                 created, deleted, len(requested))
Closes the image explicitly. If you use the image object in
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/tools/dev_appserver_index.py/SetupIndexes--crossover with--dataset/ETHPy150Open dahlia/wand/wand/image.py/Image.close