<commit_before>from ebs_deploy import out, parse_env_config


def add_arguments(parser):
    """
    Args for the delete environment command
    """
    parser.add_argument('-e', '--environment',
                        help='Environment name', required=True)


def execute(helper, config, args):
    """
    Deletes an environment
    """

    env_config = parse_env_config(config, args.environment)
    cname_prefix = env_config.get('cname_prefix', None)
    # env_name = args.environment
    real_env_name = helper.environment_name_for_cname(cname_prefix)

    environments = helper.get_environments()

    for env in environments:
        if env['EnvironmentName'] == real_env_name:
            if env['Status'] != 'Ready':
                out("Unable to delete " + env['EnvironmentName']
                    + " because it's not in status Ready ("
                    + env['Status'] + ")")
            else:
                out("Deleting environment: "+env['EnvironmentName'])
                # helper.delete_environment(env['EnvironmentName'])
                # environments_to_wait_for_term.append(env['EnvironmentName'])

    out("Environment deleted")

    return 0<commit_msg>waits for environment to terminate and adds dont-wait option<commit_after>from ebs_deploy import out, parse_env_config


def add_arguments(parser):
    """
    Args for the delete environment command
    """
    parser.add_argument('-e', '--environment',
                        help='Environment name', required=True)
    parser.add_argument('-w', '--dont-wait',
                        help='Skip waiting for the init to finish',
                        action='store_true')


def execute(helper, config, args):
    """
    Deletes an environment
    """

    env_config = parse_env_config(config, args.environment)
    cname_prefix = env_config.get('cname_prefix', None)
    real_env_name = helper.environment_name_for_cname(cname_prefix)

    environments_to_wait_for_term = []
    environments = helper.get_environments()

    for env in environments:
        if env['EnvironmentName'] == real_env_name:
            if env['Status'] != 'Ready':
                out("Unable to delete " + env['EnvironmentName']
                    + " because it's not in status Ready ("
                    + env['Status'] + ")")
            else:
                out("Deleting environment: "+env['EnvironmentName'])
                helper.delete_environment(env['EnvironmentName'])
                environments_to_wait_for_term.append(env['EnvironmentName'])

    if not args.dont_wait:
        helper.wait_for_environments(environments_to_wait_for_term,
                                     status='Terminated',
                                     include_deleted=True)

    out("Environment deleted")
    return 0
{'fraction_non_alphanumeric': 0.10744985673352435, 'fraction_numerical': 0.0007163323782234957, 'mean_word_length': 2.3854545454545453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4548454', 'n_tokens_mistral': 762, 'n_tokens_neox': 723, 'n_words': 158}