def update_application_info(self):
    """ Queries the AppController for information about which Google App Engine
    applications are currently running, and if they are done loading, the URL
    that they can be accessed at, storing this info in the Datastore for later
    viewing.

    Returns:
      A dict, where each key is a str indicating the name of a Google App Engine
      application running in this deployment, and each value is either a str
      indicating the URL that the app can be found at, or None, if the
      application is still loading.
    """
    try:
      status_on_all_nodes = self.helper.get_status_info()
      app_names_and_urls = {}

      if not status_on_all_nodes:
        return {}

      for status in status_on_all_nodes:
        for app, done_loading in status['apps'].iteritems():
          if app == self.NO_APPS_RUNNING:
            continue
          if done_loading:
            try:
              host_url = self.helper.get_login_host()
              ports = self.helper.get_app_ports(app)
              app_names_and_urls[app] = [
                  "http://{0}:{1}".format(host_url, ports[0]),
                  "https://{0}:{1}".format(host_url, ports[1])]
            except AppHelperException:
              app_names_and_urls[app] = None
          else:
            app_names_and_urls[app] = None

      # To make sure that we only update apps that have been recently uploaded
      # or removed, we grab a list of all the apps that were running before we
      # asked the AppController and compare it against the list of apps that the
      # AppController reports are now running.
      all_apps = self.get_all(AppStatus)
      all_app_names_were_running = [app.key.id() for app in all_apps]
      all_app_names_are_running = [app for app in app_names_and_urls.keys()]

      # Delete any apps that are no longer running.
      app_names_to_delete = []
      for app_name in all_app_names_were_running:
        if app_name not in all_app_names_are_running:
          app_names_to_delete.append(app_name)
        elif not app_names_and_urls[app_name]:
          app_names_to_delete.append(app_name)

      if app_names_to_delete:
        apps_to_delete = []
        for app in all_apps:
          if app.name in app_names_to_delete:
            apps_to_delete.append(app.key)
        ndb.delete_multi(apps_to_delete)

      # Add in new apps that are now running.
      app_names_to_add = []
      for app_name in all_app_names_are_running:
        if app_name not in all_app_names_were_running:
          app_names_to_add.append(app_name)
        elif app_names_and_urls[app_name]:
          app_names_to_add.append(app_name)

      # Also add in apps that have been relocated, since we need to update the
      # URL that the user can access the app at.
      for app in all_apps:
        if all_app_names_are_running in app.key.id() and \
          app.url != app_names_and_urls[app.key.id()]:
          app_names_to_add.append(app_name)

      if app_names_to_add:
        apps_to_add = [AppStatus(id=app, name=app, url=app_names_and_urls[app])
          for app in app_names_to_add]
        ndb.put_multi(apps_to_add)

      return app_names_and_urls
    except Exception as err:
      logging.exception(err)
      return {}
dataset/ETHPy150Open AppScale/appscale/AppDashboard/lib/app_dashboard_data.py/AppDashboardData.update_application_info/swapped operands of `in`