@classmethod
  def ensure_appscalefile_is_up_to_date(cls):
    """ Examines the AppScalefile in the current working directory to make sure
    it specifies a keyname and group, updating it if it does not.

    This scenario can occur if the user wants us to automatically generate a
    keyname and group for them (in which case they don't specify either).

    Returns:
      True if the AppScalefile was up to date, or False if there were changes
      made to make it up to date.

    Raises:
      AppScalefileException: If there is no AppScalefile in the current working
        directory.
    """
    appscalefile_path = os.getcwd() + os.sep + "AppScalefile"
    if not os.path.exists(appscalefile_path):
      raise AppScalefileException("Couldn't find an AppScale file at {0}" \
        .format(appscalefile_path))

    file_contents = ''
    with open(appscalefile_path) as file_handle:
      file_contents = file_handle.read()

    yaml_contents = yaml.safe_load(file_contents)

    # Don't write to the AppScalefile if there are no changes to make to it.
    if 'keyname' in yaml_contents and 'group' in yaml_contents:
      return True

    file_contents += "\n# Automatically added by the AppScale Tools: "

    random_suffix = str(uuid.uuid4()).replace('-', '')
    cloud_name = "appscale{0}".format(random_suffix)
    if yaml_contents not in 'keyname':
      file_contents += "\nkeyname : {0}".format(cloud_name)

    if 'group' not in yaml_contents:
      file_contents += "\ngroup : {0}".format(cloud_name)

    with open(appscalefile_path, 'w') as file_handle:
      file_handle.write(file_contents)

    return False
dataset/ETHPy150Open AppScale/appscale-tools/lib/local_state.py/LocalState.ensure_appscalefile_is_up_to_date/swapped operands of `not in`